Events reference
JSON events have this shape — branch on type (names are case-sensitive):
{ "type": "position_create", "session_id": "f6a1c2d3-…", "payload": { … } }
Price ticks are the exception: they're binary CSV frames.
Prices
After start_market_feed, each tick arrives as a binary frame containing
one CSV line — no JSON, no type:
26100001,1.08232,1.08244,1.08301,1.08012,1.08120,1.08232,0,1781251234567,1781251234570,1781251234571
| Column | Field |
|---|---|
| 0 | symbol_id |
| 1, 2 | bid, ask — already include your group's spread |
| 3–6 | high, low, open, close from the price provider |
| 7 | volume |
| 8 | ts — tick time, Unix ms |
| 9, 10 | internal latency stamps — ignore |
def parse_tick(frame: bytes):
f = frame.decode().split(",")
return {"symbol_id": int(f[0]), "bid": float(f[1]), "ask": float(f[2]), "ts": int(f[8])}
Also on price topics: symbol_status ({symbol_id, status}) when a symbol is
enabled, disabled or closed for trading.
Account & money
| Event | When |
|---|---|
account_Summary | Live balance, equity and margin — note the capital S. At most one every 200 ms. |
money_change | Deposit, withdrawal, adjustment, or credit. |
balance_correction | The broker corrected your balance. |
account_update | Account settings changed (leverage, status, group…). |
event_liqudation_status | You reached a margin call or stop-out (spelling is exact). |
{
"type": "account_Summary",
"session_id": "f6a1c2d3-…",
"payload": {
"ts": 1781251234567, "account_id": 26100003,
"balance": 100000, "credit": 0, "equity": 99998.8,
"used_margin": 108.23, "free_margin": 99890.57, "margin_level": 92390.1,
"floating_profit": -1.2,
"positions": [ { "id": 260610016, "profit": -1.2 } ]
}
}
positions[] carries the live P/L of each open position — use it instead of
polling. On prop accounts the payload also has prop_status.
{ "type": "money_change", "session_id": "f6a1c2d3-…", "payload": { "account_id": 26100003, "amount": 5000, "balance": 105000, "credit": 0, "desc": "Deposit", "origin": 0, "type": 0 } }
origin: 0 deposit, 2 adjustment, 3 withdrawal, 6 credit in,
7 credit out. type: 0 credit (money in), 1 debit (money out).
Orders
The payload is the full Order (id, symbol_id, type, side, volume,
status, order_price, order_limit_price, stop_loss, take_profit,
filled_volume, filled_price, position_id, comment, rejection_msg,
expiry_at, …). Enum values are in
Orders, positions & deals.
| Event | When |
|---|---|
order_create | An order was received / a pending order was placed. |
order_update | An order changed — modified, or filled (status: 3). |
order_cancel | A pending order was cancelled. |
order_rejected | The engine rejected the order — see rejection_msg. |
order_expired | A pending order reached its expiry. |
Positions
The payload is the full Position (id, symbol_id, side, volume,
open_price, close_price, current_price, stop_loss, take_profit,
profit, swaps, comment, status, …).
| Event | When |
|---|---|
position_create | An order filled and opened a position. open_price is your fill. |
position_update | SL/TP or another field changed. |
position_close | A position closed (status: 2). On a partial close, this event carries a new closed record (its own id, the closed volume, comment Partial close …), and the original position gets a position_update with its remaining volume. |
{ "type": "position_create", "session_id": "f6a1c2d3-…", "payload": { "id": 260610016, "symbol_id": 26100001, "side": 0, "volume": 0.1, "open_price": 1.08234, "stop_loss": 1.08022, "take_profit": 1.08622, "comment": "bot1-7f3a", "status": 0 } }
Deals
| Event | When |
|---|---|
deal_create | A deal was booked. direction: 1 (exit) carries the realized profit, commission and swap. |
deal_update / deal_delete | The broker corrected or cancelled a deal. |
When a position closes, you may also get a deal_create and money_change
whose payload is the Position. Check for direction before treating a
payload as a Deal. Your deal history is always correct over
GET /api/v1/deals/accounts/me.
Session
| Event | When |
|---|---|
session_client_logout | This session was killed. payload: 0 — too many sessions; 1 — disconnected by the broker. The socket closes ~5 s later and the tokens no longer work — log in again. |
unauthorized | The session_id is invalid or expired. The socket closes. |
Reports
report_create, report_status (generation finished or failed) and
report_delete — for reports you requested with a password session.
Errors
bad_request, forbidden, not_found, unauthorized,
internal_server_error:
{ "type": "bad_request", "session_id": "f6a1c2d3-…", "payload": { "message": "not enough free margin — this order needs 1082.34", "reason": "order_create" } }
payload.reason is the action that failed. See
Errors for the common messages.