Subscribing & actions
Every frame you send is JSON text with a type and a payload.
Your account
Nothing to send. Every connection is subscribed to its own account automatically.
Prices
{ "type": "start_market_feed", "payload": {} }
Starts ticks for every symbol. There's no per-symbol subscription, so filter
the ticks by symbol_id on your side.
Each start_market_feed adds another subscription, so sending it twice
delivers every tick twice. Send it once after each (re)connect.
Stop the price feed:
{ "type": "stop_market_feed", "payload": {} }
Trading over the WebSocket
You can trade on the socket instead of REST. Results arrive as the same
lifecycle events and error frames. The WebSocket also accepts a few options
that REST doesn't: trailing_stop, break_even and break_even_offset.
Place an order — same fields as the REST order:
{
"type": "order_create",
"payload": {
"symbol_id": 26100001, "type": 0, "side": 0, "volume": 0.10,
"order_price": 1.08234, "stop_loss": 1.08022, "take_profit": 1.08622,
"comment": "bot1-7f3a"
}
}
Modify a pending order — replaces the order, like REST:
{
"type": "order_update",
"payload": {
"order_id": 260610013, "type": 1, "order_limit_price": 1.07400, "volume": 0.10,
"stop_loss": 1.06900, "take_profit": 1.08900, "expiration_policy": 0
}
}
Cancel a pending order:
{ "type": "order_cancel", "payload": { "order_id": 260610013 } }
Modify a position — send both SL and TP:
{ "type": "position_update", "payload": { "position_id": 260610016, "stop_loss": 1.08120, "take_profit": 1.08622 } }
Close a position — volume is required; less than the full volume is a
partial close:
{ "type": "position_close", "payload": { "position_id": 260610016, "volume": 0.10 } }
Errors
A malformed frame gets an immediate error with the failing action in reason:
{ "type": "bad_request", "session_id": "f6a1c2d3-…", "payload": { "message": "invalid event object", "reason": "bad_request" } }
An unknown type gets method not allowed. Trading-rule rejections
(margin, SL/TP, market closed) arrive a moment later with reason set to your
action, e.g. "order_create". Investor sessions get forbidden for every
trading action. See Errors.