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:
Validates your order - Checks balance, symbol availability, and order parameters
Fetches live prices - Retrieves real-time bid/ask prices from the market data feed
Calculates margin - Determines required margin based on leverage
Executes instantly - Processes the order and updates your positions
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
}'
{
"message" : "Order created successfully" ,
"orderId" : "550e8400-e29b-41d4-a716-446655440000"
}
{
"error" : "Insufficient balance. Required: $430.00, Available: $100.00"
}
Order Parameters
Parameter Type Required Description symbolstring Yes Trading pair (e.g., BTCUSDT, ETHUSDT, SOLUSDT) typestring Yes Order type: buy or sell quantitynumber Yes Amount to trade leveragenumber Yes Leverage multiplier (1-100x) slippagenumber No Maximum acceptable price slippage percentage takeProfitnumber No Automatic profit-taking price stopLossnumber No Automatic loss-limiting price
Order Execution Flow
Here’s what happens when your order is submitted:
Backend Route
Engine Processing
// 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
Trade: 1 ETH at $2,500
Leverage: 50x
Margin = (1 × $2,500) ÷ 50
= $2,500 ÷ 50
= $50
Trade: 10 SOL at $100
Leverage: 1x
Margin = (10 × $100) ÷ 1
= $1,000 ÷ 1
= $1,000
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:
Error Cause Solution Insufficient balance Not enough funds for margin Deposit more funds or reduce position size Price data not found Symbol not available Check supported trading pairs Invalid order type Type is not ‘buy’ or ‘sell’ Use correct order type Order timeout Request took longer than 3 seconds Retry the request Slippage exceeded Price moved beyond tolerance Increase slippage tolerance or retry
Next Steps
Order Management View, monitor, and close your open positions
Market Data Access live market data and price history