Skip to main content
The Exness Trading Platform provides real-time trading capabilities with live market data streaming and instant order execution. All trades are processed through a distributed architecture using Redis Streams for reliable message delivery.

How Real-Time Trading Works

When you place a trade, the platform:
  1. Validates your order - Checks balance, symbol availability, and order parameters
  2. Fetches live prices - Retrieves real-time bid/ask prices from the market data feed
  3. Calculates margin - Determines required margin based on leverage
  4. Executes instantly - Processes the order and updates your positions
  5. Streams updates - Sends real-time updates via WebSocket
The platform uses Redis Streams to ensure every trade request is processed reliably, even under high load.

Placing a Trade

To place a trade, send a POST request to /api/v1/trade/create with your order details:
curl -X POST https://api.exness.com/api/v1/trade/create \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "BTCUSDT",
    "type": "buy",
    "quantity": 0.1,
    "leverage": 10,
    "slippage": 0.5,
    "takeProfit": 45000,
    "stopLoss": 42000
  }'

Order Parameters

ParameterTypeRequiredDescription
symbolstringYesTrading pair (e.g., BTCUSDT, ETHUSDT, SOLUSDT)
typestringYesOrder type: buy or sell
quantitynumberYesAmount to trade
leveragenumberYesLeverage multiplier (1-100x)
slippagenumberNoMaximum acceptable price slippage percentage
takeProfitnumberNoAutomatic profit-taking price
stopLossnumberNoAutomatic loss-limiting price

Order Execution Flow

Here’s what happens when your order is submitted:
// apps/Backend/src/routes/trade.routes.ts
tradeRouter.post("/create", authMiddleware, async (req: Request, res: Response) => {
  const { symbol, type, quantity, leverage, slippage, takeProfit, stopLoss } = req.body;
  
  // Validate required parameters
  if (!symbol || !type || !quantity || !leverage) {
    return res.status(400).json({
      error: "Missing required parameters: symbol, type, quantity, leverage",
    });
  }

  const userId = req.user?.id;
  
  // Send order to Engine via Redis Stream
  const RedisStreams = req.app.locals.redisStreams;
  const orderPayload = {
    function: "createOrder",
    userId,
    symbol,
    type,
    quantity,
    leverage,
    slippage,
    takeProfit,
    stopLoss
  };
  
  const streamResult = await RedisStreams.addToRedisStream(
    constant.redisStream, 
    orderPayload
  );
  const requestId = streamResult?.requestId;
  
  // Wait for Engine response (3 second timeout)
  const result = await RedisStreams.readNextFromRedisStream(
    constant.secondaryRedisStream,
    3000,
    { requestId }
  );
  
  res.json({
    message: "Order created successfully",
    orderId: result.orderId
  });
});

Slippage Protection

Slippage occurs when the market price moves between when you submit an order and when it executes. The platform protects you by:
  • Checking price movement - Compares expected price vs. actual execution price
  • Cancelling risky orders - Rejects orders if slippage exceeds your tolerance
  • Refunding margin - Returns your margin if the order is cancelled
Set a slippage tolerance between 0.1% and 1% for most market conditions. Use higher values (1-2%) during volatile periods.

Slippage Example

// Expected BTC price: $43,000
// Slippage tolerance: 0.5%
// Current BTC price: $43,250 (0.58% difference)

const priceDifference = Math.abs(43250 - 43000);
const priceDifferencePercent = (priceDifference / 43000) * 100; // 0.58%

if (priceDifferencePercent > 0.5) {
  // Order cancelled - price moved too much
  throw new Error("Order cancelled due to slippage");
}

Margin Calculation

The platform calculates margin using this formula:
Margin Required = (Quantity × Price) ÷ Leverage

Examples

Trade: 0.1 BTC at $43,000
Leverage: 10x

Margin = (0.1 × $43,000) ÷ 10
       = $4,300 ÷ 10
       = $430
Higher leverage requires less margin but increases risk. Your position can be liquidated faster if the market moves against you.

Live Price Feed

All prices are streamed from Binance via WebSocket and distributed through Redis Pub/Sub:
// apps/Price_Poller/src/index.ts
const ws = new WebSocket(config.BINANCE_WS_URL);

ws.on("message", async (data) => {
  const msg = JSON.parse(data.toString());
  
  // Calculate bid/ask spread (0.5%)
  const price = Number(msg.data.p);
  const bidValue = price - (price * 0.005);
  const askValue = price + (price * 0.005);
  
  const priceUpdate = {
    asset: msg.data.s,
    price,
    bidValue,
    askValue
  };
  
  // Publish to WebSocket clients
  await PubsubClient.publish(
    constant.pubsubKey, 
    JSON.stringify(priceUpdate)
  );
  
  // Send to Engine for order processing
  await RedisStreams.addToRedisStream(
    constant.redisStream,
    { function: "pricePoller", message: JSON.stringify([priceUpdate]) }
  );
});

Error Handling

The platform handles various error scenarios:
ErrorCauseSolution
Insufficient balanceNot enough funds for marginDeposit more funds or reduce position size
Price data not foundSymbol not availableCheck supported trading pairs
Invalid order typeType is not ‘buy’ or ‘sell’Use correct order type
Order timeoutRequest took longer than 3 secondsRetry the request
Slippage exceededPrice moved beyond toleranceIncrease slippage tolerance or retry

Next Steps

Order Management

View, monitor, and close your open positions

Market Data

Access live market data and price history

Build docs developers (and LLMs) love