Part 2: trading
Last updated
Now we trade. Every action below is signed by the session key, sent over plain HTTP, and confirmed via the notifications WebSocket. Your wallet stays on the shelf.
The three actions:
Opening a position
Closing a position
Take-profit / stop-loss
Before any of them, you need two pieces of market data.
Symbols. Fetched once at startup from the symbols endpoint. Each symbol gives you a numeric symbol_id, a name (used as the price-feed key), price_precision and quantity_precision (number of decimals), trading_fee (a fraction, e.g. 0.00012 for 12 bps), max_leverage, and min_notional_value. Cache it.
Prices. Connect to the price WebSocket and read one frame. The server pushes a full snapshot of every tradable symbol on every tick, keyed by name. No subscribe message needed.
Last updated

