TermlessDocs

Reference

Objects

Every JSON shape the API sends or takes, with each field explained. Route pages link here; agents can load the OpenAPI document for the same shapes as JSON Schema.

Account

The password is write-only: never returned, stored encrypted with a per-install key.

  • id string required

    Your id for the account, used in every URL. a-z, 0-9 and -, up to 48 characters.

  • label string required

    Display name.

  • login integer required

    MT5 login number.

  • server string required

    Trade server name, for example Pepperstone-Demo.

  • host string required

    Web terminal host the session connects to.

  • port integer required

    Port, usually 443.

  • symbols array of string required

    Symbols kept subscribed for live prices (the watchlist).

  • enabled boolean required

    When false the server keeps the account but does not connect it.

  • created_at integer required

    When the account was added, unix seconds (UTC).

  • tls_name string or null required

    For an IP access point: the name on the gateway's certificate. null for a named host.

  • trade_real boolean required

    Whether trading is allowed when the broker reports this account as real money (account type real or preliminary). Off by default: every route that needs the trade scope then answers 403 real_account. Demo and contest accounts trade either way, and reading is never affected.

  • new_trades_paused boolean required

    New trades are paused (0.6.0): an order that would open something answers 403 trading_paused and is not sent; closing, changing stops and cancelling still work.

  • pinned boolean required

    The gateway's certificate key was pinned by an admin (see the server directory).

  • status object required

    AccountStatus fields
    • connected boolean required

      Whether the session to the broker is up right now.

    • since integer or null required

      Unix seconds (UTC) when the current connection came up. null while disconnected.

    • reconnects integer required

      Automatic reconnects since the server started.

    • ping_ms number or null required

      Last heartbeat round trip in milliseconds. null before the first one.

    • server_build integer or null required

      MT5 build the broker's server reported. null before the first login.

    • last_error string or null required

      Why the last connection attempt failed or the connection dropped. null while connected.

    • subscribed integer required

      Number of symbols with a live price subscription.

    • login_rejected boolean required

      True after the broker refused the login. A refusal within an hour of losing a working connection (a broker restarting refuses logins with code 2 for seconds to minutes) is tried again after 10, 20, 30 and 60 s, then every minute for code 2 until an hour after the loss (0.6.3), then every 5 minutes; any other refusal only every 5 minutes, so a wrong password cannot get the account locked.

    • retry_at integer or null required

      Unix seconds (UTC) of the next connection attempt while disconnected, else null.

  • clock string or null required

    How the trade server's clock relates to UTC, for the *_utc fields (0.7.0): ny7 (New York plus 7 hours on the US calendar: IC Markets, Pepperstone), utc (Exness), or null for none. With a rule, answers and streams carry time_utc beside time, time_utc_msc beside time_msc (and the same for time_setup, time_done, time_update, and expiration_utc beside a pending order's expiration), each worked out by itself from the time-zone database; a time in New York's repeated autumn hour uses the earlier offset and adds <name>_utc_ambiguous: true. Without one, no UTC fields: Termless never guesses a broker's clock.

    ny7utcNone
Example
{
  "id": "pepperstone-12345678",
  "label": "Pepperstone demo",
  "login": 12345678,
  "server": "Pepperstone-Demo",
  "host": "mt5-demo01.pepperstone.com",
  "port": 443,
  "symbols": [
    "XAUUSD",
    "EURUSD"
  ],
  "enabled": true,
  "created_at": 1790881742,
  "tls_name": null,
  "trade_real": false,
  "new_trades_paused": false,
  "clock": null,
  "pinned": false,
  "status": {
    "connected": true,
    "since": 1790968298,
    "reconnects": 0,
    "ping_ms": 14.2,
    "server_build": 6090,
    "last_error": null,
    "subscribed": 2,
    "login_rejected": false,
    "retry_at": null
  }
}

AccountStatus

  • connected boolean required

    Whether the session to the broker is up right now.

  • since integer or null required

    Unix seconds (UTC) when the current connection came up. null while disconnected.

  • reconnects integer required

    Automatic reconnects since the server started.

  • ping_ms number or null required

    Last heartbeat round trip in milliseconds. null before the first one.

  • server_build integer or null required

    MT5 build the broker's server reported. null before the first login.

  • last_error string or null required

    Why the last connection attempt failed or the connection dropped. null while connected.

  • subscribed integer required

    Number of symbols with a live price subscription.

  • login_rejected boolean required

    True after the broker refused the login. A refusal within an hour of losing a working connection (a broker restarting refuses logins with code 2 for seconds to minutes) is tried again after 10, 20, 30 and 60 s, then every minute for code 2 until an hour after the loss (0.6.3), then every 5 minutes; any other refusal only every 5 minutes, so a wrong password cannot get the account locked.

  • retry_at integer or null required

    Unix seconds (UTC) of the next connection attempt while disconnected, else null.

Example
{
  "connected": true,
  "since": 1790968298,
  "reconnects": 0,
  "ping_ms": 14.2,
  "server_build": 6090,
  "last_error": null,
  "subscribed": 2,
  "login_rejected": false,
  "retry_at": null
}

AccountCreate

  • id string

    Your id for the account: a-z, 0-9 and -, up to 48 characters. Defaults to the server's first word and the login, for example pepperstone-12345678.

  • label string

    Display name. Defaults to the server and login.

  • login integer required

    MT5 login number (a numeric string also works).

  • password string required write-only

    MT5 password (master or investor). Write-only.

  • server string required

    Trade server name exactly as the broker spells it.

  • host string

    Web terminal host. Looked up from server (this install's directory, then the built-in list) when omitted; 400 if it cannot be found.

  • port integer

    Port. Defaults to the directory's port, else 443.

  • tls_name string

    For an IP access point: the name on its certificate. Defaults to the directory's for that host.

  • symbols array of string

    Symbols to keep subscribed (the watchlist).

  • enabled boolean default true

    false saves the account without connecting it.

  • trade_real boolean default false

    Allow trading when the broker reports the account as real money. Off by default; demo and contest accounts trade either way.

  • clock string or null

    How the trade server's clock relates to UTC, for the *_utc fields (0.7.0): ny7 (New York plus 7 hours on the US calendar: IC Markets, Pepperstone), utc (Exness), or null for none. With a rule, answers and streams carry time_utc beside time, time_utc_msc beside time_msc (and the same for time_setup, time_done, time_update, and expiration_utc beside a pending order's expiration), each worked out by itself from the time-zone database; a time in New York's repeated autumn hour uses the earlier offset and adds <name>_utc_ambiguous: true. Without one, no UTC fields: Termless never guesses a broker's clock.

    ny7utcNone
Example
{
  "label": "Pepperstone demo",
  "login": 12345678,
  "password": "your MT5 password",
  "server": "Pepperstone-Demo",
  "symbols": [
    "XAUUSD",
    "EURUSD"
  ]
}

AccountPatch

Send only the fields you want to change.

  • label string

    Display name.

  • password string write-only

    New MT5 password. Write-only. Logs in again.

  • server string

    Trade server name. Logs in again; the host is looked up when host is not sent.

  • host string

    Web terminal host. Logs in again.

  • port integer

    Port. Logs in again.

  • tls_name string

    The name on the gateway's certificate, for an IP access point; an empty string clears it. Logs in again.

  • symbols array of string

    Replaces the whole watchlist and starts streaming new symbols without logging in again.

  • enabled boolean

    false logs out and parks the account, true connects it again.

  • trade_real boolean

    true allows trading when the broker reports the account as real money; false turns it off again. Takes effect at once, without logging in again.

  • new_trades_paused boolean

    true refuses orders that would open something (403 trading_paused, not sent) while closing, changing stops and cancelling still work; false lets them through again (0.6.0). At once, no new login.

  • clock string or null

    How the trade server's clock relates to UTC, for the *_utc fields (0.7.0): ny7 (New York plus 7 hours on the US calendar: IC Markets, Pepperstone), utc (Exness), or null for none. With a rule, answers and streams carry time_utc beside time, time_utc_msc beside time_msc (and the same for time_setup, time_done, time_update, and expiration_utc beside a pending order's expiration), each worked out by itself from the time-zone database; a time in New York's repeated autumn hour uses the earlier offset and adds <name>_utc_ambiguous: true. Without one, no UTC fields: Termless never guesses a broker's clock. null takes it away; at once, open streams too.

    ny7utcNone
Example
{
  "symbols": [
    "XAUUSD",
    "EURUSD",
    "GBPUSD"
  ]
}
Another example
{
  "trade_real": true
}

Summary

  • login integer required

    MT5 login number.

  • name string required

    Account holder name at the broker.

  • server string required

    Trade server name.

  • company string required

    Broker company name.

  • currency string required

    Deposit currency.

  • leverage integer required

    Leverage, for example 200 for 1:200.

  • balance number required

    Balance without open positions.

  • credit number required

    Credit from the broker.

  • profit number required

    Floating profit of open positions, live.

  • equity number required

    balance + credit + profit, live.

  • margin number required

    Margin in use, live.

  • margin_free number required

    equity - margin.

  • margin_level number required

    equity / margin x 100, in percent. 0 with no margin in use.

  • margin_so_call number required

    Margin call level.

  • margin_so_so number required

    Stop out level.

  • trade_allowed boolean required

    Whether the broker allows trading on this account.

  • demo boolean required

    True for a demo account.

  • hedging boolean required

    True for a hedging account, false for netting.

  • server_offset integer required

    Trade server clock, in seconds east of UTC. Subtract it from any market or trade time to get UTC. From the account record, read again at least hourly, and checked against live ticks (a tick's server time minus its arrival, to the quarter hour): when they disagree the ticks win while a tick agreed in the last 10 minutes, then the record. It is the offset now; times from before the broker's last summer-time switch were stamped with the old one.

  • positions integer required

    Open positions.

  • orders integer required

    Pending orders.

Example
{
  "login": 12345678,
  "name": "Demo Trader",
  "server": "Pepperstone-Demo",
  "company": "Pepperstone Group Limited",
  "currency": "USD",
  "leverage": 200,
  "balance": 10412.58,
  "credit": 0.0,
  "profit": 238.11,
  "equity": 10650.69,
  "margin": 878.93,
  "margin_free": 9771.76,
  "margin_level": 1211.78,
  "margin_so_call": 100.0,
  "margin_so_so": 50.0,
  "trade_allowed": true,
  "demo": true,
  "hedging": true,
  "server_offset": 10800,
  "positions": 3,
  "orders": 2
}

SymbolBrief

  • name string required

    Symbol name, for example XAUUSD.

  • description string required

    Broker's description.

  • path string required

    Folder in the broker's symbol tree.

  • digits integer required

    Price decimals.

Example
{
  "name": "XAUUSD",
  "description": "Gold vs US Dollar",
  "path": "Metals\\XAUUSD",
  "digits": 2
}

SymbolSpec

With the broker's group overrides applied.

  • name string required

    Symbol name.

  • description string required

    Broker's description.

  • path string required

    Folder in the broker's symbol tree.

  • digits integer required

    Price decimals.

  • point number required

    Smallest price step, 10^-digits.

  • contract_size number required

    Units per 1.00 lot.

  • tick_size number required

    Smallest price change. The point when the broker does not send one.

  • tick_value number or null required

    Value of one tick_size move for 1.00 lot, in the account currency. The broker's own figure, else worked out as the terminal does: tick_size x contract_size, converted from currency_profit to the account currency, for forex, CFD, leveraged CFD and exchange stock symbols. null when the broker sends none and it cannot be worked out (futures and index CFDs, or no conversion symbol). Pepperstone sends neither tick value nor tick size.

  • currency_base string required

    Base currency.

  • currency_profit string required

    Profit currency.

  • currency_margin string required

    Margin currency.

  • volume_min number required

    Smallest order, in lots.

  • volume_max number required

    Largest order, in lots.

  • volume_step number required

    Lot step.

  • volume_limit number required

    Largest total of open positions and pending orders in one direction, in lots. 0 = no limit.

  • trade_mode string required

    Whether trading is allowed. unknown only for a value MetaTrader does not define.

    fulllong_onlyshort_onlyclose_onlydisabledunknown
  • execution string required

    Execution mode. unknown only for a value MetaTrader does not define.

    marketinstantrequestexchangeunknown
  • filling array of string required

    Filling modes the symbol allows.

    fokiocreturn
  • stops_level integer required

    Minimum distance of SL and TP from the price, in points.

  • freeze_level integer required

    Distance in points inside which orders cannot be changed.

  • swap_long number required

    Swap for long positions, in the unit swap_mode names.

  • swap_short number required

    Swap for short positions, in the unit swap_mode names.

  • swap_mode string required

    The unit of swap_long and swap_short. unknown only for a value MetaTrader does not define.

    disabledpointssymbol_currencymargin_currencydeposit_currencyinterest_currentinterest_openreopen_currentreopen_bidprofit_currencyunknown
  • swap_3day string or null required

    The day the swap is charged three times: sunday, monday, tuesday, wednesday, thursday, friday or saturday. null for none (crypto CFDs send none).

  • margin_initial number required

    Initial margin setting of the symbol, as the broker sends it.

  • margin_maintenance number required

    Maintenance margin setting, as the broker sends it.

  • margin_hedged number required

    Margin for a hedged pair of positions (one lot each way), as the broker sends it.

  • margin_rate_buy number required

    Initial margin rate for a buy (the same as margin_rates.buy).

  • margin_rate_sell number required

    Initial margin rate for a sell (the same as margin_rates.sell).

  • margin_rates object required

    Every order type's initial margin rate, as the broker sends it. A pending type's rate is what the broker holds while such an order waits: the brokers seen send 0 there (nothing is held), and once the order fills the position needs its side's market rate. A market rate of 0 counts as 1.

    Fields
    • buy number required

      Initial margin rate for a buy.

    • sell number required

      Initial margin rate for a sell.

    • buy_limit number required

      Initial margin rate for a buy limit.

    • sell_limit number required

      Initial margin rate for a sell limit.

    • buy_stop number required

      Initial margin rate for a buy stop.

    • sell_stop number required

      Initial margin rate for a sell stop.

    • buy_stop_limit number required

      Initial margin rate for a buy stop limit.

    • sell_stop_limit number required

      Initial margin rate for a sell stop limit.

  • expiration array of string required

    The expiry modes a pending order on this symbol may use.

    gtcdayspecifiedspecified_day
  • order_types array of string required

    The order types the symbol takes.

    marketlimitstopstop_limitsltpclose_by
  • sessions object required

    Fields
    • quote array of array of array of integer required

      Quote sessions: 7 lists, one per weekday, Sunday first, each a list of [open_min, close_min] in minutes from midnight, trade server time.

    • trade array of array of array of integer required

      Trade sessions, same shape as quote.

  • tradeable boolean or null required

    Whether a trade can be opened now, as on /quotes: the trade_mode is full, long_only or short_only, and one of today's trade sessions is open by the server's clock. null when the broker sent no trade sessions.

  • book_depth integer

    The levels a side of the symbol's order book may hold (0 when the broker sends none); a book past it is renewed (0.7.0).

Example
{
  "name": "XAUUSD",
  "description": "Gold vs US Dollar",
  "path": "Metals\\XAUUSD",
  "digits": 2,
  "point": 0.01,
  "contract_size": 100,
  "tick_size": 0.01,
  "tick_value": 1.0,
  "currency_base": "XAU",
  "currency_profit": "USD",
  "currency_margin": "XAU",
  "volume_min": 0.01,
  "volume_max": 100,
  "volume_step": 0.01,
  "volume_limit": 0,
  "trade_mode": "full",
  "execution": "market",
  "filling": [
    "fok",
    "ioc"
  ],
  "stops_level": 0,
  "freeze_level": 0,
  "swap_long": -6.2,
  "swap_short": 1.4,
  "swap_mode": "points",
  "swap_3day": "wednesday",
  "margin_initial": 0.0,
  "margin_maintenance": 0.0,
  "margin_hedged": 50.0,
  "margin_rate_buy": 1.0,
  "margin_rate_sell": 1.0,
  "margin_rates": {
    "buy": 1.0,
    "sell": 1.0,
    "buy_limit": 0.0,
    "sell_limit": 0.0,
    "buy_stop": 0.0,
    "sell_stop": 0.0,
    "buy_stop_limit": 0.0,
    "sell_stop_limit": 0.0
  },
  "expiration": [
    "gtc",
    "day",
    "specified",
    "specified_day"
  ],
  "order_types": [
    "market",
    "limit",
    "stop",
    "stop_limit",
    "sl",
    "tp",
    "close_by"
  ],
  "sessions": {
    "quote": [
      [],
      [
        [
          0,
          1440
        ]
      ],
      [
        [
          0,
          1440
        ]
      ],
      [
        [
          0,
          1440
        ]
      ],
      [
        [
          0,
          1440
        ]
      ],
      [
        [
          0,
          1440
        ]
      ],
      []
    ],
    "trade": [
      [],
      [
        [
          0,
          1440
        ]
      ],
      [
        [
          0,
          1440
        ]
      ],
      [
        [
          0,
          1440
        ]
      ],
      [
        [
          0,
          1440
        ]
      ],
      [
        [
          0,
          1440
        ]
      ],
      []
    ]
  },
  "tradeable": true
}

Quote

  • symbol string required

    Symbol name.

  • bid number or null required

    Bid price. null when the symbol has no price yet.

  • ask number or null required

    Ask price. null when the symbol has no price yet.

  • last number or null required

    Last deal price. 0 for most forex and CFD symbols; null when the symbol has no price yet.

  • time integer or null required

    Unix seconds, trade server clock.

  • time_msc integer or null required

    Unix milliseconds, trade server clock.

  • tradeable boolean or null required

    Whether a trade can be opened now: the symbol's trade_mode is full, long_only or short_only, and one of today's trade sessions is open by the server's clock. null when the broker sent no trade sessions.

Example
{
  "symbol": "XAUUSD",
  "bid": 2391.42,
  "ask": 2391.6,
  "last": 0,
  "time": 1790981179,
  "time_msc": 1790981179473,
  "tradeable": true
}

Candles

  • symbol string required

    Symbol name, as the broker spells it.

  • timeframe string required

    Timeframe.

    M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1
  • candles array of Candle required

    Bars, oldest first. Each says whether it is complete.

    Candle fields
    • time integer required

      Bar open time, unix seconds, trade server clock.

    • open number required

      Open.

    • high number required

      High.

    • low number required

      Low.

    • close number required

      Close.

    • tick_volume integer required

      Tick count in the bar.

    • real_volume integer required

      Exchange volume. 0 for most CFD symbols.

    • spread integer required

      Always 0: the web protocol's bars carry no spread (MetaTrader builds bars from the bid).

    • complete boolean required

      The bar has closed, by the server's clock (a month bar closes at the next month's start). The newest bar is usually still forming, but at a weekend or a daily break it may be closed too: read this rather than dropping the last bar.

    • time_utc integer

      Bar open time in UTC, unix seconds; only with the account's clock rule (0.7.0).

    • time_utc_ambiguous boolean

      true when the time falls in New York's repeated autumn hour (0.7.0).

Example
{
  "symbol": "XAUUSD",
  "timeframe": "M5",
  "candles": [
    {
      "time": 1790980500,
      "open": 2394.31,
      "high": 2395.1,
      "low": 2390.58,
      "close": 2392.41,
      "tick_volume": 2330,
      "real_volume": 0,
      "spread": 0,
      "complete": true
    },
    {
      "time": 1790980800,
      "open": 2392.41,
      "high": 2394.19,
      "low": 2392.29,
      "close": 2393.97,
      "tick_volume": 834,
      "real_volume": 0,
      "spread": 0,
      "complete": false
    }
  ]
}

Candle

  • time integer required

    Bar open time, unix seconds, trade server clock.

  • open number required

    Open.

  • high number required

    High.

  • low number required

    Low.

  • close number required

    Close.

  • tick_volume integer required

    Tick count in the bar.

  • real_volume integer required

    Exchange volume. 0 for most CFD symbols.

  • spread integer required

    Always 0: the web protocol's bars carry no spread (MetaTrader builds bars from the bid).

  • complete boolean required

    The bar has closed, by the server's clock (a month bar closes at the next month's start). The newest bar is usually still forming, but at a weekend or a daily break it may be closed too: read this rather than dropping the last bar.

  • time_utc integer

    Bar open time in UTC, unix seconds; only with the account's clock rule (0.7.0).

  • time_utc_ambiguous boolean

    true when the time falls in New York's repeated autumn hour (0.7.0).

Tick

A price change: the data of event: tick on the SSE stream. With the account's clock rule (0.7.0), UTC fields come beside it (see the account's clock). (time_utc_msc)

  • symbol string required

    Symbol name.

  • bid number required

    Bid price.

  • ask number required

    Ask price.

  • last number required

    Last deal price. 0 for most forex and CFD symbols.

  • time_msc integer required

    Unix milliseconds, trade server clock.

Example
{
  "symbol": "XAUUSD",
  "bid": 2391.42,
  "ask": 2391.6,
  "last": 0,
  "time_msc": 1790981179473
}

StreamStatus

The data of event: status on the SSE stream: sent first, then whenever connected changes, and once more (connected false, with a reason) when the stream ends.

  • connected boolean required

    Whether the account is connected to the broker.

  • ping_ms number or null required

    Last heartbeat round trip in milliseconds.

  • id string

    Only on the first status, and only when the stream follows trades or orders: where the stream starts in the account's trade event numbering. The client's own cursor when it resumed (after= or Last-Event-ID), else the newest event id (<epoch>:0 before the first event), so a client holds a cursor before any trade happens. On SSE the same value is the event's id: line.

  • reason string

    Only on the last status before the stream ends. account changed: the account was deleted or logs in with new details; server stopping: the server is shutting down; key revoked, key changed, signed out (0.6.0): the key that opened it was deleted or may no longer read this account, or the dashboard session ended. Reconnect to follow the account (EventSource does this by itself).

    account changedserver stoppingkey revokedkey changedsigned out
Example
{
  "connected": true,
  "ping_ms": 14.2,
  "id": "1790968290117:40"
}
Another example
{
  "connected": false,
  "ping_ms": null,
  "reason": "account changed"
}

TradeEvent

The data of a trade event (events=trades): one per broker trade push, as it is applied, numbered per account. An order push carries order, state and pending; a deal push carries deal, balance, credit and usually position; a position update carries position only; a deal caught up after a gap carries deal and caught_up: true. For a market order show the deal; for a pending order show its order events (pending: true) and, when it fills, the deal; a position update needs no line of its own.

  • seq integer required

    1, 2, 3, ... per account. The newest 1,024 events are kept in the database, so the numbering carries on across a restart or an upgrade; it starts again only when the account is added again or logs in to another broker account (login or server).

  • id string required

    <epoch>:<seq>, epoch being the unix ms when this numbering began. On SSE also the event's id: line, which EventSource sends back as Last-Event-ID; any client can resume with after=<id>, from before a restart too.

  • what string required

    What happened. For a pending order (kind order): placed, modified or removed while it is live; filled, cancelled, expired, rejected (or done) when it moves to history. For a deal (kind deal): opened, partial, closed, reversed, or balance for a balance, credit or commission deal. For kind position: updated.

    placedmodifiedremovedfilledcancelledexpiredrejecteddoneopenedpartialclosedreversedbalancedealupdated
  • kind string required

    order for an order push, deal for a deal push, position for a position the broker changed without a deal (its SL or TP moved, or the step just before a close; the broker sends it as a deal record with ticket 0 and balance 0, which before 0.2.2 came out as a phantom deal opened).

    orderdealposition
  • pending boolean

    With kind order: true for a limit, stop or stop-limit order, false for a market buy or sell (or a close-by). A market order is placed, taken off the book and filed as filled (or cancelled) in the same moment, each step an order event with pending false and, once done, volume 0 (volume_initial is what was asked); a UI shows the deal event for it and skips these.

  • order object

    Order fields
    • ticket integer required

      Order ticket.

    • symbol string required

      Symbol name.

    • type string required

      Order type. GET /orders and orders events list pending orders only (limit, stop, stop limit); in a trade event a market order is buy or sell (with pending: false).

      buy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitbuysellclose_by
    • side string required

      Direction.

      buysell
    • volume number required

      Lots still to fill.

    • volume_initial number required

      Lots when placed.

    • price number required

      Trigger price.

    • stop_limit number required

      Limit price for stop limit orders, 0 otherwise.

    • sl number required

      Stop loss price, 0 when none.

    • tp number required

      Take profit price, 0 when none.

    • expiration integer required

      Expiry, unix seconds, trade server clock. 0 = good till cancelled.

    • comment string required

      Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

    • magic integer required

      Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). An order that closed a tagged position (its stop, its target) gets the magic but keeps its own comment.

    • reason string required

      Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

      clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
    • time_setup integer required

      When the order was placed, unix seconds, trade server clock.

    • time_setup_msc integer required

      When the order was placed, unix milliseconds, trade server clock.

  • state string

    With kind order: the order's MetaTrader state.

    startedplacedcancelledpartialfilledrejectedexpiredrequestunknown
  • deal object

    Deal fields
    • ticket integer required

      Deal ticket.

    • order integer required

      Order that made the deal.

    • position_id integer required

      Position the deal belongs to (its identifier).

    • symbol string required

      Symbol name. Empty for balance operations.

    • type string required

      The MetaTrader deal type, lowercase. unknown only for a value MetaTrader does not define.

      buysellbalancecreditchargecorrectionbonuscommissioncommission_dailycommission_monthlycommission_agent_dailycommission_agent_monthlyinterestbuy_canceledsell_canceleddividenddividend_frankedtaxunknown
    • entry string required

      in opens, out closes, inout reverses, out_by closes by an opposite position. unknown only for a value MetaTrader does not define.

      inoutinoutout_byunknown
    • volume number required

      Lots.

    • price number required

      Deal price.

    • profit number required

      Realised profit in the deposit currency.

    • commission number required

      Commission.

    • swap number required

      Swap.

    • fee number required

      Fee.

    • magic integer required

      Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). A closing deal (a close at the stop loss or take profit included) gets the magic of the position it closed.

    • comment string required

      Comment. The opening deal of an order sent through Termless with a comment past 31 characters gets the full text back; a closing deal keeps its own (IC Markets and Pepperstone write [sl 4129.45] or [tp ...] there on a close by stop, but read reason).

    • reason string required

      Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

      clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
    • time integer required

      Unix seconds, trade server clock.

    • time_msc integer required

      Unix milliseconds, trade server clock.

  • position object

    With kind deal: the position the deal touched; with kind position: the position that changed. With an extra open. A closed one (open false) carries its last known values (open price, SL, TP, time, comment, magic) with volume 0, where the broker sends zeros. Absent for a balance deal.

    Fields
    • ticket integer required

      Position ticket.

    • symbol string required

      Symbol name.

    • side string required

      Direction.

      buysell
    • volume number required

      Lots.

    • price_open number required

      Open price.

    • price_current number required

      Current close price (bid for a buy, ask for a sell).

    • sl number required

      Stop loss price, 0 when none.

    • tp number required

      Take profit price, 0 when none.

    • profit number required

      Floating profit in the deposit currency, live.

    • swap number required

      Swap so far.

    • commission number required

      Commission so far.

    • comment string required

      Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

    • magic integer required

      Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).

    • reason string required

      Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

      clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
    • identifier integer required

      Position id; the deals of this position carry it as position_id.

    • time integer required

      Open time, unix seconds, trade server clock.

    • time_msc integer required

      Open time, unix milliseconds, trade server clock.

    • time_update integer required

      Last change, unix seconds, trade server clock.

    • open boolean required

      False once the position is closed.

  • positions array of Position

    Other positions the same push updated (a netting account).

    Position fields
    • ticket integer required

      Position ticket.

    • symbol string required

      Symbol name.

    • side string required

      Direction.

      buysell
    • volume number required

      Lots.

    • price_open number required

      Open price.

    • price_current number required

      Current close price (bid for a buy, ask for a sell).

    • sl number required

      Stop loss price, 0 when none.

    • tp number required

      Take profit price, 0 when none.

    • profit number required

      Floating profit in the deposit currency, live.

    • swap number required

      Swap so far.

    • commission number required

      Commission so far.

    • comment string required

      Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

    • magic integer required

      Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).

    • reason string required

      Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

      clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
    • identifier integer required

      Position id; the deals of this position carry it as position_id.

    • time integer required

      Open time, unix seconds, trade server clock.

    • time_msc integer required

      Open time, unix milliseconds, trade server clock.

    • time_update integer required

      Last change, unix seconds, trade server clock.

  • balance number

    With kind deal: the account's balance after the deal. Never on kind position, nor on a caught_up deal.

  • credit number

    With kind deal: the account's credit after the deal. Never on kind position, nor on a caught_up deal.

  • caught_up boolean

    Present and true on a deal the broker made during a gap (the broker link was down, the server was stopped, or the account's session started again) and that was read back from the account's history after it: kind deal with what and deal only (a close is partial while its position is still open), oldest first, before the gap's resync. A deal already sent is never sent again, and nothing older than the oldest event the server keeps for the account (or the start of its numbering) is sent. Up to 7 days back and 500 deals; more than that sends only the resync.

Example
{
  "seq": 42,
  "id": "1790968290117:42",
  "what": "opened",
  "kind": "deal",
  "deal": {
    "ticket": 81200118,
    "order": 51830012,
    "position_id": 51830012,
    "symbol": "XAUUSD",
    "type": "buy",
    "entry": "in",
    "volume": 0.2,
    "price": 2385.0,
    "profit": 0.0,
    "commission": -0.7,
    "swap": 0.0,
    "fee": 0.0,
    "magic": 0,
    "comment": "breakout",
    "reason": "web",
    "time": 1790975498,
    "time_msc": 1790975498123
  },
  "balance": 10412.58,
  "credit": 0.0,
  "position": {
    "ticket": 51830012,
    "symbol": "XAUUSD",
    "side": "buy",
    "volume": 0.2,
    "price_open": 2385.0,
    "price_current": 2385.0,
    "sl": 2380.0,
    "tp": 2420.0,
    "profit": 0.0,
    "swap": 0.0,
    "commission": -0.7,
    "comment": "breakout",
    "magic": 0,
    "reason": "web",
    "identifier": 51830012,
    "time": 1790975498,
    "time_msc": 1790975498123,
    "time_update": 1790975498,
    "open": true
  }
}
Another example
{
  "seq": 41,
  "id": "1790968290117:41",
  "what": "placed",
  "kind": "order",
  "pending": true,
  "order": {
    "ticket": 51830020,
    "symbol": "XAUUSD",
    "type": "buy_limit",
    "side": "buy",
    "volume": 0.1,
    "volume_initial": 0.1,
    "price": 2365.0,
    "stop_limit": 0,
    "sl": 2350.0,
    "tp": 2410.0,
    "expiration": 0,
    "comment": "dip buy",
    "magic": 0,
    "reason": "web",
    "time_setup": 1790977698,
    "time_setup_msc": 1790977698412
  },
  "state": "placed"
}

Resync

The data of a resync event (with events=trades; WebSocket: type resync): trade events were or may have been missed and cannot be replayed. Read positions, orders and deals again, then go on from id. After a gap the deals the broker made meanwhile come first as trade events marked caught_up; pending orders placed or removed and stops moved during the gap have no history, so the resync still follows them.

  • seq integer required

    Its place in the account's numbering: its own seq for a resync the server recorded (after a gap: the broker link came back, the server restarted, the account's session started again; or when the server fell behind the broker), else the newest seq when it was sent.

  • id string required

    <epoch>:<seq>. Carry on from this id.

  • reason string required

    Why. Recorded in the numbering (and replayed like trade events): "the broker link came back; ...", "the server restarted; ...", "the account's session started again; ..." (each after the deals made during the gap, sent first as trade events marked caught_up), "the server fell behind the broker's trade pushes". Sent to one client only: "that id is from another numbering (the account now logs in to another broker account, or its kept events were lost)" (an id from another epoch: the account was added again, or logs in to another broker account), "that id is newer than anything this account has sent", "more happened since that id than the server keeps", "this stream fell behind; read the account again".

Example
{
  "seq": 49,
  "id": "1790968290117:49",
  "reason": "the broker link came back; its trade pushes sent while it was down are not replayed (the deals made meanwhile came first, marked caught_up)"
}
Another example
{
  "seq": 49,
  "id": "1790968290117:49",
  "reason": "the server restarted; trade pushes sent while it was stopped are not replayed (the deals made meanwhile came first, marked caught_up)"
}

TradesSince

The answer of GET /trades: the account's numbered trade events for a client that polls instead of streaming.

  • id string required

    The newest event's id (<epoch>:0 before the first). Ask again with after=<this>.

  • events array of object required

    The events after after, oldest first: each a TradeEvent or a Resync with event beside its fields. Without after: every event kept (up to 1,024). Empty when resync is set.

    Fields
    • event string required

      trade or resync: which of the two the rest of the object is.

      traderesync
  • resync string or null required

    null, or why the events since after cannot be given (another epoch: the account was added again or logs in to another broker account; an id newer than anything sent; more happened than the server keeps). Then read positions, orders and deals again and carry on from id. A restart of the server does not change the epoch: an id from before it still resumes.

Example
{
  "id": "1790968290117:43",
  "events": [
    {
      "event": "trade",
      "seq": 42,
      "id": "1790968290117:42",
      "what": "opened",
      "kind": "deal",
      "deal": {
        "ticket": 81200118,
        "order": 51830012,
        "position_id": 51830012,
        "symbol": "XAUUSD",
        "type": "buy",
        "entry": "in",
        "volume": 0.2,
        "price": 2385.0,
        "profit": 0.0,
        "commission": -0.7,
        "swap": 0.0,
        "fee": 0.0,
        "magic": 0,
        "comment": "breakout",
        "reason": "web",
        "time": 1790975498,
        "time_msc": 1790975498123
      },
      "balance": 10412.58,
      "credit": 0.0,
      "position": {
        "ticket": 51830012,
        "symbol": "XAUUSD",
        "side": "buy",
        "volume": 0.2,
        "price_open": 2385.0,
        "price_current": 2385.0,
        "sl": 2380.0,
        "tp": 2420.0,
        "profit": 0.0,
        "swap": 0.0,
        "commission": -0.7,
        "comment": "breakout",
        "magic": 0,
        "reason": "web",
        "identifier": 51830012,
        "time": 1790975498,
        "time_msc": 1790975498123,
        "time_update": 1790975498,
        "open": true
      }
    },
    {
      "event": "trade",
      "seq": 43,
      "id": "1790968290117:43",
      "what": "updated",
      "kind": "position",
      "position": {
        "ticket": 51830012,
        "symbol": "XAUUSD",
        "side": "buy",
        "volume": 0.2,
        "price_open": 2385.0,
        "price_current": 2391.42,
        "sl": 2386.0,
        "tp": 2420.0,
        "profit": 128.4,
        "swap": -1.12,
        "commission": -1.4,
        "comment": "breakout",
        "magic": 0,
        "reason": "web",
        "identifier": 51830012,
        "time": 1790975498,
        "time_msc": 1790975498123,
        "time_update": 1790981102,
        "open": true
      }
    }
  ],
  "resync": null
}
Another example
{
  "id": "1791012001502:3",
  "events": [],
  "resync": "that id is from another numbering (the account now logs in to another broker account, or its kept events were lost)"
}

AccountSnapshot

The data of an account event (events=account): the account summary with live profit, equity and margin, right after the stream opens and then whenever a value changed, checked every 500 ms at most.

  • login integer required

    MT5 login number.

  • name string required

    Account holder name at the broker.

  • server string required

    Trade server name.

  • company string required

    Broker company name.

  • currency string required

    Deposit currency.

  • leverage integer required

    Leverage, for example 200 for 1:200.

  • balance number required

    Balance without open positions.

  • credit number required

    Credit from the broker.

  • profit number required

    Floating profit of open positions, live.

  • equity number required

    balance + credit + profit, live.

  • margin number required

    Margin in use, live.

  • margin_free number required

    equity - margin.

  • margin_level number required

    equity / margin x 100, in percent. 0 with no margin in use.

  • margin_so_call number required

    Margin call level.

  • margin_so_so number required

    Stop out level.

  • trade_allowed boolean required

    Whether the broker allows trading on this account.

  • demo boolean required

    True for a demo account.

  • hedging boolean required

    True for a hedging account, false for netting.

  • server_offset integer required

    Trade server clock, in seconds east of UTC. Subtract it from any market or trade time to get UTC. From the account record, read again at least hourly, and checked against live ticks (a tick's server time minus its arrival, to the quarter hour): when they disagree the ticks win while a tick agreed in the last 10 minutes, then the record. It is the offset now; times from before the broker's last summer-time switch were stamped with the old one.

  • positions integer required

    Open positions.

  • orders integer required

    Pending orders.

  • time_ms integer required

    When it was computed, unix milliseconds (UTC).

Example
{
  "login": 12345678,
  "name": "Demo Trader",
  "server": "Pepperstone-Demo",
  "company": "Pepperstone Group Limited",
  "currency": "USD",
  "leverage": 200,
  "balance": 10412.58,
  "credit": 0.0,
  "profit": 238.11,
  "equity": 10650.69,
  "margin": 878.93,
  "margin_free": 9771.76,
  "margin_level": 1211.78,
  "margin_so_call": 100.0,
  "margin_so_so": 50.0,
  "trade_allowed": true,
  "demo": true,
  "hedging": true,
  "server_offset": 10800,
  "positions": 3,
  "orders": 2,
  "time_ms": 1790981179473
}

PositionsSnapshot

The data of a positions event (events=positions): every open position with live P/L, on the same 500 ms rhythm as account, only when something changed. A UI never computes P/L itself.

  • positions array of Position required

    Every open position with live profit and price_current.

    Position fields
    • ticket integer required

      Position ticket.

    • symbol string required

      Symbol name.

    • side string required

      Direction.

      buysell
    • volume number required

      Lots.

    • price_open number required

      Open price.

    • price_current number required

      Current close price (bid for a buy, ask for a sell).

    • sl number required

      Stop loss price, 0 when none.

    • tp number required

      Take profit price, 0 when none.

    • profit number required

      Floating profit in the deposit currency, live.

    • swap number required

      Swap so far.

    • commission number required

      Commission so far.

    • comment string required

      Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

    • magic integer required

      Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).

    • reason string required

      Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

      clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
    • identifier integer required

      Position id; the deals of this position carry it as position_id.

    • time integer required

      Open time, unix seconds, trade server clock.

    • time_msc integer required

      Open time, unix milliseconds, trade server clock.

    • time_update integer required

      Last change, unix seconds, trade server clock.

  • time_ms integer required

    When it was computed, unix milliseconds (UTC).

Example
{
  "positions": [
    {
      "ticket": 51830012,
      "symbol": "XAUUSD",
      "side": "buy",
      "volume": 0.2,
      "price_open": 2385.0,
      "price_current": 2391.42,
      "sl": 2380.0,
      "tp": 2420.0,
      "profit": 128.4,
      "swap": -1.12,
      "commission": -1.4,
      "comment": "breakout",
      "magic": 0,
      "reason": "web",
      "identifier": 51830012,
      "time": 1790975498,
      "time_msc": 1790975498123,
      "time_update": 1790975498
    }
  ],
  "time_ms": 1790981179473
}

WsMessage

What the server sends on the WebSocket, one JSON object per message, told apart by type. First a status, then subscribed, then any trade events replayed for after= (or a resync), then ticks (and the trade, account, positions and orders events asked for with events=; orders right after subscribed and the replay); status again whenever connected changes.

status
  • type string required

    Connection state.

  • connected boolean required

    Whether the account is connected to the broker.

  • ping_ms number or null required

    Last heartbeat round trip in milliseconds.

  • id string

    Only on the first status, when the socket follows trades or orders: where it starts in the account's trade event numbering (as on SSE).

  • reason string

    Only on the last status before the socket closes: account changed (deleted, or logs in with new details), server stopping, or (0.6.0) key revoked, key changed, signed out.

    account changedserver stoppingkey revokedkey changedsigned out
subscribed
  • type string required

    The symbols now streaming, after the open or a subscribe/unsubscribe.

  • symbols array of string required

    Every symbol on this socket.

tick
  • type string required

    A price change.

  • symbol string required

    Symbol name.

  • bid number required

    Bid price.

  • ask number required

    Ask price.

  • last number required

    Last deal price. 0 for most forex and CFD symbols.

  • time_msc integer required

    Unix milliseconds, trade server clock.

gap A Gap with type: "gap" (0.7.0).
  • type string required

    Ticks this socket missed.

  • reason string required

    behind: this stream fell behind and kept only the newest tick per symbol; reconnect: the broker link was down; fanout: the account's fan-out fell behind the session.

    behindreconnectfanout
  • symbols array of string required

    behind: the symbols that lost ticks; otherwise every symbol of the stream.

  • dropped integer or null required

    behind: how many ticks this stream lost; null when nobody can count them.

  • from_msc integer required

    behind: the first dropped tick's time; otherwise the last tick this stream got before. Ticks' own clock.

  • to_msc integer required

    behind: the last dropped tick's time; otherwise the first tick after, which follows this event.

  • from_utc_msc integer

    from_msc in UTC; only with the account's clock rule (0.7.1).

  • to_utc_msc integer

    to_msc in UTC; only with the account's clock rule (0.7.1).

  • from_utc_ambiguous boolean

    true when from_msc falls in New York's repeated autumn hour (0.7.1).

  • to_utc_ambiguous boolean

    true when to_msc falls in New York's repeated autumn hour (0.7.1).

bar A Bar with type: "bar" (0.7.0).
  • type string required

    A bar of a series (with events=bars).

  • symbol string required

    Symbol name.

  • timeframe string required

    Timeframe.

    M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1
  • time integer required

    Bar open time, unix seconds, trade server clock.

  • open number required

    Open.

  • high number required

    High.

  • low number required

    Low.

  • close number required

    Close.

  • tick_volume integer required

    Tick count in the bar.

  • real_volume integer required

    Exchange volume.

  • state string required

    forming: built from the bids, at most four a second per series; closed: the broker's bar once its period ended (plus 2 s), sent once per period, or later for a period whose tick came late (0.7.1: bars can arrive out of time order, place each by time); corrected: the broker's bar differs from the one sent (read again a minute later, or after the server clock went back).

    formingclosedcorrected
bars_gap A BarsGap with type: "bars_gap" (0.7.0).
  • type string required

    Bars a series cannot send.

  • symbol string required

    Symbol name.

  • timeframe string required

    Timeframe.

    M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1
  • from integer required

    The first missed bar's open time.

  • to integer required

    The last missed bar's open time.

  • from_utc integer

    from in UTC; only with the account's clock rule (0.7.1).

  • to_utc integer

    to in UTC; only with the account's clock rule (0.7.1).

  • from_utc_ambiguous boolean

    true when from falls in New York's repeated autumn hour (0.7.1).

  • to_utc_ambiguous boolean

    true when to falls in New York's repeated autumn hour (0.7.1).

bars
  • type string required

    The bar series now on the socket, after a bars or unbars message (0.7.0).

  • series array of string required

    Every series, SYMBOL:TF.

trade A TradeEvent with type: "trade".
  • type string required

    A broker trade push (with events=trades).

  • seq integer required

    1, 2, 3, ... per account. The newest 1,024 events are kept in the database, so the numbering carries on across a restart or an upgrade; it starts again only when the account is added again or logs in to another broker account (login or server).

  • id string required

    <epoch>:<seq>, epoch being the unix ms when this numbering began. On SSE also the event's id: line, which EventSource sends back as Last-Event-ID; any client can resume with after=<id>, from before a restart too.

  • what string required

    What happened. For a pending order (kind order): placed, modified or removed while it is live; filled, cancelled, expired, rejected (or done) when it moves to history. For a deal (kind deal): opened, partial, closed, reversed, or balance for a balance, credit or commission deal. For kind position: updated.

    placedmodifiedremovedfilledcancelledexpiredrejecteddoneopenedpartialclosedreversedbalancedealupdated
  • kind string required

    order for an order push, deal for a deal push, position for a position the broker changed without a deal (its SL or TP moved, or the step just before a close; the broker sends it as a deal record with ticket 0 and balance 0, which before 0.2.2 came out as a phantom deal opened).

    orderdealposition
  • pending boolean

    With kind order: true for a limit, stop or stop-limit order, false for a market buy or sell (or a close-by). A market order is placed, taken off the book and filed as filled (or cancelled) in the same moment, each step an order event with pending false and, once done, volume 0 (volume_initial is what was asked); a UI shows the deal event for it and skips these.

  • order object

    Order fields
    • ticket integer required

      Order ticket.

    • symbol string required

      Symbol name.

    • type string required

      Order type. GET /orders and orders events list pending orders only (limit, stop, stop limit); in a trade event a market order is buy or sell (with pending: false).

      buy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitbuysellclose_by
    • side string required

      Direction.

      buysell
    • volume number required

      Lots still to fill.

    • volume_initial number required

      Lots when placed.

    • price number required

      Trigger price.

    • stop_limit number required

      Limit price for stop limit orders, 0 otherwise.

    • sl number required

      Stop loss price, 0 when none.

    • tp number required

      Take profit price, 0 when none.

    • expiration integer required

      Expiry, unix seconds, trade server clock. 0 = good till cancelled.

    • comment string required

      Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

    • magic integer required

      Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). An order that closed a tagged position (its stop, its target) gets the magic but keeps its own comment.

    • reason string required

      Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

      clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
    • time_setup integer required

      When the order was placed, unix seconds, trade server clock.

    • time_setup_msc integer required

      When the order was placed, unix milliseconds, trade server clock.

  • state string

    With kind order: the order's MetaTrader state.

    startedplacedcancelledpartialfilledrejectedexpiredrequestunknown
  • deal object

    Deal fields
    • ticket integer required

      Deal ticket.

    • order integer required

      Order that made the deal.

    • position_id integer required

      Position the deal belongs to (its identifier).

    • symbol string required

      Symbol name. Empty for balance operations.

    • type string required

      The MetaTrader deal type, lowercase. unknown only for a value MetaTrader does not define.

      buysellbalancecreditchargecorrectionbonuscommissioncommission_dailycommission_monthlycommission_agent_dailycommission_agent_monthlyinterestbuy_canceledsell_canceleddividenddividend_frankedtaxunknown
    • entry string required

      in opens, out closes, inout reverses, out_by closes by an opposite position. unknown only for a value MetaTrader does not define.

      inoutinoutout_byunknown
    • volume number required

      Lots.

    • price number required

      Deal price.

    • profit number required

      Realised profit in the deposit currency.

    • commission number required

      Commission.

    • swap number required

      Swap.

    • fee number required

      Fee.

    • magic integer required

      Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). A closing deal (a close at the stop loss or take profit included) gets the magic of the position it closed.

    • comment string required

      Comment. The opening deal of an order sent through Termless with a comment past 31 characters gets the full text back; a closing deal keeps its own (IC Markets and Pepperstone write [sl 4129.45] or [tp ...] there on a close by stop, but read reason).

    • reason string required

      Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

      clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
    • time integer required

      Unix seconds, trade server clock.

    • time_msc integer required

      Unix milliseconds, trade server clock.

  • position object

    With kind deal: the position the deal touched; with kind position: the position that changed. With an extra open. A closed one (open false) carries its last known values (open price, SL, TP, time, comment, magic) with volume 0, where the broker sends zeros. Absent for a balance deal.

    Fields
    • ticket integer required

      Position ticket.

    • symbol string required

      Symbol name.

    • side string required

      Direction.

      buysell
    • volume number required

      Lots.

    • price_open number required

      Open price.

    • price_current number required

      Current close price (bid for a buy, ask for a sell).

    • sl number required

      Stop loss price, 0 when none.

    • tp number required

      Take profit price, 0 when none.

    • profit number required

      Floating profit in the deposit currency, live.

    • swap number required

      Swap so far.

    • commission number required

      Commission so far.

    • comment string required

      Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

    • magic integer required

      Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).

    • reason string required

      Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

      clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
    • identifier integer required

      Position id; the deals of this position carry it as position_id.

    • time integer required

      Open time, unix seconds, trade server clock.

    • time_msc integer required

      Open time, unix milliseconds, trade server clock.

    • time_update integer required

      Last change, unix seconds, trade server clock.

    • open boolean required

      False once the position is closed.

  • positions array of Position

    Other positions the same push updated (a netting account).

    Position fields
    • ticket integer required

      Position ticket.

    • symbol string required

      Symbol name.

    • side string required

      Direction.

      buysell
    • volume number required

      Lots.

    • price_open number required

      Open price.

    • price_current number required

      Current close price (bid for a buy, ask for a sell).

    • sl number required

      Stop loss price, 0 when none.

    • tp number required

      Take profit price, 0 when none.

    • profit number required

      Floating profit in the deposit currency, live.

    • swap number required

      Swap so far.

    • commission number required

      Commission so far.

    • comment string required

      Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

    • magic integer required

      Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).

    • reason string required

      Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

      clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
    • identifier integer required

      Position id; the deals of this position carry it as position_id.

    • time integer required

      Open time, unix seconds, trade server clock.

    • time_msc integer required

      Open time, unix milliseconds, trade server clock.

    • time_update integer required

      Last change, unix seconds, trade server clock.

  • balance number

    With kind deal: the account's balance after the deal. Never on kind position, nor on a caught_up deal.

  • credit number

    With kind deal: the account's credit after the deal. Never on kind position, nor on a caught_up deal.

  • caught_up boolean

    Present and true on a deal the broker made during a gap (the broker link was down, the server was stopped, or the account's session started again) and that was read back from the account's history after it: kind deal with what and deal only (a close is partial while its position is still open), oldest first, before the gap's resync. A deal already sent is never sent again, and nothing older than the oldest event the server keeps for the account (or the start of its numbering) is sent. Up to 7 days back and 500 deals; more than that sends only the resync.

resync A Resync with type: "resync": read positions, orders and deals again.
  • type string required

    Missed trade events cannot be replayed (with events=trades).

  • seq integer required

    Its place in the account's numbering: its own seq for a resync the server recorded (after a gap: the broker link came back, the server restarted, the account's session started again; or when the server fell behind the broker), else the newest seq when it was sent.

  • id string required

    <epoch>:<seq>. Carry on from this id.

  • reason string required

    Why. Recorded in the numbering (and replayed like trade events): "the broker link came back; ...", "the server restarted; ...", "the account's session started again; ..." (each after the deals made during the gap, sent first as trade events marked caught_up), "the server fell behind the broker's trade pushes". Sent to one client only: "that id is from another numbering (the account now logs in to another broker account, or its kept events were lost)" (an id from another epoch: the account was added again, or logs in to another broker account), "that id is newer than anything this account has sent", "more happened since that id than the server keeps", "this stream fell behind; read the account again".

account An AccountSnapshot with type: "account".
  • type string required

    The account summary, live (with events=account).

  • login integer required

    MT5 login number.

  • name string required

    Account holder name at the broker.

  • server string required

    Trade server name.

  • company string required

    Broker company name.

  • currency string required

    Deposit currency.

  • leverage integer required

    Leverage, for example 200 for 1:200.

  • balance number required

    Balance without open positions.

  • credit number required

    Credit from the broker.

  • profit number required

    Floating profit of open positions, live.

  • equity number required

    balance + credit + profit, live.

  • margin number required

    Margin in use, live.

  • margin_free number required

    equity - margin.

  • margin_level number required

    equity / margin x 100, in percent. 0 with no margin in use.

  • margin_so_call number required

    Margin call level.

  • margin_so_so number required

    Stop out level.

  • trade_allowed boolean required

    Whether the broker allows trading on this account.

  • demo boolean required

    True for a demo account.

  • hedging boolean required

    True for a hedging account, false for netting.

  • server_offset integer required

    Trade server clock, in seconds east of UTC. Subtract it from any market or trade time to get UTC. From the account record, read again at least hourly, and checked against live ticks (a tick's server time minus its arrival, to the quarter hour): when they disagree the ticks win while a tick agreed in the last 10 minutes, then the record. It is the offset now; times from before the broker's last summer-time switch were stamped with the old one.

  • positions integer required

    Open positions.

  • orders integer required

    Pending orders.

  • time_ms integer required

    When it was computed, unix milliseconds (UTC).

positions A PositionsSnapshot with type: "positions".
  • type string required

    Every open position, live (with events=positions).

  • positions array of Position required

    Every open position with live profit and price_current.

    Position fields
    • ticket integer required

      Position ticket.

    • symbol string required

      Symbol name.

    • side string required

      Direction.

      buysell
    • volume number required

      Lots.

    • price_open number required

      Open price.

    • price_current number required

      Current close price (bid for a buy, ask for a sell).

    • sl number required

      Stop loss price, 0 when none.

    • tp number required

      Take profit price, 0 when none.

    • profit number required

      Floating profit in the deposit currency, live.

    • swap number required

      Swap so far.

    • commission number required

      Commission so far.

    • comment string required

      Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

    • magic integer required

      Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).

    • reason string required

      Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

      clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
    • identifier integer required

      Position id; the deals of this position carry it as position_id.

    • time integer required

      Open time, unix seconds, trade server clock.

    • time_msc integer required

      Open time, unix milliseconds, trade server clock.

    • time_update integer required

      Last change, unix seconds, trade server clock.

  • time_ms integer required

    When it was computed, unix milliseconds (UTC).

orders An OrdersSnapshot with type: "orders".
  • type string required

    Every pending order (with events=orders).

  • orders array of Order required

    Every pending order (limit, stop, stop limit), as GET /orders lists them.

    Order fields
    • ticket integer required

      Order ticket.

    • symbol string required

      Symbol name.

    • type string required

      Order type. GET /orders and orders events list pending orders only (limit, stop, stop limit); in a trade event a market order is buy or sell (with pending: false).

      buy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitbuysellclose_by
    • side string required

      Direction.

      buysell
    • volume number required

      Lots still to fill.

    • volume_initial number required

      Lots when placed.

    • price number required

      Trigger price.

    • stop_limit number required

      Limit price for stop limit orders, 0 otherwise.

    • sl number required

      Stop loss price, 0 when none.

    • tp number required

      Take profit price, 0 when none.

    • expiration integer required

      Expiry, unix seconds, trade server clock. 0 = good till cancelled.

    • comment string required

      Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

    • magic integer required

      Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). An order that closed a tagged position (its stop, its target) gets the magic but keeps its own comment.

    • reason string required

      Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

      clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
    • time_setup integer required

      When the order was placed, unix seconds, trade server clock.

    • time_setup_msc integer required

      When the order was placed, unix milliseconds, trade server clock.

  • time_ms integer required

    When it was read, unix milliseconds (UTC).

error
  • type string required

    A message the server could not act on.

  • message string required

    What went wrong.

Example
{
  "type": "status",
  "connected": true,
  "ping_ms": 14.2,
  "id": "1790968290117:40"
}
Another example
{
  "type": "subscribed",
  "symbols": [
    "EURUSD",
    "XAUUSD"
  ]
}

WsCommand

What a client may send on the WebSocket. The answer is subscribed with the whole list, or an error.

  • subscribe array of string

    Symbols to add (at most 200 on one socket).

  • unsubscribe array of string

    Symbols to drop. Applied before subscribe when both are sent.

  • bars array of string

    Bar series to add, SYMBOL:TF (0.7.0; the socket must be opened with events=bars). At most 100 a socket.

  • unbars array of string

    Bar series to drop (0.7.0).

Example
{
  "subscribe": [
    "GBPUSD"
  ]
}
Another example
{
  "unsubscribe": [
    "EURUSD"
  ]
}

Position

  • ticket integer required

    Position ticket.

  • symbol string required

    Symbol name.

  • side string required

    Direction.

    buysell
  • volume number required

    Lots.

  • price_open number required

    Open price.

  • price_current number required

    Current close price (bid for a buy, ask for a sell).

  • sl number required

    Stop loss price, 0 when none.

  • tp number required

    Take profit price, 0 when none.

  • profit number required

    Floating profit in the deposit currency, live.

  • swap number required

    Swap so far.

  • commission number required

    Commission so far.

  • comment string required

    Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

  • magic integer required

    Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0).

  • reason string required

    Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

    clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
  • identifier integer required

    Position id; the deals of this position carry it as position_id.

  • time integer required

    Open time, unix seconds, trade server clock.

  • time_msc integer required

    Open time, unix milliseconds, trade server clock.

  • time_update integer required

    Last change, unix seconds, trade server clock.

Example
{
  "ticket": 51830012,
  "symbol": "XAUUSD",
  "side": "buy",
  "volume": 0.2,
  "price_open": 2385.0,
  "price_current": 2391.42,
  "sl": 2380.0,
  "tp": 2420.0,
  "profit": 128.4,
  "swap": -1.12,
  "commission": -1.4,
  "comment": "breakout",
  "magic": 0,
  "reason": "web",
  "identifier": 51830012,
  "time": 1790975498,
  "time_msc": 1790975498123,
  "time_update": 1790975498
}

Order

  • ticket integer required

    Order ticket.

  • symbol string required

    Symbol name.

  • type string required

    Order type. GET /orders and orders events list pending orders only (limit, stop, stop limit); in a trade event a market order is buy or sell (with pending: false).

    buy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitbuysellclose_by
  • side string required

    Direction.

    buysell
  • volume number required

    Lots still to fill.

  • volume_initial number required

    Lots when placed.

  • price number required

    Trigger price.

  • stop_limit number required

    Limit price for stop limit orders, 0 otherwise.

  • sl number required

    Stop loss price, 0 when none.

  • tp number required

    Take profit price, 0 when none.

  • expiration integer required

    Expiry, unix seconds, trade server clock. 0 = good till cancelled.

  • comment string required

    Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

  • magic integer required

    Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). An order that closed a tagged position (its stop, its target) gets the magic but keeps its own comment.

  • reason string required

    Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

    clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
  • time_setup integer required

    When the order was placed, unix seconds, trade server clock.

  • time_setup_msc integer required

    When the order was placed, unix milliseconds, trade server clock.

Example
{
  "ticket": 51830020,
  "symbol": "XAUUSD",
  "type": "buy_limit",
  "side": "buy",
  "volume": 0.1,
  "volume_initial": 0.1,
  "price": 2365.0,
  "stop_limit": 0,
  "sl": 2350.0,
  "tp": 2410.0,
  "expiration": 0,
  "comment": "dip buy",
  "magic": 0,
  "reason": "web",
  "time_setup": 1790977698,
  "time_setup_msc": 1790977698412
}

HistoryOrder

An order that left the book (GET /orders/history): the order shape plus how and when it ended and its position.

  • ticket integer required

    Order ticket.

  • symbol string required

    Symbol name.

  • type string required

    Order type. Market orders are filed here too: buy, sell or close_by.

    buy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitbuysellclose_by
  • side string required

    Direction.

    buysell
  • volume number required

    Lots left unfilled when it left the book (0 for a filled order).

  • volume_initial number required

    Lots when placed.

  • price number required

    Trigger price.

  • stop_limit number required

    Limit price for stop limit orders, 0 otherwise.

  • sl number required

    Stop loss price, 0 when none.

  • tp number required

    Take profit price, 0 when none.

  • expiration integer required

    Expiry, unix seconds, trade server clock. 0 = good till cancelled.

  • comment string required

    Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

  • magic integer required

    Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). An order that closed a tagged position (its stop, its target) gets the magic but keeps its own comment.

  • reason string required

    Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

    clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
  • time_setup integer required

    When the order was placed, unix seconds, trade server clock.

  • time_setup_msc integer required

    When the order was placed, unix milliseconds, trade server clock.

  • state string required

    The order's MetaTrader state when it left the book: filled, cancelled, expired, rejected or partial (partly filled); started, placed and request are states an order passes through on its way; unknown only for a value MetaTrader does not define.

    startedplacedcancelledpartialfilledrejectedexpiredrequestunknown
  • time_done integer required

    When it left the book, unix seconds, trade server clock.

  • time_done_msc integer required

    When it left the book, unix milliseconds, trade server clock.

  • position_id integer required

    The position it opened or closed; 0 for an order that never filled.

Example
{
  "ticket": 51830012,
  "symbol": "XAUUSD",
  "type": "buy",
  "side": "buy",
  "volume": 0.0,
  "volume_initial": 0.2,
  "price": 2385.0,
  "stop_limit": 0,
  "sl": 2380.0,
  "tp": 2420.0,
  "expiration": 0,
  "comment": "breakout",
  "magic": 0,
  "reason": "web",
  "time_setup": 1790975498,
  "time_setup_msc": 1790975497981,
  "state": "filled",
  "time_done": 1790975498,
  "time_done_msc": 1790975498123,
  "position_id": 51830012
}
Another example
{
  "ticket": 51830007,
  "symbol": "XAUUSD",
  "type": "sell_stop",
  "side": "sell",
  "volume": 0.1,
  "volume_initial": 0.1,
  "price": 2371.5,
  "stop_limit": 0,
  "sl": 2380.0,
  "tp": 2350.0,
  "expiration": 0,
  "comment": "breakdown",
  "magic": 0,
  "reason": "web",
  "time_setup": 1790962100,
  "time_setup_msc": 1790962100544,
  "state": "cancelled",
  "time_done": 1790970120,
  "time_done_msc": 1790970120310,
  "position_id": 0
}

Deal

  • ticket integer required

    Deal ticket.

  • order integer required

    Order that made the deal.

  • position_id integer required

    Position the deal belongs to (its identifier).

  • symbol string required

    Symbol name. Empty for balance operations.

  • type string required

    The MetaTrader deal type, lowercase. unknown only for a value MetaTrader does not define.

    buysellbalancecreditchargecorrectionbonuscommissioncommission_dailycommission_monthlycommission_agent_dailycommission_agent_monthlyinterestbuy_canceledsell_canceleddividenddividend_frankedtaxunknown
  • entry string required

    in opens, out closes, inout reverses, out_by closes by an opposite position. unknown only for a value MetaTrader does not define.

    inoutinoutout_byunknown
  • volume number required

    Lots.

  • price number required

    Deal price.

  • profit number required

    Realised profit in the deposit currency.

  • commission number required

    Commission.

  • swap number required

    Swap.

  • fee number required

    Fee.

  • magic integer required

    Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). A closing deal (a close at the stop loss or take profit included) gets the magic of the position it closed.

  • comment string required

    Comment. The opening deal of an order sent through Termless with a comment past 31 characters gets the full text back; a closing deal keeps its own (IC Markets and Pepperstone write [sl 4129.45] or [tp ...] there on a close by stop, but read reason).

  • reason string required

    Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

    clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
  • time integer required

    Unix seconds, trade server clock.

  • time_msc integer required

    Unix milliseconds, trade server clock.

Example
{
  "ticket": 81200118,
  "order": 51830012,
  "position_id": 51830012,
  "symbol": "XAUUSD",
  "type": "buy",
  "entry": "in",
  "volume": 0.2,
  "price": 2385.0,
  "profit": 0.0,
  "commission": -0.7,
  "swap": 0.0,
  "fee": 0.0,
  "magic": 0,
  "comment": "breakout",
  "reason": "web",
  "time": 1790975498,
  "time_msc": 1790975498123
}
Another example
{
  "ticket": 81200152,
  "order": 51830050,
  "position_id": 51830012,
  "symbol": "XAUUSD",
  "type": "sell",
  "entry": "out",
  "volume": 0.2,
  "price": 2380.0,
  "profit": -100.0,
  "commission": -0.7,
  "swap": -1.12,
  "fee": 0.0,
  "magic": 0,
  "comment": "[sl 2380.00]",
  "reason": "sl",
  "time": 1790990841,
  "time_msc": 1790990841207
}

TradeResult

  • ok boolean required

    True when the broker placed (10008), did (10009) or partly did (10010) the request. Test this, not one code: brokers answer a placed pending order with 10008 or 10009.

  • retcode integer required

    MetaTrader return code. 10009 = done, 10008 = placed. See x-retcodes for the rest.

  • retcode_text string required

    The return code in words.

  • deal integer required

    Deal ticket, 0 when no deal was made.

  • order integer required

    Order ticket.

  • volume number required

    Lots done.

  • price number required

    Price done.

  • bid number required

    Bid when the broker handled the request.

  • ask number required

    Ask when the broker handled the request.

  • comment string required

    Broker's comment.

  • request_id integer required

    The broker's id for the request.

  • warnings array of string

    Present only when something in the request was changed or cannot be kept, on a 200 and a 422 alike: a comment over 31 characters ("comment is N characters; the broker keeps the first 31, termlessd keeps the full text for this order", without the second half for an order that neither opens nor closes anything); a magic number on a market or pending order ("magic is not sent to the broker (MetaTrader's web protocol has no field for it); termlessd keeps it for this order"); a type_filling the symbol does not allow, when order_send named one ("ORDER_FILLING_FOK is not allowed for EURUSD; sent ORDER_FILLING_IOC"); an expiry with seconds ("the broker keeps expiry times to the whole minute: <unix s>").

Example
{
  "ok": true,
  "retcode": 10009,
  "retcode_text": "Request completed",
  "deal": 81200131,
  "order": 51830031,
  "volume": 0.1,
  "price": 2391.6,
  "bid": 2391.42,
  "ask": 2391.6,
  "comment": "Request completed",
  "request_id": 31
}
Another example
{
  "ok": true,
  "retcode": 10009,
  "retcode_text": "Request completed",
  "deal": 81200131,
  "order": 51830031,
  "volume": 0.1,
  "price": 2391.6,
  "bid": 2391.42,
  "ask": 2391.6,
  "comment": "Request completed",
  "request_id": 31,
  "warnings": [
    "comment is 40 characters; the broker keeps the first 31, termlessd keeps the full text for this order",
    "magic is not sent to the broker (MetaTrader's web protocol has no field for it); termlessd keeps it for this order"
  ]
}

TradeRejected

The answer to a trade the broker refused (422): the trade result, with ok false, plus an error whose code is rejected.

  • ok boolean required

    True when the broker placed (10008), did (10009) or partly did (10010) the request. Test this, not one code: brokers answer a placed pending order with 10008 or 10009.

  • retcode integer required

    MetaTrader return code. 10009 = done, 10008 = placed. See x-retcodes for the rest.

  • retcode_text string required

    The return code in words.

  • deal integer required

    Deal ticket, 0 when no deal was made.

  • order integer required

    Order ticket.

  • volume number required

    Lots done.

  • price number required

    Price done.

  • bid number required

    Bid when the broker handled the request.

  • ask number required

    Ask when the broker handled the request.

  • comment string required

    Broker's comment.

  • request_id integer required

    The broker's id for the request.

  • warnings array of string

    Present only when something in the request was changed or cannot be kept, on a 200 and a 422 alike: a comment over 31 characters ("comment is N characters; the broker keeps the first 31, termlessd keeps the full text for this order", without the second half for an order that neither opens nor closes anything); a magic number on a market or pending order ("magic is not sent to the broker (MetaTrader's web protocol has no field for it); termlessd keeps it for this order"); a type_filling the symbol does not allow, when order_send named one ("ORDER_FILLING_FOK is not allowed for EURUSD; sent ORDER_FILLING_IOC"); an expiry with seconds ("the broker keeps expiry times to the whole minute: <unix s>").

  • error object required

    Fields
    • code string required

      Machine-readable error code. Matches the HTTP status.

      bad_requestunauthorizedforbiddenreal_accountnot_foundmethod_not_allowedconflictrejectedtoo_many_requestsinternalbroker_errordisconnectedbusystoppingtimeoutunconfirmedtrading_pausedkey_limituntrusted_certificatecertificate_changedbrowser_only
    • message string required

      What went wrong, in a sentence a person can read.

Example
{
  "ok": false,
  "retcode": 10014,
  "retcode_text": "Invalid volume",
  "deal": 0,
  "order": 0,
  "volume": 0,
  "price": 0,
  "bid": 2391.42,
  "ask": 2391.6,
  "comment": "Invalid volume",
  "request_id": 32,
  "error": {
    "code": "rejected",
    "message": "the broker refused the request: Invalid volume (10014)"
  }
}

MarketOrder

Opens a position at market.

  • symbol string required

    Symbol name.

  • side string required

    Direction.

    buysell
  • volume number required

    Lots, for example 0.10.

  • price number

    Price sent with the request. Leave it out to fill at market.

  • sl number

    Stop loss price.

  • tp number

    Take profit price.

  • deviation integer default 20

    Largest slippage you accept, in points.

  • comment string

    Comment, up to 255 characters (more is 400). The broker keeps the first 31; for a market or pending order Termless keeps the full text and puts it back on the order, its position, its opening deal and the stream events. Longer than 31 adds a warning to the answer.

  • magic integer

    Magic number. The web protocol's trade request has no field for it, so the broker stores 0; for a market or pending order Termless keeps it and puts it back on the order, its position, its deals and the stream events (MetaTrader's own apps still show 0). Sending one adds a warning to the answer.

Example
{
  "symbol": "XAUUSD",
  "side": "buy",
  "volume": 0.1,
  "sl": 2380.0,
  "tp": 2420.0,
  "comment": "breakout"
}

PendingOrder

Places a pending order.

  • symbol string required

    Symbol name.

  • side string required

    Direction.

    buysell
  • volume number required

    Lots.

  • type string required

    limit, stop or stop_limit. Its presence makes the order pending.

    limitstopstop_limit
  • price number required

    Trigger price.

  • stop_limit number

    Limit price, required for stop_limit only.

  • sl number

    Stop loss price.

  • tp number

    Take profit price.

  • expiration integer

    Expiry, unix seconds, trade server clock. Omit (or 0) for good till cancelled. The broker keeps whole minutes; one with seconds gets a warning naming the minute.

  • comment string

    Comment, up to 255 characters (more is 400). The broker keeps the first 31; for a market or pending order Termless keeps the full text and puts it back on the order, its position, its opening deal and the stream events. Longer than 31 adds a warning to the answer.

  • magic integer

    Magic number. The web protocol's trade request has no field for it, so the broker stores 0; for a market or pending order Termless keeps it and puts it back on the order, its position, its deals and the stream events (MetaTrader's own apps still show 0). Sending one adds a warning to the answer.

Example
{
  "symbol": "XAUUSD",
  "side": "buy",
  "volume": 0.1,
  "type": "limit",
  "price": 2365.0,
  "sl": 2350.0,
  "tp": 2410.0
}

OrderModify

Send only what changes; omitted fields keep their value.

  • price number

    New trigger price.

  • stop_limit number

    New limit price (stop limit orders).

  • sl number

    New stop loss, 0 removes it.

  • tp number

    New take profit, 0 removes it.

  • expiration integer

    New expiry, unix seconds, trade server clock. 0 = good till cancelled.

Example
{
  "price": 2360.0,
  "sl": 2345.0
}

PositionModify

Send sl, tp or both; an omitted one keeps its value, 0 removes it.

  • sl number

    New stop loss, 0 removes it.

  • tp number

    New take profit, 0 removes it.

Example
{
  "sl": 2386.0,
  "tp": 2425.0
}

OrderSendRequest

The request dict of the official MetaTrader5 Python package's order_send(), with the same field names. Enum fields take the integer constants or their names; numbers may also be sent as strings.

  • action integer or string required

    TRADE_ACTION_*: 1 deal (market), 5 pending, 6 sltp, 7 modify, 8 remove, 10 close_by. A number or the official name, for example TRADE_ACTION_DEAL.

  • symbol string

    Symbol name.

  • volume number

    Lots.

  • type integer or string

    ORDER_TYPE_*: 0 buy, 1 sell, 2 buy_limit, 3 sell_limit, 4 buy_stop, 5 sell_stop, 6 buy_stop_limit, 7 sell_stop_limit, 8 close_by. A number or the official name, for example ORDER_TYPE_SELL.

  • price number

    Price.

  • stoplimit number

    Limit price of a stop limit order. stop_limit also works.

  • sl number

    Stop loss.

  • tp number

    Take profit.

  • deviation integer

    Largest slippage, in points.

  • type_filling integer or string

    ORDER_FILLING_*: 0 FOK, 1 IOC, 2 return, 3 BOC. A number or the official name, for example ORDER_FILLING_IOC. A mode the symbol does not allow is replaced by one it does (IOC, then FOK, then return), as the web terminal does, and the answer's warnings name the mode sent. A pending order goes out as return unless the symbol is exchange-executed.

  • type_time integer or string

    ORDER_TIME_*: 0 GTC, 1 day, 2 specified, 3 specified day. A number or the official name, for example ORDER_TIME_GTC.

  • expiration integer

    Expiry, unix seconds, trade server clock. The broker keeps whole minutes; one with seconds gets a warning.

  • comment string

    Comment, up to 255 characters (more is 400). The broker keeps the first 31; for a market or pending order Termless keeps the full text and puts it back on the order, its position, its opening deal and the stream events. Longer than 31 adds a warning to the answer.

  • magic integer

    Magic number. The web protocol's trade request has no field for it, so the broker stores 0; for a market or pending order Termless keeps it and puts it back on the order, its position, its deals and the stream events (MetaTrader's own apps still show 0). Sending one adds a warning to the answer.

  • position integer

    Position ticket, to close or modify a position.

  • position_by integer

    Opposite position ticket, for close_by.

  • order integer

    Order ticket, to modify or remove a pending order.

Example
{
  "action": "TRADE_ACTION_DEAL",
  "symbol": "XAUUSD",
  "volume": 0.1,
  "type": "ORDER_TYPE_BUY",
  "price": 2391.6,
  "sl": 2380.0,
  "tp": 2420.0,
  "deviation": 20,
  "type_filling": "ORDER_FILLING_IOC",
  "type_time": 0,
  "comment": "from mt5 script",
  "magic": 7
}

AuditRow

One row of the audit trail: every write and every security event, with the request id that caused it. Trades get one row per broker call and none for an idempotent replay.

  • id integer required

    Row id, increasing. Page with before.

  • at integer required

    When it happened, unix milliseconds (UTC).

  • kind string required

    What kind of thing happened.

    tradeaccountkeysigninauth_failedlockoutpasswordsetupserver_checkserver_truststart
  • actor string required

    Who did it: the key id for a key, admin for the dashboard, the client IP before sign-in, termlessd for the server itself.

  • actor_kind string required

    admin for the dashboard session, key for an API key, anonymous before sign-in, system for the server.

    adminkeyanonymoussystem
  • account string or null required

    The account it concerned, when one did.

  • route string required

    What was done. For a trade: market order, pending order, order change, order cancel, SL/TP change, close, partial close or order_send. For an account: add, update or delete. For a key: create or delete.

  • summary string required

    One line a person can read.

  • request string or null required

    For a trade: the request sent to the broker, in short JSON (cut to 400 characters).

  • status integer or null required

    The HTTP status the caller got.

  • retcode integer or null required

    For a trade the broker answered: its return code.

  • result string or null required

    For a trade: the broker's answer in words with the order and deal tickets, or the error when it did not answer.

  • latency_ms integer or null required

    For a trade: the broker round trip in milliseconds.

  • request_id string or null required

    The X-Request-Id of the request that caused the row; the same id is on its log lines.

  • ip string or null required

    The client IP, recorded for sign-ins, wrong passwords and lockouts.

Example
{
  "id": 4821,
  "at": 1790981179473,
  "kind": "trade",
  "actor": "key_3f9a1c07",
  "actor_kind": "key",
  "account": "pepperstone-12345678",
  "route": "market order",
  "summary": "market buy 0.10 XAUUSD",
  "request": "{\"symbol\":\"XAUUSD\",\"volume\":0.1,\"type\":0,\"price\":0.0,\"sl\":2380.0,\"tp\":2420.0,\"order\":0,\"position\":0,\"comment\":\"breakout\"}",
  "status": 200,
  "retcode": 10009,
  "result": "Request completed order 51830031 deal 81200131",
  "latency_ms": 212,
  "request_id": "bot-20261003-0042",
  "ip": null
}
Another example
{
  "id": 4790,
  "at": 1790968301004,
  "kind": "signin",
  "actor": "203.0.113.7",
  "actor_kind": "anonymous",
  "account": null,
  "route": "signin",
  "summary": "dashboard sign-in from 203.0.113.7 (Mozilla/5.0 ...)",
  "request": null,
  "status": 200,
  "retcode": null,
  "result": null,
  "latency_ms": null,
  "request_id": "7c1e2a9f4b3d8e60",
  "ip": "203.0.113.7"
}

ConnectionEvent

One entry of an account's connection history.

  • id integer required

    Row id, increasing. Page with before.

  • at integer required

    When it happened, unix milliseconds (UTC).

  • account string required

    Account id.

  • kind string required

    started when the session began; connected (reason: the broker's build) the first time it logged in and reconnected after that; lost (reason: the session's last error) when the link dropped; connect_failed or login_rejected when an attempt failed; stopped when the account was turned off or removed.

    startedconnectedreconnectedlostconnect_failedlogin_rejectedstopped
  • reason string or null required

    The build for connected and reconnected, the error for lost, connect_failed and login_rejected.

  • duration_ms integer or null required

    For connected and reconnected: how long the account had been disconnected. For lost and stopped: how long it had been connected.

  • quiet_since integer or null required

    On a lost event cut for missed pings (0.6.0): when the first unanswered ping was sent, unix milliseconds (UTC), so when the broker went quiet; null otherwise.

Example
{
  "id": 310,
  "at": 1790968298412,
  "account": "pepperstone-12345678",
  "kind": "connected",
  "reason": "build 6090",
  "duration_ms": 1840,
  "quiet_since": null
}
Another example
{
  "id": 309,
  "at": 1790968296572,
  "account": "pepperstone-12345678",
  "kind": "lost",
  "reason": "connection lost",
  "duration_ms": 73284110,
  "quiet_since": null
}

EquityCurve

Balance, equity, margin and profit sampled about once a minute, kept 7 days, and the gaps when the account was not connected. Served from the database, so it works while the account is disconnected or turned off.

  • account string required

    Account id.

  • hours integer required

    The window asked for, ending now.

  • every_s integer required

    Seconds between samples while connected (60).

  • samples array of EquitySample required

    Oldest first. About one a minute while the account is connected, the first right after it connects; none while it is not (see gaps).

    EquitySample fields
    • at integer required

      Unix milliseconds (UTC).

    • balance number required

      Balance.

    • equity number required

      Equity, with live profit.

    • margin number required

      Margin in use.

    • profit number required

      Floating profit of open positions.

  • gaps array of EquityGap required

    Oldest first: the periods inside the window when the account was not connected, read from its connection events. Draw a break there instead of a line across the outage.

    EquityGap fields
    • from integer required

      When the account stopped being connected (a lost or stopped event, the window's start if it was already down, or for a run that ended without a stop the last sample before the restart), unix milliseconds (UTC).

    • to integer or null required

      When it connected again, unix milliseconds (UTC). null while it still is not.

Example
{
  "account": "pepperstone-12345678",
  "hours": 24,
  "every_s": 60,
  "samples": [
    {
      "at": 1790977560000,
      "balance": 10412.58,
      "equity": 10641.2,
      "margin": 878.93,
      "profit": 228.62
    },
    {
      "at": 1790977620000,
      "balance": 10412.58,
      "equity": 10650.69,
      "margin": 878.93,
      "profit": 238.11
    }
  ],
  "gaps": [
    {
      "from": 1790968296572,
      "to": 1790968298412
    }
  ]
}

EquitySample

  • at integer required

    Unix milliseconds (UTC).

  • balance number required

    Balance.

  • equity number required

    Equity, with live profit.

  • margin number required

    Margin in use.

  • profit number required

    Floating profit of open positions.

Example
{
  "at": 1790977560000,
  "balance": 10412.58,
  "equity": 10641.2,
  "margin": 878.93,
  "profit": 228.62
}

ApiKey

  • id string required

    Key id, used to revoke it.

  • name string required

    What the key is for.

  • prefix string required

    The key's first 12 characters (tl_ and 9 more), to recognise it.

  • scopes array of string required

    One scope.

    readtradeadmin
  • accounts array or null required

    Account ids the key may use. null = every account.

  • created_at integer required

    Unix seconds (UTC).

  • last_used_at integer or null required

    Unix seconds (UTC) of the last request, null if never used.

  • max_volume number or null required

    The most lots one order that opens something may have (0.6.0); null: no limit.

  • max_open_per_min integer or null required

    The most orders that open something this key may send in 60 s (0.6.0); null: no limit.

  • max_daily_loss number or null required

    The most the account may lose in a forex day (from 17:00 New York, account currency) before this key opens nothing (0.7.0); null: no limit.

  • max_drawdown_pct number or null required

    The most percent the account's equity may fall below its high since the limit was set before this key opens nothing (0.7.0); null: no limit.

  • limits_since integer or null required

    When the drawdown limit was set, unix milliseconds; its high counts from then (0.7.0).

Example
{
  "id": "key_3f9a1c07",
  "name": "EA bridge (gold)",
  "prefix": "tl_4be1a09c7",
  "scopes": [
    "trade"
  ],
  "accounts": [
    "pepperstone-12345678"
  ],
  "created_at": 1790709498,
  "last_used_at": 1790974298,
  "max_volume": 0.5,
  "max_open_per_min": 10,
  "max_daily_loss": 500.0,
  "max_drawdown_pct": null,
  "limits_since": null
}

ApiKeyCreate

  • name string required

    What the key is for, for example "EA bridge (gold)". Up to 80 characters.

  • scopes one of

    Exactly one scope. trade includes read; admin includes everything. Defaults to ["read"].

    ["read"]["trade"]["admin"]
  • accounts array of string

    Limit the key to these account ids. Omit for every account. Not allowed with admin (400); an unknown id is 400 too.

  • max_volume number

    The most lots one order that opens something may have; above it the order answers 403 key_limit and is not sent. Closing is never limited. Omit for no limit (0.6.0).

  • max_open_per_min integer

    The most orders that open something this key may send in 60 s, 1 to 600; past it 429 key_limit with Retry-After, not sent. Omit for no limit (0.6.0).

  • max_daily_loss one of

    A positive amount in the account's currency; past it (from the forex day's start) orders that open something answer 403 key_limit, not sent (0.7.0). null or left out: no limit.

  • max_drawdown_pct one of

    More than 0, at most 100: past that many percent below the equity's high since it was set, orders that open something answer 403 key_limit, not sent (0.7.0). Setting or changing it starts its high afresh.

Example
{
  "name": "EA bridge (gold)",
  "scopes": [
    "trade"
  ],
  "accounts": [
    "pepperstone-12345678"
  ],
  "max_volume": 0.5,
  "max_open_per_min": 10
}

ApiKeyCreated

  • id string required

    Key id, used to revoke it.

  • name string required

    What the key is for.

  • prefix string required

    The key's first 12 characters (tl_ and 9 more), to recognise it.

  • scopes array of string required

    One scope.

    readtradeadmin
  • accounts array or null required

    Account ids the key may use. null = every account.

  • created_at integer required

    Unix seconds (UTC).

  • last_used_at integer or null required

    Unix seconds (UTC) of the last request, null if never used.

  • max_volume number or null required

    The most lots one order that opens something may have (0.6.0); null: no limit.

  • max_open_per_min integer or null required

    The most orders that open something this key may send in 60 s (0.6.0); null: no limit.

  • max_daily_loss number or null required

    The most the account may lose in a forex day (from 17:00 New York, account currency) before this key opens nothing (0.7.0); null: no limit.

  • max_drawdown_pct number or null required

    The most percent the account's equity may fall below its high since the limit was set before this key opens nothing (0.7.0); null: no limit.

  • limits_since integer or null required

    When the drawdown limit was set, unix milliseconds; its high counts from then (0.7.0).

  • key string required

    The full key, tl_ and 48 hex characters. It is shown only in this response, so store it now.

Example
{
  "id": "key_3f9a1c07",
  "name": "EA bridge (gold)",
  "prefix": "tl_4be1a09c7",
  "scopes": [
    "trade"
  ],
  "accounts": [
    "pepperstone-12345678"
  ],
  "created_at": 1790981179,
  "last_used_at": null,
  "max_volume": 0.5,
  "max_open_per_min": 10,
  "max_daily_loss": 500.0,
  "max_drawdown_pct": null,
  "limits_since": null,
  "key": "tl_4be1a09c7d2e5f8b1a3c6e9d0f2b4a7c8e1d3f5a7b9c0e2d"
}

Me

  • kind string required

    admin for the dashboard session, key for an API key.

    adminkey
  • name string required

    admin, or the key's name.

  • scopes array of string required

    What this caller may do.

    readtradeadmin
  • accounts array or null required

    Account ids this caller may use. null means every account.

Example
{
  "kind": "key",
  "name": "EA bridge (gold)",
  "scopes": [
    "trade"
  ],
  "accounts": [
    "pepperstone-12345678"
  ]
}

Health

  • status string required

    ok when every enabled account is connected, degraded when an enabled account is not, setup before the admin password exists.

    okdegradedsetup
  • version string or null required

    Server version, for a signed-in caller or a valid key; null for anyone else (the exact version tells an attacker which fixes are missing).

  • uptime_s integer required

    Seconds since the server started.

  • accounts array of object required

    Empty unless the caller is signed in or sends a valid key; then the accounts it may see.

    Fields
    • id string required

      Account id.

    • label string required

      Display name.

    • enabled boolean required

      False for an account that is turned off.

    • connected boolean required

      Whether the session to the broker is up.

    • ping_ms number or null required

      Last heartbeat round trip in milliseconds.

    • reconnects integer required

      Reconnects since the server started.

Example
{
  "status": "ok",
  "version": "0.6.2",
  "uptime_s": 86412,
  "accounts": [
    {
      "id": "pepperstone-12345678",
      "label": "Pepperstone demo",
      "enabled": true,
      "connected": true,
      "ping_ms": 14.2,
      "reconnects": 0
    }
  ]
}
Another example
{
  "status": "ok",
  "version": null,
  "uptime_s": 86412,
  "accounts": []
}

Error

Every error response has this shape.

  • error object required

    Fields
    • code string required

      Machine-readable error code. Matches the HTTP status.

      bad_requestunauthorizedforbiddenreal_accountnot_foundmethod_not_allowedconflictrejectedtoo_many_requestsinternalbroker_errordisconnectedbusystoppingtimeoutunconfirmedtrading_pausedkey_limituntrusted_certificatecertificate_changedbrowser_only
    • message string required

      What went wrong, in a sentence a person can read.

Example
{
  "error": {
    "code": "not_found",
    "message": "no account with id pepperstone-live"
  }
}

Ok

  • ok boolean required

    Always true.

Example
{
  "ok": true
}

SetupState

  • needs_setup boolean required

    True until the admin password has been set.

Example
{
  "needs_setup": true
}

SetupRequest

  • token string required

    The one-time setup token from the server log or <data>/setup-token.

  • password string required

    The new admin password: 15 to 200 characters with a lowercase letter, a capital, a digit and a symbol (anything but a letter or a digit counts as a symbol).

Example
{
  "token": "4f1c9e0b7a2d5e8c3b6a9d0e",
  "password": "A long passphrase, 2 commas"
}

SessionRequest

  • password string required

    The admin password.

Example
{
  "password": "a long passphrase"
}

PasswordChange

  • current string required

    The admin password in use now. A wrong one is 400, not 401, so the dashboard stays signed in.

  • new string required

    The new admin password: 15 to 200 characters with a lowercase letter, a capital, a digit and a symbol (anything but a letter or a digit counts as a symbol).

Example
{
  "current": "A long passphrase, 2 commas",
  "new": "An even longer passphrase, 3 commas"
}

Server

  • server string required

    Trade server name exactly as the broker spells it, for example Pepperstone-Demo.

  • company string required

    Broker company name.

  • host string required

    Host that serves the broker's MT5 web terminal.

  • port integer required

    Port, usually 443.

  • type string required

    Demo or real money server.

    demoreal
  • build integer or null required

    MT5 web terminal build seen on the host. null until this install has checked it.

  • verified_at integer or null required

    Unix seconds (UTC) when this install last checked the host. null for a built-in entry it has not checked.

  • tls_name string or null required

    For an IP access point: the name sent (SNI) and checked against the certificate while TCP goes to the IP. null for a named host.

  • pin_sha256 string or null required

    SHA-256 of the certificate key an admin pinned for this host (64 hex), or null.

  • prop_firm boolean required

    A prop firm's server (from the built-in directory).

Example
{
  "server": "Pepperstone-Demo",
  "company": "Pepperstone Group Limited",
  "host": "mt5-demo01.pepperstone.com",
  "port": 443,
  "type": "demo",
  "build": 6090,
  "verified_at": 1790966779,
  "tls_name": null,
  "pin_sha256": null,
  "prop_firm": false
}
Another example
{
  "server": "Pepperstone-MT5-Live01",
  "company": "Pepperstone Group Limited",
  "host": "mt5-1.pepperstone.com",
  "port": 443,
  "type": "real",
  "build": null,
  "verified_at": null,
  "tls_name": null,
  "pin_sha256": null,
  "prop_firm": false
}

ServerCheckRequest

  • host string required

    Host name to check. A pasted link works: the scheme, path, query, fragment and any user@ are dropped, and host:port works when port is left out.

  • port integer default 443

    Port. Defaults to 443.

  • tls_name string

    For an IP access point: the name on its certificate (sent as SNI and checked). Defaults to the directory's for that host.

  • fingerprint string

    Pin this certificate key for the host: the spki_sha256 a refused check reported (64 hex; sha256: and colons allowed). Only for a host you know is the broker's; audited as server_trust.

Example
{
  "host": "mt5-demo01.pepperstone.com"
}
Another example
{
  "host": "52.221.81.217",
  "tls_name": "exwebterm.com"
}

ServerCheck

  • ok boolean required

    True when the host serves an MT5 web terminal.

  • host string required

    The host that was checked.

  • port integer required

    The port that was checked.

  • company string required

    Broker company name from the terminal page.

  • build integer required

    Web terminal build.

  • servers array of object required

    Trade servers this host answers for. They are saved to the directory.

    Fields
    • server string required

      Trade server name.

    • type string required

      demo or real, from the server's name (Demo, Trial or Contest in it means demo), not from the page.

      demoreal
  • tls_name string or null required

    The TLS name used, for an IP access point.

  • pin_sha256 string or null required

    The pinned key the host was checked with, if any.

Example
{
  "ok": true,
  "host": "mt5-demo01.pepperstone.com",
  "port": 443,
  "company": "Pepperstone Group Limited",
  "build": 6090,
  "servers": [
    {
      "server": "Pepperstone-Demo",
      "type": "demo"
    }
  ],
  "tls_name": null,
  "pin_sha256": null
}

Diagnostics

What the server itself is doing.

  • version string required

    Server version.

  • target string required

    The platform the binary was built for, for example x86_64-unknown-linux-gnu.

  • pid integer required

    Process id.

  • started_at integer required

    When the server started, unix seconds (UTC).

  • uptime_s integer required

    Seconds since the server started.

  • process object required

    Read from /proc; every field is null off Linux.

    Fields
    • rss_kb integer or null required

      Resident memory in KB.

    • rss_peak_kb integer or null required

      The most resident memory since the start, in KB (VmHWM).

    • threads integer or null required

      Threads.

    • open_files integer or null required

      Open file descriptors.

  • data_dir string required

    The data folder.

  • log_file string or null required

    The current log file, null before the first one is written.

  • db_bytes integer required

    Size of the database (with its write-ahead log) in bytes.

  • dashboard_sessions integer required

    Dashboard sign-ins that have not expired.

  • streams object required

    Open price streams and their caps.

    Fields
    • sse integer required

      Open SSE streams.

    • ws integer required

      Open WebSockets.

    • max integer

      Cap on open streams in total.

    • max_per_key integer

      Cap on open streams per key or dashboard session.

  • accounts array of DiagnosticsAccount required

    Every account, with its connection status.

    DiagnosticsAccount fields
    • id string required

      Account id.

    • enabled boolean required

      False for an account that is turned off.

    • connected boolean required

      Whether the session to the broker is up right now.

    • since integer or null required

      Unix seconds (UTC) when the current connection came up. null while disconnected.

    • reconnects integer required

      Automatic reconnects since the server started.

    • ping_ms number or null required

      Last heartbeat round trip in milliseconds. null before the first one.

    • server_build integer or null required

      MT5 build the broker's server reported. null before the first login.

    • last_error string or null required

      Why the last connection attempt failed or the connection dropped. null while connected.

    • subscribed integer required

      Number of symbols with a live price subscription.

    • login_rejected boolean required

      True after the broker refused the login. A refusal within an hour of losing a working connection (a broker restarting refuses logins with code 2 for seconds to minutes) is tried again after 10, 20, 30 and 60 s, then every minute for code 2 until an hour after the loss (0.6.3), then every 5 minutes; any other refusal only every 5 minutes, so a wrong password cannot get the account locked.

    • retry_at integer or null required

      Unix seconds (UTC) of the next connection attempt while disconnected, else null.

    • session_running boolean required

      Whether the account's connection loop is running.

    • ticks_seen integer required

      Price ticks received since the session started.

    • last_tick_at_ms integer or null required

      When the last tick arrived, unix milliseconds (UTC). null before the first.

    • last_frame_at_ms integer or null required

      When the last frame of any kind (pings included) arrived from the broker, unix milliseconds (UTC). A connected account with an old value is about to be declared dead.

    • streams integer required

      Open streams (SSE and WebSocket) on this account.

    • ticks_coalesced integer required

      Ticks dropped for slow stream readers (they got the latest tick per symbol instead).

    • undecoded integer required

      Frames from this account the client could not decode.

  • undecoded object required

    Frames the client could not decode.

    Fields
    • total integer required

      Frames the client could not decode since the server started.

    • file string required

      Where kept frames are appended: <data>/captures/undecoded.jsonl.

    • by_command array of UndecodedCount required

      One counter per (account, command, kind), most recent first.

      UndecodedCount fields
      • account string required

        Account id.

      • command integer required

        Protocol command id.

      • kind string required

        frame: the outer frame or its encryption did not check out. body: a known command whose body did not parse. unknown_push: a push with a command id the client does not handle. extra (0.6.0): a reply read in full with bytes after the records the layout knows; kept for diagnosis, never counted as undecoded.

        framebodyunknown_pushextra
      • context string required

        Where it happened.

      • count integer required

        How many such frames arrived (kept or only counted).

      • first_at integer required

        First one, unix seconds (UTC).

      • last_at integer required

        Latest one, unix seconds (UTC).

      • last_error string required

        What the decoder said about the latest one.

    • recent array of object required

      The last 20 kept frames, newest first, without their bytes (GET /api/v1/diagnostics/undecoded has them). Frames kept before a restart are among them: the newest are read back from the file at start.

      Fields
      • id integer required

        Frame number since the server started.

      • time integer required

        When it arrived, unix seconds (UTC).

      • account string required

        Account id.

      • kind string required

        frame: the outer frame or its encryption did not check out. body: a known command whose body did not parse. unknown_push: a push with a command id the client does not handle. extra (0.6.0): a reply read in full with bytes after the records the layout knows; kept for diagnosis, never counted as undecoded.

        framebodyunknown_pushextra
      • command integer required

        Protocol command id.

      • code integer required

        The frame's result code.

      • context string required

        Where it happened, for example tick push or account reply.

      • error string required

        What the decoder said.

      • server_build integer required

        The broker's MT5 build at the time.

      • len integer required

        Body length in bytes.

  • problems array of LogLine required

    The last 100 warnings and errors from the log, newest first.

    LogLine fields
    • time integer required

      Unix seconds (UTC).

    • level string required

      Log level.

      warnerror
    • target string required

      The module that logged it.

    • message string required

      The log message.

  • crashes array of CrashReport required

    Crash reports in <data>/crashes, newest first.

    CrashReport fields
    • name string required

      File name in <data>/crashes; fetch the text with GET /api/v1/diagnostics/crashes/{name}.

    • time integer required

      When it was written, unix seconds (UTC).

    • size integer required

      Size in bytes.

    • summary string required

      The panic message, or the first line of an unclean-exit report.

  • unclean_exit_report string or null required

    null, or the file name (such as unclean-exit-2026-10-03T00-12-07Z.txt) of the report written at this start because the previous run did not shut down cleanly (its pid file was still there). Read it with GET /api/v1/diagnostics/crashes/{name}. It stays set for the whole run.

Example
{
  "version": "0.1.0",
  "target": "x86_64-unknown-linux-gnu",
  "pid": 41822,
  "started_at": 1790894779,
  "uptime_s": 75600,
  "process": {
    "rss_kb": 23140,
    "rss_peak_kb": 31200,
    "threads": 9,
    "open_files": 21
  },
  "data_dir": "/var/lib/termless",
  "log_file": "/var/lib/termless/logs/termlessd.2026-10-03.log",
  "db_bytes": 135168,
  "dashboard_sessions": 1,
  "streams": {
    "sse": 1,
    "ws": 0,
    "max": 1024,
    "max_per_key": 256
  },
  "accounts": [
    {
      "connected": true,
      "since": 1790968298,
      "reconnects": 0,
      "ping_ms": 14.2,
      "server_build": 6090,
      "last_error": null,
      "subscribed": 2,
      "login_rejected": false,
      "retry_at": null,
      "id": "pepperstone-12345678",
      "enabled": true,
      "session_running": true,
      "ticks_seen": 1840211,
      "last_tick_at_ms": 1790970379473,
      "last_frame_at_ms": 1790970381002,
      "streams": 1,
      "ticks_coalesced": 0,
      "undecoded": 3
    }
  ],
  "undecoded": {
    "total": 3,
    "file": "/var/lib/termless/captures/undecoded.jsonl",
    "by_command": [
      {
        "account": "pepperstone-12345678",
        "command": 8,
        "kind": "body",
        "context": "tick push",
        "count": 3,
        "first_at": 1790964410,
        "last_at": 1790965012,
        "last_error": "short read at offset 40"
      }
    ],
    "recent": [
      {
        "id": 3,
        "time": 1790965012,
        "account": "pepperstone-12345678",
        "kind": "body",
        "command": 8,
        "code": 0,
        "context": "tick push",
        "error": "short read at offset 40",
        "server_build": 6090,
        "len": 52
      }
    ]
  },
  "problems": [
    {
      "time": 1790968290,
      "level": "warn",
      "target": "termless::session",
      "message": "[pepperstone-12345678] connection lost, reconnecting"
    }
  ],
  "crashes": [
    {
      "name": "20261002T231405Z-panic.txt",
      "time": 1790896445,
      "size": 6120,
      "summary": "index out of bounds: the len is 3 but the index is 3"
    }
  ],
  "unclean_exit_report": null
}

DiagnosticsAccount

An account's status plus the counters diagnostics adds.

  • id string required

    Account id.

  • enabled boolean required

    False for an account that is turned off.

  • connected boolean required

    Whether the session to the broker is up right now.

  • since integer or null required

    Unix seconds (UTC) when the current connection came up. null while disconnected.

  • reconnects integer required

    Automatic reconnects since the server started.

  • ping_ms number or null required

    Last heartbeat round trip in milliseconds. null before the first one.

  • server_build integer or null required

    MT5 build the broker's server reported. null before the first login.

  • last_error string or null required

    Why the last connection attempt failed or the connection dropped. null while connected.

  • subscribed integer required

    Number of symbols with a live price subscription.

  • login_rejected boolean required

    True after the broker refused the login. A refusal within an hour of losing a working connection (a broker restarting refuses logins with code 2 for seconds to minutes) is tried again after 10, 20, 30 and 60 s, then every minute for code 2 until an hour after the loss (0.6.3), then every 5 minutes; any other refusal only every 5 minutes, so a wrong password cannot get the account locked.

  • retry_at integer or null required

    Unix seconds (UTC) of the next connection attempt while disconnected, else null.

  • session_running boolean required

    Whether the account's connection loop is running.

  • ticks_seen integer required

    Price ticks received since the session started.

  • last_tick_at_ms integer or null required

    When the last tick arrived, unix milliseconds (UTC). null before the first.

  • last_frame_at_ms integer or null required

    When the last frame of any kind (pings included) arrived from the broker, unix milliseconds (UTC). A connected account with an old value is about to be declared dead.

  • streams integer required

    Open streams (SSE and WebSocket) on this account.

  • ticks_coalesced integer required

    Ticks dropped for slow stream readers (they got the latest tick per symbol instead).

  • undecoded integer required

    Frames from this account the client could not decode.

UndecodedFrame

A frame the client could not decode, kept with its bytes.

  • id integer required

    Frame number since the server started.

  • time integer required

    When it arrived, unix seconds (UTC).

  • account string required

    Account id.

  • login integer required

    MT5 login of the account.

  • kind string required

    frame: the outer frame or its encryption did not check out. body: a known command whose body did not parse. unknown_push: a push with a command id the client does not handle. extra (0.6.0): a reply read in full with bytes after the records the layout knows; kept for diagnosis, never counted as undecoded.

    framebodyunknown_pushextra
  • command integer required

    Protocol command id.

  • code integer required

    The frame's result code.

  • context string required

    Where it happened, for example tick push or account reply.

  • error string required

    What the decoder said.

  • server_build integer required

    The broker's MT5 build at the time.

  • len integer required

    Body length in bytes.

  • body_hex string required

    The body as hex. Without bodies=1 it is cut to the first 128 bytes and body_preview is true; with it, up to 64 KB a frame.

  • truncated boolean required

    True when the kept body itself holds only the first 64 KB.

  • body_preview boolean

    Present and true when body_hex was cut to its first 128 bytes; ask with bodies=1 for the whole body.

Example
{
  "id": 3,
  "time": 1790965012,
  "account": "pepperstone-12345678",
  "login": 12345678,
  "kind": "body",
  "command": 8,
  "code": 0,
  "context": "tick push",
  "error": "short read at offset 40",
  "server_build": 6090,
  "len": 52,
  "body_hex": "0a000000b80b0000a4703d0ad7af924000000000000000000000000000000000c8b1e2a4b5010000",
  "truncated": false
}

UndecodedCount

  • account string required

    Account id.

  • command integer required

    Protocol command id.

  • kind string required

    frame: the outer frame or its encryption did not check out. body: a known command whose body did not parse. unknown_push: a push with a command id the client does not handle. extra (0.6.0): a reply read in full with bytes after the records the layout knows; kept for diagnosis, never counted as undecoded.

    framebodyunknown_pushextra
  • context string required

    Where it happened.

  • count integer required

    How many such frames arrived (kept or only counted).

  • first_at integer required

    First one, unix seconds (UTC).

  • last_at integer required

    Latest one, unix seconds (UTC).

  • last_error string required

    What the decoder said about the latest one.

Example
{
  "account": "pepperstone-12345678",
  "command": 8,
  "kind": "body",
  "context": "tick push",
  "count": 3,
  "first_at": 1790964410,
  "last_at": 1790965012,
  "last_error": "short read at offset 40"
}

LogLine

  • time integer required

    Unix seconds (UTC).

  • level string required

    Log level.

    warnerror
  • target string required

    The module that logged it.

  • message string required

    The log message.

Example
{
  "time": 1790968290,
  "level": "warn",
  "target": "termless::session",
  "message": "[pepperstone-12345678] connection lost, reconnecting"
}

CrashReport

  • name string required

    File name in <data>/crashes; fetch the text with GET /api/v1/diagnostics/crashes/{name}.

  • time integer required

    When it was written, unix seconds (UTC).

  • size integer required

    Size in bytes.

  • summary string required

    The panic message, or the first line of an unclean-exit report.

Example
{
  "name": "20261002T231405Z-panic.txt",
  "time": 1790896445,
  "size": 6120,
  "summary": "index out of bounds: the len is 3 but the index is 3"
}

DoctorReport

The same checks as termlessd doctor: data folder, master.key, database integrity and row counts, listen address, each account's gateway (DNS, TLS, the web terminal's build), the clock against the broker (the newest live tick), free disk.

  • verdict string required

    ok when every check passed, warnings when something should be looked at, problems when something is broken.

    okwarningsproblems
  • version string required

    Server version.

  • data_dir string required

    The data folder that was checked.

  • checks array of DoctorCheck required

    One row per check, in the order they ran.

    DoctorCheck fields
    • name string required

      What was checked: data folder, master.key, setup-token, database, listen, gateway (one per account; gateways when there are none), clock, disk.

    • level string required

      ok, warn or fail.

      okwarnfail
    • detail string required

      What was found, in a sentence.

    • fix string

      What to do. Only on a warn or fail.

Example
{
  "verdict": "warnings",
  "version": "0.1.0",
  "data_dir": "/var/lib/termless",
  "checks": [
    {
      "name": "data folder",
      "level": "ok",
      "detail": "/var/lib/termless exists and is writable"
    },
    {
      "name": "master.key",
      "level": "ok",
      "detail": "/var/lib/termless/master.key present (owner-only)"
    },
    {
      "name": "database",
      "level": "ok",
      "detail": "/var/lib/termless/termless.db (132 KB) integrity ok; rows: accounts 1, keys 2, audit 4821, account_events 310, equity_samples 1440"
    },
    {
      "name": "listen",
      "level": "ok",
      "detail": "serving on http://127.0.0.1:8780"
    },
    {
      "name": "gateway",
      "level": "ok",
      "detail": "pepperstone-12345678: mt5-demo01.pepperstone.com:443 is Pepperstone Group Limited build 6090 (2 servers); connected, build 6090"
    },
    {
      "name": "clock",
      "level": "warn",
      "detail": "7 s off the broker's clock",
      "fix": "enable NTP (timedatectl set-ntp true); candle times and expirations depend on it"
    },
    {
      "name": "disk",
      "level": "ok",
      "detail": "18240 MB free; termless uses 3 MB"
    }
  ]
}

DoctorCheck

  • name string required

    What was checked: data folder, master.key, setup-token, database, listen, gateway (one per account; gateways when there are none), clock, disk.

  • level string required

    ok, warn or fail.

    okwarnfail
  • detail string required

    What was found, in a sentence.

  • fix string

    What to do. Only on a warn or fail.

Example
{
  "name": "clock",
  "level": "warn",
  "detail": "7 s off the broker's clock",
  "fix": "enable NTP (timedatectl set-ntp true); candle times and expirations depend on it"
}

EquityGap

A period the account was not connected.

  • from integer required

    When the account stopped being connected (a lost or stopped event, the window's start if it was already down, or for a run that ended without a stop the last sample before the restart), unix milliseconds (UTC).

  • to integer or null required

    When it connected again, unix milliseconds (UTC). null while it still is not.

Example
{
  "from": 1790968296572,
  "to": 1790968298412
}
Another example
{
  "from": 1790981100000,
  "to": null
}

Certificate

A gateway certificate that was refused, for a person to judge. Termless never accepts one on its own; an admin may pin its key.

  • host string required

    The name that was checked (the TLS name, else the host).

  • reason string required

    Why it was refused.

    unknown_issuername_mismatchexpirednot_yet_validpin_mismatchinvalid
  • detail string required

    The TLS library's words.

  • names array of string required

    The names the certificate is for (subjectAltName, else its common name).

  • subject string required

    Its subject, most specific first.

  • issuer string required

    Who issued it.

  • not_before integer required

    Valid from, unix seconds (UTC).

  • not_after integer required

    Valid until, unix seconds (UTC).

  • spki_sha256 string required

    SHA-256 of its DER SubjectPublicKeyInfo, 64 lower-case hex: the value to pin.

  • pinned string or null required

    For pin_mismatch: the key that was expected.

Example
{
  "host": "mt5-demo.broker-example.com",
  "reason": "name_mismatch",
  "detail": "NotValidForNameContext",
  "names": [
    "*.mobile-demo.example.net",
    "mobile-demo.example.net"
  ],
  "subject": "CN=*.mobile-demo.example.net",
  "issuer": "CN=Example DV CA, O=Example Trust, C=LU",
  "not_before": 1759190400,
  "not_after": 1790726399,
  "spki_sha256": "94f8fc63b835599dd9a14fbd30445e94040d65b2801597b764aae9bfb779d4e7",
  "pinned": null
}

CertificateError

502 untrusted_certificate or certificate_changed: the error and the certificate.

  • error object required

    Fields
    • code string required

      Machine-readable error code. Matches the HTTP status.

      bad_requestunauthorizedforbiddenreal_accountnot_foundmethod_not_allowedconflictrejectedtoo_many_requestsinternalbroker_errordisconnectedbusystoppingtimeoutunconfirmedtrading_pausedkey_limituntrusted_certificatecertificate_changedbrowser_only
    • message string required

      What went wrong, in a sentence a person can read.

  • certificate object required

    A gateway certificate that was refused, for a person to judge. Termless never accepts one on its own; an admin may pin its key.

    Certificate fields
    • host string required

      The name that was checked (the TLS name, else the host).

    • reason string required

      Why it was refused.

      unknown_issuername_mismatchexpirednot_yet_validpin_mismatchinvalid
    • detail string required

      The TLS library's words.

    • names array of string required

      The names the certificate is for (subjectAltName, else its common name).

    • subject string required

      Its subject, most specific first.

    • issuer string required

      Who issued it.

    • not_before integer required

      Valid from, unix seconds (UTC).

    • not_after integer required

      Valid until, unix seconds (UTC).

    • spki_sha256 string required

      SHA-256 of its DER SubjectPublicKeyInfo, 64 lower-case hex: the value to pin.

    • pinned string or null required

      For pin_mismatch: the key that was expected.

Example
{
  "error": {
    "code": "untrusted_certificate",
    "message": "the certificate of mt5-demo.broker-example.com is not trusted: it is for another name; ..."
  },
  "certificate": {
    "host": "mt5-demo.broker-example.com",
    "reason": "name_mismatch",
    "detail": "NotValidForNameContext",
    "names": [
      "*.mobile-demo.example.net",
      "mobile-demo.example.net"
    ],
    "subject": "CN=*.mobile-demo.example.net",
    "issuer": "CN=Example DV CA, O=Example Trust, C=LU",
    "not_before": 1759190400,
    "not_after": 1790726399,
    "spki_sha256": "94f8fc63b835599dd9a14fbd30445e94040d65b2801597b764aae9bfb779d4e7",
    "pinned": null
  }
}

TrustRequest

  • fingerprint string required

    The key to pin: spki_sha256 from a refused check (64 hex; sha256: and colons allowed).

Example
{
  "fingerprint": "94f8fc63b835599dd9a14fbd30445e94040d65b2801597b764aae9bfb779d4e7"
}

TrustResult

  • ok boolean required

    True: pinned.

  • server string required

    The server named in the path.

  • host string required

    Its host.

  • port integer required

    Its port.

  • tls_name string or null required

    Its TLS name, if any.

  • pin_sha256 string required

    The pinned key.

  • accounts_restarted integer required

    Accounts on that gateway that logged in again with the pin.

  • servers array of object required

    Servers the host's page lists (saved with the pin).

    Fields
    • server string required

      Trade server name.

    • type string required

      demo or real.

      demoreal

HistoryTick

One kept tick (GET /ticks), in the shape of copy_ticks_from's rows.

  • time integer required

    Unix seconds, trade server clock.

  • time_msc integer required

    Unix milliseconds, trade server clock.

  • bid number required

    Bid after the tick (the previous one when the tick did not change it).

  • ask number required

    Ask after the tick (the previous one when the tick did not change it).

  • last number required

    Last deal price after the tick. 0 for most forex and CFD symbols.

  • volume integer required

    The tick's volume; 0 unless the tick changed it (flag 16).

  • flags integer required

    MetaTrader's TICK_FLAG_* for what the tick changed, added together: 2 bid, 4 ask, 8 last, 16 volume.

  • volume_raw integer required

    The broker's volume number (lots times 10^8), as volume (0.7.0).

  • volume_real number required

    The volume in lots (0.7.0).

Example
{
  "time": 1790981179,
  "time_msc": 1790981179473,
  "bid": 2391.42,
  "ask": 2391.6,
  "last": 0,
  "volume": 0,
  "volume_raw": 0,
  "volume_real": 0.0,
  "flags": 6
}

TickHistory

The ticks termlessd kept for one symbol (the web protocol serves no tick history). Since 0.7.0 a symbol's ticks are kept from its first GET /ticks read on and dropped when it stops streaming, so a first read is often empty: the newest 1,000 per symbol by default, 100,000 over all of an account's symbols. A reconnect starts it again.

  • symbol string required

    Symbol name, as the broker spells it.

  • kept_from_msc integer or null required

    time_msc of the oldest tick kept for the symbol, whatever the request asked: how far back GET /ticks can reach right now. null while none is kept (a symbol subscribed just now, or TERMLESS_TICK_HISTORY=0).

  • ticks array of HistoryTick required

    Ticks, oldest first.

    HistoryTick fields
    • time integer required

      Unix seconds, trade server clock.

    • time_msc integer required

      Unix milliseconds, trade server clock.

    • bid number required

      Bid after the tick (the previous one when the tick did not change it).

    • ask number required

      Ask after the tick (the previous one when the tick did not change it).

    • last number required

      Last deal price after the tick. 0 for most forex and CFD symbols.

    • volume integer required

      The tick's volume; 0 unless the tick changed it (flag 16).

    • flags integer required

      MetaTrader's TICK_FLAG_* for what the tick changed, added together: 2 bid, 4 ask, 8 last, 16 volume.

    • volume_raw integer required

      The broker's volume number (lots times 10^8), as volume (0.7.0).

    • volume_real number required

      The volume in lots (0.7.0).

Example
{
  "symbol": "XAUUSD",
  "kept_from_msc": 1790980874102,
  "ticks": [
    {
      "time": 1790981179,
      "time_msc": 1790981179473,
      "bid": 2391.42,
      "ask": 2391.6,
      "last": 0,
      "volume": 0,
      "volume_raw": 0,
      "volume_real": 0.0,
      "flags": 6
    },
    {
      "time": 1790981179,
      "time_msc": 1790981179688,
      "bid": 2391.45,
      "ask": 2391.6,
      "last": 0,
      "volume": 0,
      "volume_raw": 0,
      "volume_real": 0.0,
      "flags": 2
    }
  ]
}

BookLevel

One price level of an order book, as market_book_get's BookInfo.

  • type integer required

    MetaTrader's BOOK_TYPE_*: 1 sell, 2 buy, 3 sell market, 4 buy market.

    1234
  • side string required

    sell for types 1 and 3, buy for 2 and 4.

    sellbuy
  • price number required

    The level's price.

  • volume integer required

    Volume at this price in the broker's units (units of the base, as the web terminal shows them; 0.7.0, it was called lots), whole (the official volume).

  • volume_dbl number required

    The same, exactly.

  • lots number required

    The units over the symbol's contract size (0.7.0).

Example
{
  "type": 1,
  "side": "sell",
  "price": 2391.8,
  "volume": 250,
  "volume_dbl": 250.0,
  "lots": 2.5
}

Book

A symbol's order book (depth of market), GET /book.

  • symbol string required

    Symbol name, as the broker spells it.

  • time integer required

    The trade server's time of this book, unix seconds, server time. 0 when the broker has sent no book for the symbol (it likely has no depth there; it is asked again after 5 minutes); an old time means the broker sent no fresh book within 3 s when asked again (asked again after 30 s).

  • time_msc integer required

    The same to the millisecond (a change the broker pushed carries its milliseconds; a full snapshot 0 of them). 0 when time is 0.

  • levels array of BookLevel required

    Sells from the highest price down, then buys from the highest price down. Empty when the market is closed, or when the broker sent no book (time 0).

    BookLevel fields
    • type integer required

      MetaTrader's BOOK_TYPE_*: 1 sell, 2 buy, 3 sell market, 4 buy market.

      1234
    • side string required

      sell for types 1 and 3, buy for 2 and 4.

      sellbuy
    • price number required

      The level's price.

    • volume integer required

      Volume at this price in the broker's units (units of the base, as the web terminal shows them; 0.7.0, it was called lots), whole (the official volume).

    • volume_dbl number required

      The same, exactly.

    • lots number required

      The units over the symbol's contract size (0.7.0).

Example
{
  "symbol": "XAUUSD",
  "time": 1790981179,
  "time_msc": 1790981179629,
  "levels": [
    {
      "type": 1,
      "side": "sell",
      "price": 2391.8,
      "volume": 250,
      "volume_dbl": 250.0,
      "lots": 2.5
    },
    {
      "type": 1,
      "side": "sell",
      "price": 2391.6,
      "volume": 100,
      "volume_dbl": 100.0,
      "lots": 1.0
    },
    {
      "type": 2,
      "side": "buy",
      "price": 2391.42,
      "volume": 120,
      "volume_dbl": 120.0,
      "lots": 1.2
    },
    {
      "type": 2,
      "side": "buy",
      "price": 2391.2,
      "volume": 300,
      "volume_dbl": 300.0,
      "lots": 3.0
    }
  ]
}
Another example
{
  "symbol": "XAUUSD",
  "time": 0,
  "time_msc": 0,
  "levels": []
}

OrdersSnapshot

The data of an orders event (events=orders): once right after the first status, then whenever a broker trade push added, changed or removed a pending order (and after a reconnect when the book changed meanwhile). Sent only when the list differs from the last one sent; orders carry no live price, so ticks never send one. Redraw from each snapshot.

  • orders array of Order required

    Every pending order (limit, stop, stop limit), as GET /orders lists them.

    Order fields
    • ticket integer required

      Order ticket.

    • symbol string required

      Symbol name.

    • type string required

      Order type. GET /orders and orders events list pending orders only (limit, stop, stop limit); in a trade event a market order is buy or sell (with pending: false).

      buy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limitbuysellclose_by
    • side string required

      Direction.

      buysell
    • volume number required

      Lots still to fill.

    • volume_initial number required

      Lots when placed.

    • price number required

      Trigger price.

    • stop_limit number required

      Limit price for stop limit orders, 0 otherwise.

    • sl number required

      Stop loss price, 0 when none.

    • tp number required

      Take profit price, 0 when none.

    • expiration integer required

      Expiry, unix seconds, trade server clock. 0 = good till cancelled.

    • comment string required

      Comment. The broker keeps 31 characters; for an order sent through Termless with a longer comment, Termless keeps the full text and puts it back here when the broker's is its start.

    • magic integer required

      Magic number. The web protocol cannot send one, so the broker stores 0; for an order sent through Termless with a magic number, Termless keeps it and puts it back here (the broker's own wins when it is not 0). An order that closed a tagged position (its stop, its target) gets the magic but keeps its own comment.

    • reason string required

      Why it came about: client (a desktop terminal), mobile, web (anything sent through Termless), expert, sl and tp (closed at the stop loss or take profit), stop_out, and rarer ones. The wire carries the trade server's own numbers (web 17, SL 3, TP 4), not the official DEAL_REASON_* values, so read the word.

      clientmobilewebexpertsltpstop_outrollovervmarginsplitcorporate_actiondealergatewaysignalsettlementtransfersyncexternal_clientexternal_servicemigrationunknown
    • time_setup integer required

      When the order was placed, unix seconds, trade server clock.

    • time_setup_msc integer required

      When the order was placed, unix milliseconds, trade server clock.

  • time_ms integer required

    When it was read, unix milliseconds (UTC).

Example
{
  "orders": [
    {
      "ticket": 51830020,
      "symbol": "XAUUSD",
      "type": "buy_limit",
      "side": "buy",
      "volume": 0.1,
      "volume_initial": 0.1,
      "price": 2365.0,
      "stop_limit": 0,
      "sl": 2350.0,
      "tp": 2410.0,
      "expiration": 0,
      "comment": "dip buy",
      "magic": 0,
      "reason": "web",
      "time_setup": 1790977698,
      "time_setup_msc": 1790977698412
    }
  ],
  "time_ms": 1790977698430
}
Another example
{
  "orders": [],
  "time_ms": 1790981179473
}

StreamConnection

An open stream and what it has sent.

  • id integer required

    A number for the stream, unique until the server restarts.

  • kind string required

    sse for /stream, ws for /ws.

    ssews
  • who object required

    Fields
    • kind string required

      key, or dashboard for the dashboard's own streams.

      keydashboard
    • key_id string

      The key's id (absent for the dashboard).

    • name string required

      The key's name, or dashboard.

  • ip string required

    The client's address (behind --trust-proxy, the proxy header's).

  • user_agent string required

    The client's User-Agent (cut to 200 characters).

  • account string required

    The account streamed.

  • symbols array of string required

    The symbols it receives ticks for (they change with WebSocket subscribe and unsubscribe).

  • events array of string required

    What it asked for with events=.

    ticksbarstradesaccountpositionsorders
  • batch_ms integer required

    SSE batch window asked for; 0 writes every frame at once.

  • opened_at integer required

    When it opened, unix milliseconds (UTC).

  • sent object required

    Fields
    • messages integer required

      Everything delivered except heartbeats: ticks, events and the rest (status, subscribed, command answers).

    • bytes integer required

      Bytes written, heartbeats included.

    • ticks integer required

      Tick messages.

    • events integer required

      trade, account, positions and orders messages.

  • last_sent_at integer or null required

    When the last message went out, unix milliseconds (UTC), to about 0.1 s. null before the first.

  • rate_per_s number required

    Messages a second over the last 10 s (or over the stream's life when it is younger).

  • coalesced integer required

    Ticks this stream never saw because it fell behind (the newest per symbol was kept).

Example
{
  "id": 12,
  "kind": "sse",
  "who": {
    "kind": "key",
    "key_id": "key_3f9a1c07",
    "name": "EA bridge (gold)"
  },
  "ip": "203.0.113.7",
  "user_agent": "python-requests/2.32",
  "account": "pepperstone-12345678",
  "symbols": [
    "XAUUSD",
    "EURUSD"
  ],
  "events": [
    "ticks",
    "trades",
    "account"
  ],
  "batch_ms": 0,
  "opened_at": 1790977520000,
  "sent": {
    "messages": 52811,
    "bytes": 6203417,
    "ticks": 52102,
    "events": 708
  },
  "last_sent_at": 1790981179401,
  "rate_per_s": 14.6,
  "coalesced": 0
}

KeyTraffic

One key's traffic since the server started (zeros when unused).

  • key_id string required

    Key id.

  • name string required

    Key name.

  • scope string required

    read, trade or admin.

    readtradeadmin
  • accounts array or null required

    Accounts it is limited to; null = every account.

  • streams_open integer required

    Streams it has open now.

  • stream_bytes integer required

    Bytes its open streams have sent.

  • requests_1h integer required

    Requests in the last hour.

  • requests_24h integer required

    Requests in the last 24 hours (since the start, if that is later).

  • errors_1h integer required

    Requests in the last hour answered 400 or above.

  • bytes_out_1h integer required

    Response body bytes in the last hour (streams not included).

  • last_request_at integer or null required

    Its last request, unix milliseconds (UTC). null if none since the start.

  • last_ip string or null required

    The address of its last request.

  • top_routes_1h array of object required

    Its busiest routes in the last hour, at most 5.

    Fields
    • route string required

      Method and route template.

    • count integer required

      Requests in the last hour.

Example
{
  "key_id": "key_3f9a1c07",
  "name": "EA bridge (gold)",
  "scope": "trade",
  "accounts": [
    "pepperstone-12345678"
  ],
  "streams_open": 1,
  "stream_bytes": 6203417,
  "requests_1h": 120,
  "requests_24h": 2211,
  "errors_1h": 0,
  "bytes_out_1h": 48210,
  "last_request_at": 1790981175002,
  "last_ip": "203.0.113.7",
  "top_routes_1h": [
    {
      "route": "GET /api/v1/accounts/{id}/positions",
      "count": 60
    },
    {
      "route": "GET /api/v1/accounts/{id}/deals",
      "count": 60
    }
  ]
}

Connections

Who is connected and what they receive, live and in memory since the server started. Key secrets never appear.

  • time_ms integer required

    Now, unix milliseconds (UTC).

  • since_ms integer required

    When the server started: every counter here begins then; nothing is kept across a restart.

  • streams array of StreamConnection required

    Open streams, newest first.

    StreamConnection fields
    • id integer required

      A number for the stream, unique until the server restarts.

    • kind string required

      sse for /stream, ws for /ws.

      ssews
    • who object required

      Fields
      • kind string required

        key, or dashboard for the dashboard's own streams.

        keydashboard
      • key_id string

        The key's id (absent for the dashboard).

      • name string required

        The key's name, or dashboard.

    • ip string required

      The client's address (behind --trust-proxy, the proxy header's).

    • user_agent string required

      The client's User-Agent (cut to 200 characters).

    • account string required

      The account streamed.

    • symbols array of string required

      The symbols it receives ticks for (they change with WebSocket subscribe and unsubscribe).

    • events array of string required

      What it asked for with events=.

      ticksbarstradesaccountpositionsorders
    • batch_ms integer required

      SSE batch window asked for; 0 writes every frame at once.

    • opened_at integer required

      When it opened, unix milliseconds (UTC).

    • sent object required

      Fields
      • messages integer required

        Everything delivered except heartbeats: ticks, events and the rest (status, subscribed, command answers).

      • bytes integer required

        Bytes written, heartbeats included.

      • ticks integer required

        Tick messages.

      • events integer required

        trade, account, positions and orders messages.

    • last_sent_at integer or null required

      When the last message went out, unix milliseconds (UTC), to about 0.1 s. null before the first.

    • rate_per_s number required

      Messages a second over the last 10 s (or over the stream's life when it is younger).

    • coalesced integer required

      Ticks this stream never saw because it fell behind (the newest per symbol was kept).

  • keys array of KeyTraffic required

    Every key in the keys table.

    KeyTraffic fields
    • key_id string required

      Key id.

    • name string required

      Key name.

    • scope string required

      read, trade or admin.

      readtradeadmin
    • accounts array or null required

      Accounts it is limited to; null = every account.

    • streams_open integer required

      Streams it has open now.

    • stream_bytes integer required

      Bytes its open streams have sent.

    • requests_1h integer required

      Requests in the last hour.

    • requests_24h integer required

      Requests in the last 24 hours (since the start, if that is later).

    • errors_1h integer required

      Requests in the last hour answered 400 or above.

    • bytes_out_1h integer required

      Response body bytes in the last hour (streams not included).

    • last_request_at integer or null required

      Its last request, unix milliseconds (UTC). null if none since the start.

    • last_ip string or null required

      The address of its last request.

    • top_routes_1h array of object required

      Its busiest routes in the last hour, at most 5.

      Fields
      • route string required

        Method and route template.

      • count integer required

        Requests in the last hour.

  • dashboard object required

    Fields
    • sessions_active integer required

      Dashboard sessions signed in.

    • streams_open integer required

      Streams the dashboard has open.

    • stream_bytes integer required

      Bytes those streams have sent.

    • requests_1h integer required

      Dashboard requests in the last hour.

    • requests_24h integer required

      Dashboard requests in the last 24 hours.

    • errors_1h integer required

      Of them, answered 400 or above.

    • bytes_out_1h integer required

      Response body bytes in the last hour.

    • last_request_at integer or null required

      The dashboard's last request, unix milliseconds (UTC).

Example
{
  "time_ms": 1790981179473,
  "since_ms": 1790968290000,
  "streams": [
    {
      "id": 12,
      "kind": "sse",
      "who": {
        "kind": "key",
        "key_id": "key_3f9a1c07",
        "name": "EA bridge (gold)"
      },
      "ip": "203.0.113.7",
      "user_agent": "python-requests/2.32",
      "account": "pepperstone-12345678",
      "symbols": [
        "XAUUSD",
        "EURUSD"
      ],
      "events": [
        "ticks",
        "trades",
        "account"
      ],
      "batch_ms": 0,
      "opened_at": 1790977520000,
      "sent": {
        "messages": 52811,
        "bytes": 6203417,
        "ticks": 52102,
        "events": 708
      },
      "last_sent_at": 1790981179401,
      "rate_per_s": 14.6,
      "coalesced": 0
    }
  ],
  "keys": [
    {
      "key_id": "key_3f9a1c07",
      "name": "EA bridge (gold)",
      "scope": "trade",
      "accounts": [
        "pepperstone-12345678"
      ],
      "streams_open": 1,
      "stream_bytes": 6203417,
      "requests_1h": 120,
      "requests_24h": 2211,
      "errors_1h": 0,
      "bytes_out_1h": 48210,
      "last_request_at": 1790981175002,
      "last_ip": "203.0.113.7",
      "top_routes_1h": [
        {
          "route": "GET /api/v1/accounts/{id}/positions",
          "count": 60
        },
        {
          "route": "GET /api/v1/accounts/{id}/deals",
          "count": 60
        }
      ]
    }
  ],
  "dashboard": {
    "sessions_active": 1,
    "streams_open": 0,
    "stream_bytes": 0,
    "requests_1h": 340,
    "requests_24h": 1902,
    "errors_1h": 0,
    "bytes_out_1h": 912044,
    "last_request_at": 1790981179470
  }
}

TrafficRequest

  • at integer required

    When it was answered, unix milliseconds (UTC).

  • method string required

    HTTP method.

  • route string required

    Method and the route template it matched, for example GET /api/v1/accounts/{id}/quotes; (no route) when none matched.

  • path string required

    The path asked for, with its query (key= removed, cut to 300 characters).

  • status integer required

    HTTP status answered.

  • latency_ms number required

    Time to the response's headers, milliseconds.

  • bytes integer required

    Response body bytes (0 for a stream; see its own counters).

  • ip string required

    The client's address.

  • account string or null required

    The account in the path, if any.

Example
{
  "at": 1790981175002,
  "method": "GET",
  "route": "GET /api/v1/accounts/{id}/positions",
  "path": "/api/v1/accounts/pepperstone-12345678/positions?symbol=XAUUSD",
  "status": 200,
  "latency_ms": 0.21,
  "bytes": 812,
  "ip": "203.0.113.7",
  "account": "pepperstone-12345678"
}

KeyTrafficLog

  • key_id string required

    Key id.

  • name string required

    Key name.

  • time_ms integer required

    Now, unix milliseconds (UTC).

  • since_ms integer required

    When the server started.

  • requests array of TrafficRequest required

    Its last requests, newest first (up to 500 are kept).

    TrafficRequest fields
    • at integer required

      When it was answered, unix milliseconds (UTC).

    • method string required

      HTTP method.

    • route string required

      Method and the route template it matched, for example GET /api/v1/accounts/{id}/quotes; (no route) when none matched.

    • path string required

      The path asked for, with its query (key= removed, cut to 300 characters).

    • status integer required

      HTTP status answered.

    • latency_ms number required

      Time to the response's headers, milliseconds.

    • bytes integer required

      Response body bytes (0 for a stream; see its own counters).

    • ip string required

      The client's address.

    • account string or null required

      The account in the path, if any.

  • streams array of StreamConnection required

    Its open streams.

    StreamConnection fields
    • id integer required

      A number for the stream, unique until the server restarts.

    • kind string required

      sse for /stream, ws for /ws.

      ssews
    • who object required

      Fields
      • kind string required

        key, or dashboard for the dashboard's own streams.

        keydashboard
      • key_id string

        The key's id (absent for the dashboard).

      • name string required

        The key's name, or dashboard.

    • ip string required

      The client's address (behind --trust-proxy, the proxy header's).

    • user_agent string required

      The client's User-Agent (cut to 200 characters).

    • account string required

      The account streamed.

    • symbols array of string required

      The symbols it receives ticks for (they change with WebSocket subscribe and unsubscribe).

    • events array of string required

      What it asked for with events=.

      ticksbarstradesaccountpositionsorders
    • batch_ms integer required

      SSE batch window asked for; 0 writes every frame at once.

    • opened_at integer required

      When it opened, unix milliseconds (UTC).

    • sent object required

      Fields
      • messages integer required

        Everything delivered except heartbeats: ticks, events and the rest (status, subscribed, command answers).

      • bytes integer required

        Bytes written, heartbeats included.

      • ticks integer required

        Tick messages.

      • events integer required

        trade, account, positions and orders messages.

    • last_sent_at integer or null required

      When the last message went out, unix milliseconds (UTC), to about 0.1 s. null before the first.

    • rate_per_s number required

      Messages a second over the last 10 s (or over the stream's life when it is younger).

    • coalesced integer required

      Ticks this stream never saw because it fell behind (the newest per symbol was kept).

Example
{
  "key_id": "key_3f9a1c07",
  "name": "EA bridge (gold)",
  "time_ms": 1790981179473,
  "since_ms": 1790968290000,
  "requests": [
    {
      "at": 1790981175002,
      "method": "GET",
      "route": "GET /api/v1/accounts/{id}/positions",
      "path": "/api/v1/accounts/pepperstone-12345678/positions?symbol=XAUUSD",
      "status": 200,
      "latency_ms": 0.21,
      "bytes": 812,
      "ip": "203.0.113.7",
      "account": "pepperstone-12345678"
    }
  ],
  "streams": [
    {
      "id": 12,
      "kind": "sse",
      "who": {
        "kind": "key",
        "key_id": "key_3f9a1c07",
        "name": "EA bridge (gold)"
      },
      "ip": "203.0.113.7",
      "user_agent": "python-requests/2.32",
      "account": "pepperstone-12345678",
      "symbols": [
        "XAUUSD",
        "EURUSD"
      ],
      "events": [
        "ticks",
        "trades",
        "account"
      ],
      "batch_ms": 0,
      "opened_at": 1790977520000,
      "sent": {
        "messages": 52811,
        "bytes": 6203417,
        "ticks": 52102,
        "events": 708
      },
      "last_sent_at": 1790981179401,
      "rate_per_s": 14.6,
      "coalesced": 0
    }
  ]
}

Calc

order_calc_margin and order_calc_profit in one answer (GET /calc).

  • symbol string required

    Symbol name, as the broker spells it.

  • side string required

    Direction.

    buysell
  • type string required

    The MetaTrader order type the side and type make.

    buysellbuy_limitsell_limitbuy_stopsell_stopbuy_stop_limitsell_stop_limit
  • volume number required

    Lots.

  • price number required

    The open price used: the one asked for, else the current ask for a buy and bid for a sell.

  • margin number or null required

    The margin the trade needs once it is open, at price, in the account currency, rounded to its digits (order_calc_margin with the market type of its side): for a pending type, what the position needs when the order fills. null when no symbol converts the margin currency to the account's.

  • margin_pending number or null required

    For a pending type: what the broker holds while the order waits (its type's own rate, margin_rates in the spec; 0 at the brokers seen, so nothing). null for a market order, or when no symbol converts the margin currency.

  • close number or null required

    The closing price asked for; null without one.

  • profit number or null required

    What the order makes from price to close, in the account currency, rounded to its digits (order_calc_profit). null without close, or when no symbol converts the profit currency to the account's.

  • currency string required

    The account currency the numbers are in.

Example
{
  "symbol": "XAUUSD",
  "side": "buy",
  "type": "buy",
  "volume": 0.1,
  "price": 2391.6,
  "margin": 119.58,
  "margin_pending": null,
  "close": 2400.0,
  "profit": 84.0,
  "currency": "USD"
}
Another example
{
  "symbol": "XAUUSD",
  "side": "buy",
  "type": "buy_limit",
  "volume": 0.1,
  "price": 2365.0,
  "margin": 118.25,
  "margin_pending": 0.0,
  "close": null,
  "profit": null,
  "currency": "USD"
}

OrderCheck

What sending an order_send request would do to the account (POST /order_check), in the account currency. The order is not sent.

  • ok boolean required

    True when retcode is 0: sent now, the order would pass these checks.

  • retcode integer required

    0 when every check passes, else the first that failed: 10014 invalid volume, 10017 trading disabled, 10044 close only, 10042 long only, 10043 short only, 10018 market closed, 10015 invalid price (a pending price on the wrong side of the market), 10016 invalid stops (a stop-loss or take-profit on the wrong side of its price or closer than stops_level), 10019 not enough money.

    0100141001710042100431004410018100151001610019
  • comment string required

    The result in words.

    DoneInvalid volumeTrade disabledOnly position closing is allowedOnly long positions are allowedOnly short positions are allowedMarket closedInvalid priceInvalid stopsNo money
  • balance number required

    Balance now.

  • equity number required

    Equity now, live.

  • profit number required

    Floating profit now, live.

  • margin number required

    Margin in use with the order (includes request_margin).

  • margin_free number required

    equity - margin, with the order. Below 0 is 10019 for an order that opens something.

  • margin_level number required

    equity / margin x 100 with the order, in percent. 0 with no margin.

  • request_margin number required

    The margin the order itself needs: for a pending order what the broker holds while it waits (usually 0). 0 for an action that opens nothing, and when an earlier check failed.

Example
{
  "ok": true,
  "retcode": 0,
  "comment": "Done",
  "balance": 10412.58,
  "equity": 10650.69,
  "profit": 238.11,
  "margin": 998.51,
  "margin_free": 9652.18,
  "margin_level": 1066.66,
  "request_margin": 119.58
}
Another example
{
  "ok": false,
  "retcode": 10014,
  "comment": "Invalid volume",
  "balance": 10412.58,
  "equity": 10650.69,
  "profit": 238.11,
  "margin": 878.93,
  "margin_free": 9771.76,
  "margin_level": 1211.78,
  "request_margin": 0.0
}

ApiKeyUpdate

Any of the fields; the ones left out stay as they are (0.6.0).

  • name string

    A new name, up to 80 characters.

  • scopes one of

    Exactly one scope, as on create.

    ["read"]["trade"]["admin"]
  • accounts one of

    The account ids it may use; null or [] for every account. Not allowed with admin (400); an unknown id is 400 too.

  • max_volume one of

    The most lots per order that opens something; null for no limit.

  • max_open_per_min one of

    The most orders that open something in 60 s, 1 to 600; null for no limit.

  • max_daily_loss one of

    A positive amount in the account's currency; past it (from the forex day's start) orders that open something answer 403 key_limit, not sent (0.7.0). null or left out: no limit.

  • max_drawdown_pct one of

    More than 0, at most 100: past that many percent below the equity's high since it was set, orders that open something answer 403 key_limit, not sent (0.7.0). Setting or changing it starts its high afresh.

Example
{
  "scopes": [
    "read"
  ]
}
Another example
{
  "accounts": [
    "pepperstone-12345678"
  ]
}

Ready

A bot's pre-flight check, answered from memory with no broker round trip.

  • account string required

    Account id.

  • checked_at integer required

    When this was worked out, unix milliseconds (UTC).

  • ready_to_read boolean required

    Reads of this account work now: false when any reason blocks read.

  • ready_to_trade boolean required

    An order sent now can reach the broker and be accepted on the account side: false when any reason blocks read or trade.

  • reasons array of ReadyReason required

    Why not, and warnings. Empty when all is well.

    ReadyReason fields
    • code string required

      What it is. Blocks read: turned_off, disconnected, login_rejected. Blocks trade (an order would certainly fail): trade_disabled, investor_login, real_account_blocked, key_read_only, account_not_loaded, market_closed, unknown_symbol. Notes: price_stale and no_price (an asked symbol's price is old or missing; since 0.5.1 a note, since a market order still fills at the broker's price), build_unverified, undecoded_frames, link_quiet, connected_recently.

      turned_offdisconnectedlogin_rejectedtrade_disabledinvestor_loginreal_account_blockedkey_read_onlyaccount_not_loadedmarket_closedprice_staleno_priceunknown_symbolbuild_unverifiedundecoded_frameslink_quietping_overdueconnected_recentlynew_trades_paused
    • blocks string required

      read (reading and trading both fail), trade, or none (a note).

      readtradenone
    • message string required

      One plain sentence for people and logs.

    • symbol string

      The symbol, on the per-symbol reasons only.

  • link object required

    Fields
    • connected boolean required

      Whether the session's link to the broker is up.

    • since integer or null required

      When the current connection came up, unix seconds (UTC); null while disconnected.

    • connected_for_s integer or null required

      Seconds since then; null while disconnected.

    • ping_ms number or null required

      Last heartbeat round trip; null while disconnected.

    • reconnects integer required

      Reconnects since the session started.

    • last_frame_age_ms integer or null required

      Milliseconds since the last frame of any kind from the broker; null while disconnected.

    • ping_pending_ms integer or null required

      How long the oldest unanswered ping has waited, in milliseconds; null when none is waiting (0.6.0). Past 2,000 the reasons carry ping_overdue.

    • pings_missed integer required

      Pings missed in a row; the link is cut at two (0.6.0).

    • last_error string or null required

      The last error, only while disconnected.

    • retry_at integer or null required

      The next connection attempt, unix seconds (UTC), only while disconnected.

  • login object required

    Fields
    • logged_in boolean required

      The session holds a logged-in link.

    • rejected boolean required

      The last refusal was of the login details.

  • server object required

    Fields
    • build integer or null required

      The broker's server build; null before the first connect.

    • build_verified boolean required

      A build Termless's decoding has been checked against live.

    • verified_builds array of integer required

      The builds checked against live (health::VERIFIED_BUILDS).

  • trading object required

    Fields
    • allowed boolean required

      Every check on the trade side passes.

    • account_trade_allowed boolean required

      The broker allows trading on the account.

    • investor boolean required

      Logged in with the investor (read-only) password.

    • demo boolean required

      A demo or contest account.

    • real_money string or null required

      demo, allowed (real money with trade_real on), blocked (real money with it off); null before the account record is read.

      demoallowedblockedNone
    • key_can_trade boolean required

      The caller's scope is trade or admin.

  • prices array of ReadyPrice required

    The watched symbols, then the asked ones that are not watched.

    ReadyPrice fields
    • symbol string required

      Symbol name.

    • watched boolean required

      On the account's watchlist (streamed).

    • asked boolean required

      Named in symbols=.

    • last_tick_age_ms integer or null required

      Milliseconds since its last tick; null before the first.

    • market_open boolean or null required

      Whether its market is open now; null when that cannot be told.

    • market_source string or null required

      sessions (the spec's quote sessions, on the broker's clock), heuristic (no spec loaded yet: the forex week, Sunday 17:00 to Friday 17:00 New York time), or null.

      sessionsheuristicNone
    • fresh boolean required

      A tick came within 120 s, or the market is closed (a closed market is never stale). Information: nothing is blocked on it (since 0.5.1).

  • undecoded_last_hour integer required

    Frames from this account the client could not decode in the last hour.

Example
{
  "account": "pepperstone-12345678",
  "checked_at": 1792300000123,
  "ready_to_read": true,
  "ready_to_trade": true,
  "reasons": [],
  "link": {
    "connected": true,
    "since": 1792290000,
    "connected_for_s": 10000,
    "ping_ms": 12.4,
    "reconnects": 2,
    "last_frame_age_ms": 800,
    "ping_pending_ms": null,
    "pings_missed": 0,
    "last_error": null,
    "retry_at": null
  },
  "login": {
    "logged_in": true,
    "rejected": false
  },
  "server": {
    "build": 6090,
    "build_verified": true,
    "verified_builds": [
      6090,
      6182,
      6230
    ]
  },
  "trading": {
    "allowed": true,
    "account_trade_allowed": true,
    "investor": false,
    "demo": true,
    "real_money": "demo",
    "key_can_trade": true
  },
  "prices": [
    {
      "symbol": "XAUUSD",
      "watched": true,
      "asked": true,
      "last_tick_age_ms": 812,
      "market_open": true,
      "market_source": "sessions",
      "fresh": true
    },
    {
      "symbol": "EURUSD",
      "watched": true,
      "asked": false,
      "last_tick_age_ms": 240,
      "market_open": true,
      "market_source": "sessions",
      "fresh": true
    }
  ],
  "undecoded_last_hour": 0
}
Another example
{
  "account": "pepperstone-12345678",
  "checked_at": 1792300000123,
  "ready_to_read": true,
  "ready_to_trade": false,
  "reasons": [
    {
      "code": "market_closed",
      "blocks": "trade",
      "symbol": "EURUSD",
      "message": "EURUSD's market is closed now (its trading sessions say so); orders would be refused"
    }
  ],
  "link": {
    "connected": true,
    "since": 1792290000,
    "connected_for_s": 10000,
    "ping_ms": 12.4,
    "reconnects": 2,
    "last_frame_age_ms": 800,
    "ping_pending_ms": null,
    "pings_missed": 0,
    "last_error": null,
    "retry_at": null
  },
  "login": {
    "logged_in": true,
    "rejected": false
  },
  "server": {
    "build": 6090,
    "build_verified": true,
    "verified_builds": [
      6090,
      6182,
      6230
    ]
  },
  "trading": {
    "allowed": true,
    "account_trade_allowed": true,
    "investor": false,
    "demo": true,
    "real_money": "demo",
    "key_can_trade": true
  },
  "prices": [
    {
      "symbol": "EURUSD",
      "watched": true,
      "asked": true,
      "last_tick_age_ms": 172800000,
      "market_open": false,
      "market_source": "sessions",
      "fresh": true
    }
  ],
  "undecoded_last_hour": 0
}

ReadyReason

  • code string required

    What it is. Blocks read: turned_off, disconnected, login_rejected. Blocks trade (an order would certainly fail): trade_disabled, investor_login, real_account_blocked, key_read_only, account_not_loaded, market_closed, unknown_symbol. Notes: price_stale and no_price (an asked symbol's price is old or missing; since 0.5.1 a note, since a market order still fills at the broker's price), build_unverified, undecoded_frames, link_quiet, connected_recently.

    turned_offdisconnectedlogin_rejectedtrade_disabledinvestor_loginreal_account_blockedkey_read_onlyaccount_not_loadedmarket_closedprice_staleno_priceunknown_symbolbuild_unverifiedundecoded_frameslink_quietping_overdueconnected_recentlynew_trades_paused
  • blocks string required

    read (reading and trading both fail), trade, or none (a note).

    readtradenone
  • message string required

    One plain sentence for people and logs.

  • symbol string

    The symbol, on the per-symbol reasons only.

Example
{
  "code": "market_closed",
  "blocks": "trade",
  "symbol": "EURUSD",
  "message": "EURUSD's market is closed now (its trading sessions say so); orders would be refused"
}

ReadyPrice

  • symbol string required

    Symbol name.

  • watched boolean required

    On the account's watchlist (streamed).

  • asked boolean required

    Named in symbols=.

  • last_tick_age_ms integer or null required

    Milliseconds since its last tick; null before the first.

  • market_open boolean or null required

    Whether its market is open now; null when that cannot be told.

  • market_source string or null required

    sessions (the spec's quote sessions, on the broker's clock), heuristic (no spec loaded yet: the forex week, Sunday 17:00 to Friday 17:00 New York time), or null.

    sessionsheuristicNone
  • fresh boolean required

    A tick came within 120 s, or the market is closed (a closed market is never stale). Information: nothing is blocked on it (since 0.5.1).

Example
{
  "symbol": "XAUUSD",
  "watched": true,
  "asked": true,
  "last_tick_age_ms": 812,
  "market_open": true,
  "market_source": "sessions",
  "fresh": true
}

StatusReport

Termless and each broker link, over time: uptime, outages and their causes, prices, order latency, protocol drift.

  • verdict string required

    down when every enabled account is down (and at least one is enabled), degraded when any account is down or degraded or Termless wrote a crash report in the last 24 hours, healthy otherwise (also with no accounts).

    healthydegradeddown
  • summary string required

    One plain sentence for people.

  • checked_at integer required

    When this was worked out, unix milliseconds (UTC).

  • termless object required

    Fields
    • version string required

      Server version.

    • started_at integer required

      When this run started, unix seconds (UTC).

    • uptime_s integer required

      Seconds since then.

    • rss_kb integer or null required

      Resident memory in KB; null off Linux.

    • rss_peak_kb integer or null required

      The most resident memory since the start, in KB; null off Linux.

    • restarts_30d integer required

      Starts of the server in the last 30 days (the audit trail's start rows); the first start of an install is not a restart.

    • unclean_exits_30d integer required

      Runs in the last 30 days that ended without shutting down (killed, crashed, out of memory, power lost).

    • last_start_at integer or null required

      The latest start, unix milliseconds (UTC).

    • crash_reports_24h integer required

      Crash reports written in the last 24 hours: a panic termlessd survived, or an unclean exit found at a start (they are under GET /diagnostics). One makes the verdict degraded.

    • errors_1h integer required

      Error lines in termlessd's log in the last hour: counted, not judged.

    • trail_rows_dropped integer required

      Audit rows, events and samples dropped since the start because the trails writer fell behind (its queue holds 50,000; 0.6.0). Anything above 0 means the database is slow or full.

  • accounts array of AccountHealth required

    The accounts the caller may use.

    AccountHealth fields
    • id string required

      Account id.

    • label string required

      Display name.

    • server string required

      Trade server name.

    • broker string required

      The server name's first word (Pepperstone-Demo is Pepperstone), used in the sentences.

    • enabled boolean required

      False when an admin turned it off.

    • verdict string required

      down: enabled and not connected. degraded: connected but an unverified build, undecoded frames in the last hour, its price feed stopped (ticks.feed_quiet), ping over 1000 ms, or under 99% up over the last hour. off: turned off. healthy otherwise.

      healthydegradeddownoff
    • summary string required

      One plain sentence for people.

    • connected boolean required

      Whether the link is up now.

    • since integer or null required

      When the current connection came up, unix seconds (UTC).

    • ping_ms number or null required

      Last heartbeat round trip.

    • tracked_since integer or null required

      Where the 30-day numbers start: 30 days ago, or later when the account was added or its connection history starts inside that window; unix milliseconds (UTC); null with no history.

    • uptime object required

      Each window ends now.

      Fields
      • 1h object required

        UptimeWindow fields
        • percent number or null required

          up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

        • up_ms integer required

          Connected.

        • down_ms integer required

          Not connected, Termless's own downtime included.

        • measured_ms integer required

          The window less the time before the account was added (or before its history starts) and the time it was turned off.

        • reconnects integer required

          Links that came back inside the window.

        • outages integer required

          Outages overlapping the window.

        • longest_outage_ms integer required

          The longest of them, clipped to the window.

      • 24h object required

        UptimeWindow fields
        • percent number or null required

          up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

        • up_ms integer required

          Connected.

        • down_ms integer required

          Not connected, Termless's own downtime included.

        • measured_ms integer required

          The window less the time before the account was added (or before its history starts) and the time it was turned off.

        • reconnects integer required

          Links that came back inside the window.

        • outages integer required

          Outages overlapping the window.

        • longest_outage_ms integer required

          The longest of them, clipped to the window.

      • 7d object required

        UptimeWindow fields
        • percent number or null required

          up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

        • up_ms integer required

          Connected.

        • down_ms integer required

          Not connected, Termless's own downtime included.

        • measured_ms integer required

          The window less the time before the account was added (or before its history starts) and the time it was turned off.

        • reconnects integer required

          Links that came back inside the window.

        • outages integer required

          Outages overlapping the window.

        • longest_outage_ms integer required

          The longest of them, clipped to the window.

      • 30d object required

        UptimeWindow fields
        • percent number or null required

          up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

        • up_ms integer required

          Connected.

        • down_ms integer required

          Not connected, Termless's own downtime included.

        • measured_ms integer required

          The window less the time before the account was added (or before its history starts) and the time it was turned off.

        • reconnects integer required

          Links that came back inside the window.

        • outages integer required

          Outages overlapping the window.

        • longest_outage_ms integer required

          The longest of them, clipped to the window.

    • days array of UptimeDay required

      The last 30 UTC days, oldest first; today runs up to now.

      UptimeDay fields
      • date string required

        The UTC day, YYYY-MM-DD.

      • from integer required

        Its 00:00 UTC, unix milliseconds.

      • percent number or null required

        As in a window; null for a day with nothing measured.

      • up_ms integer required

        Connected.

      • down_ms integer required

        Not connected.

      • measured_ms integer required

        Measured time in the day (today: up to now).

      • outages integer required

        Outages overlapping the day.

    • outages array of Outage required

      Newest first: those overlapping the last 30 days, at most 50.

      Outage fields
      • from integer required

        When the link was lost (or Termless stopped), unix milliseconds (UTC).

      • to integer or null required

        When it was connected again; null while it lasts.

      • duration_ms integer required

        to - from, or up to now while it lasts.

      • ongoing boolean required

        True while it lasts.

      • start_estimated boolean required

        True when from is an estimate (0.6.0): a link cut for missed pings is down from its first unanswered ping, 12 to 17 s before the cut.

      • detected_at integer or null required

        When the drop was noticed (the cut), unix milliseconds (UTC), if from is an estimate; else null.

      • cause string required

        broker_maintenance (logins refused with code 2 right after the drop, or the forex weekend break), broker_unreachable (TCP, TLS or the WebSocket upgrade failed or timed out), broker_unresponsive (connected but the broker stopped answering), termless_restart (Termless stopped, restarted, upgraded or was killed, or the account's session started again), network (name lookups failing, no route, connections reset), login_refused (the login details refused), unknown.

        broker_maintenancebroker_unreachablebroker_unresponsivetermless_restartnetworklogin_refusedunknown
      • message string required

        One plain sentence for people.

      • detail string or null required

        The technical reason seen (the lost event's reason, the connect errors).

    • ticks object required

      Fields
      • per_min number or null required

        Ticks over the last minute; null until a minute of samples exists.

      • seen integer required

        Ticks since the session started.

      • last_tick_age_ms integer or null required

        Age of the newest tick of any symbol; null before one.

      • feed_quiet boolean required

        Connected over 120 s and every watched symbol whose market is open has gone 120 s without a tick: the feed stopped while the link stays up. One quiet symbol is the market (since 0.5.1).

      • symbols array of object required

        The watchlist.

        Fields
        • symbol string required

          Symbol name.

        • last_tick_age_ms integer or null required

          Milliseconds since its last tick.

        • market_open boolean or null required

          As in /ready.

        • fresh boolean required

          As in /ready.

    • orders object required

      Fields
      • window_h integer required

        24.

      • count integer required

        Trade requests sent through this server in the window (from the audit trail).

      • done integer required

        The broker executed or placed it.

      • rejected integer required

        The broker refused it (422).

      • timeout integer required

        No answer (504).

      • failed integer required

        Anything else: busy, disconnected, a 502.

      • latency_ms object or null required

        The broker round trip over done and rejected requests; null when there were none.

        Fields
        • p50 integer

          Median.

        • p95 integer

          95th percentile.

        • max integer

          Slowest.

    • pings_missed integer required

      Heartbeat pings the broker did not answer in time since the server started (0.6.0); two in a row cut the link.

    • trades_unconfirmed integer required

      Trades answered 504 unconfirmed since the start (0.6.0).

    • trades_late integer required

      Of them, those whose final result came later (0.6.0).

    • command_waits integer required

      Requests that waited for their command's turn since the start (most wait no time; 0.6.0).

    • command_wait_ms integer required

      The time they waited, in all, in milliseconds (0.6.0).

    • protocol object required

      Fields
      • build integer or null required

        The broker's server build.

      • build_verified boolean required

        A build Termless has been checked against (see /ready).

      • undecoded_1h integer required

        Undecodable frames in the last hour.

      • undecoded_24h integer required

        Undecodable frames in the last 24 hours.

      • undecoded_by_command array of object required

        Last 24 hours, by command.

        Fields
        • command integer required

          Protocol command id.

        • count integer required

          Frames.

Example
{
  "verdict": "healthy",
  "summary": "All good: 1 account connected, 99.86% up over the last 24 hours.",
  "checked_at": 1792300000123,
  "termless": {
    "version": "0.6.2",
    "started_at": 1792200000,
    "uptime_s": 100000,
    "rss_kb": 16384,
    "rss_peak_kb": 20480,
    "restarts_30d": 3,
    "unclean_exits_30d": 0,
    "last_start_at": 1792200000000,
    "crash_reports_24h": 0,
    "errors_1h": 0,
    "trail_rows_dropped": 0
  },
  "accounts": [
    {
      "id": "pepperstone-12345678",
      "label": "Pepperstone demo",
      "server": "Pepperstone-Demo",
      "broker": "Pepperstone",
      "enabled": true,
      "verdict": "healthy",
      "summary": "Connected for 2 h 46 min, ping 12 ms.",
      "connected": true,
      "since": 1792290000,
      "ping_ms": 12.4,
      "tracked_since": 1790000000000,
      "uptime": {
        "1h": {
          "percent": 100.0,
          "up_ms": 3600000,
          "down_ms": 0,
          "measured_ms": 3600000,
          "reconnects": 0,
          "outages": 0,
          "longest_outage_ms": 0
        },
        "24h": {
          "percent": 99.86,
          "up_ms": 86280000,
          "down_ms": 120000,
          "measured_ms": 86400000,
          "reconnects": 1,
          "outages": 1,
          "longest_outage_ms": 120000
        },
        "7d": {
          "percent": 99.97,
          "up_ms": 604620000,
          "down_ms": 180000,
          "measured_ms": 604800000,
          "reconnects": 3,
          "outages": 2,
          "longest_outage_ms": 120000
        },
        "30d": {
          "percent": 99.95,
          "up_ms": 2590710000,
          "down_ms": 1290000,
          "measured_ms": 2592000000,
          "reconnects": 9,
          "outages": 6,
          "longest_outage_ms": 600000
        }
      },
      "days": [
        {
          "date": "2026-09-19",
          "from": 1789776000000,
          "percent": null,
          "up_ms": 0,
          "down_ms": 0,
          "measured_ms": 0,
          "outages": 0
        },
        {
          "date": "2026-10-18",
          "from": 1792281600000,
          "percent": 99.35,
          "up_ms": 18280000,
          "down_ms": 120000,
          "measured_ms": 18400000,
          "outages": 1
        }
      ],
      "outages": [
        {
          "from": 1792291200000,
          "to": 1792291320000,
          "duration_ms": 120000,
          "ongoing": false,
          "start_estimated": false,
          "detected_at": null,
          "cause": "broker_maintenance",
          "message": "Pepperstone restarted its servers; back after 2 min.",
          "detail": "login refused (code 2) for 1 min after the link dropped"
        },
        {
          "from": 1792199996000,
          "to": 1792200001200,
          "duration_ms": 5200,
          "ongoing": false,
          "start_estimated": false,
          "detected_at": null,
          "cause": "termless_restart",
          "message": "Termless restarted; back after 5 s.",
          "detail": "termlessd stopped (upgrade or restart)"
        }
      ],
      "ticks": {
        "per_min": 384.0,
        "seen": 1234567,
        "last_tick_age_ms": 400,
        "feed_quiet": false,
        "symbols": [
          {
            "symbol": "EURUSD",
            "last_tick_age_ms": 400,
            "market_open": true,
            "fresh": true
          },
          {
            "symbol": "XAUUSD",
            "last_tick_age_ms": 812,
            "market_open": true,
            "fresh": true
          }
        ]
      },
      "orders": {
        "window_h": 24,
        "count": 12,
        "done": 11,
        "rejected": 1,
        "timeout": 0,
        "failed": 0,
        "latency_ms": {
          "p50": 41,
          "p95": 120,
          "max": 133
        }
      },
      "protocol": {
        "build": 6090,
        "build_verified": true,
        "undecoded_1h": 0,
        "undecoded_24h": 0,
        "undecoded_by_command": []
      },
      "pings_missed": 2,
      "trades_unconfirmed": 0,
      "trades_late": 0,
      "command_waits": 1840,
      "command_wait_ms": 3120
    }
  ]
}

AccountHealth

One account in GET /status.

  • id string required

    Account id.

  • label string required

    Display name.

  • server string required

    Trade server name.

  • broker string required

    The server name's first word (Pepperstone-Demo is Pepperstone), used in the sentences.

  • enabled boolean required

    False when an admin turned it off.

  • verdict string required

    down: enabled and not connected. degraded: connected but an unverified build, undecoded frames in the last hour, its price feed stopped (ticks.feed_quiet), ping over 1000 ms, or under 99% up over the last hour. off: turned off. healthy otherwise.

    healthydegradeddownoff
  • summary string required

    One plain sentence for people.

  • connected boolean required

    Whether the link is up now.

  • since integer or null required

    When the current connection came up, unix seconds (UTC).

  • ping_ms number or null required

    Last heartbeat round trip.

  • tracked_since integer or null required

    Where the 30-day numbers start: 30 days ago, or later when the account was added or its connection history starts inside that window; unix milliseconds (UTC); null with no history.

  • uptime object required

    Each window ends now.

    Fields
    • 1h object required

      UptimeWindow fields
      • percent number or null required

        up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

      • up_ms integer required

        Connected.

      • down_ms integer required

        Not connected, Termless's own downtime included.

      • measured_ms integer required

        The window less the time before the account was added (or before its history starts) and the time it was turned off.

      • reconnects integer required

        Links that came back inside the window.

      • outages integer required

        Outages overlapping the window.

      • longest_outage_ms integer required

        The longest of them, clipped to the window.

    • 24h object required

      UptimeWindow fields
      • percent number or null required

        up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

      • up_ms integer required

        Connected.

      • down_ms integer required

        Not connected, Termless's own downtime included.

      • measured_ms integer required

        The window less the time before the account was added (or before its history starts) and the time it was turned off.

      • reconnects integer required

        Links that came back inside the window.

      • outages integer required

        Outages overlapping the window.

      • longest_outage_ms integer required

        The longest of them, clipped to the window.

    • 7d object required

      UptimeWindow fields
      • percent number or null required

        up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

      • up_ms integer required

        Connected.

      • down_ms integer required

        Not connected, Termless's own downtime included.

      • measured_ms integer required

        The window less the time before the account was added (or before its history starts) and the time it was turned off.

      • reconnects integer required

        Links that came back inside the window.

      • outages integer required

        Outages overlapping the window.

      • longest_outage_ms integer required

        The longest of them, clipped to the window.

    • 30d object required

      UptimeWindow fields
      • percent number or null required

        up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

      • up_ms integer required

        Connected.

      • down_ms integer required

        Not connected, Termless's own downtime included.

      • measured_ms integer required

        The window less the time before the account was added (or before its history starts) and the time it was turned off.

      • reconnects integer required

        Links that came back inside the window.

      • outages integer required

        Outages overlapping the window.

      • longest_outage_ms integer required

        The longest of them, clipped to the window.

  • days array of UptimeDay required

    The last 30 UTC days, oldest first; today runs up to now.

    UptimeDay fields
    • date string required

      The UTC day, YYYY-MM-DD.

    • from integer required

      Its 00:00 UTC, unix milliseconds.

    • percent number or null required

      As in a window; null for a day with nothing measured.

    • up_ms integer required

      Connected.

    • down_ms integer required

      Not connected.

    • measured_ms integer required

      Measured time in the day (today: up to now).

    • outages integer required

      Outages overlapping the day.

  • outages array of Outage required

    Newest first: those overlapping the last 30 days, at most 50.

    Outage fields
    • from integer required

      When the link was lost (or Termless stopped), unix milliseconds (UTC).

    • to integer or null required

      When it was connected again; null while it lasts.

    • duration_ms integer required

      to - from, or up to now while it lasts.

    • ongoing boolean required

      True while it lasts.

    • start_estimated boolean required

      True when from is an estimate (0.6.0): a link cut for missed pings is down from its first unanswered ping, 12 to 17 s before the cut.

    • detected_at integer or null required

      When the drop was noticed (the cut), unix milliseconds (UTC), if from is an estimate; else null.

    • cause string required

      broker_maintenance (logins refused with code 2 right after the drop, or the forex weekend break), broker_unreachable (TCP, TLS or the WebSocket upgrade failed or timed out), broker_unresponsive (connected but the broker stopped answering), termless_restart (Termless stopped, restarted, upgraded or was killed, or the account's session started again), network (name lookups failing, no route, connections reset), login_refused (the login details refused), unknown.

      broker_maintenancebroker_unreachablebroker_unresponsivetermless_restartnetworklogin_refusedunknown
    • message string required

      One plain sentence for people.

    • detail string or null required

      The technical reason seen (the lost event's reason, the connect errors).

  • ticks object required

    Fields
    • per_min number or null required

      Ticks over the last minute; null until a minute of samples exists.

    • seen integer required

      Ticks since the session started.

    • last_tick_age_ms integer or null required

      Age of the newest tick of any symbol; null before one.

    • feed_quiet boolean required

      Connected over 120 s and every watched symbol whose market is open has gone 120 s without a tick: the feed stopped while the link stays up. One quiet symbol is the market (since 0.5.1).

    • symbols array of object required

      The watchlist.

      Fields
      • symbol string required

        Symbol name.

      • last_tick_age_ms integer or null required

        Milliseconds since its last tick.

      • market_open boolean or null required

        As in /ready.

      • fresh boolean required

        As in /ready.

  • orders object required

    Fields
    • window_h integer required

      24.

    • count integer required

      Trade requests sent through this server in the window (from the audit trail).

    • done integer required

      The broker executed or placed it.

    • rejected integer required

      The broker refused it (422).

    • timeout integer required

      No answer (504).

    • failed integer required

      Anything else: busy, disconnected, a 502.

    • latency_ms object or null required

      The broker round trip over done and rejected requests; null when there were none.

      Fields
      • p50 integer

        Median.

      • p95 integer

        95th percentile.

      • max integer

        Slowest.

  • pings_missed integer required

    Heartbeat pings the broker did not answer in time since the server started (0.6.0); two in a row cut the link.

  • trades_unconfirmed integer required

    Trades answered 504 unconfirmed since the start (0.6.0).

  • trades_late integer required

    Of them, those whose final result came later (0.6.0).

  • command_waits integer required

    Requests that waited for their command's turn since the start (most wait no time; 0.6.0).

  • command_wait_ms integer required

    The time they waited, in all, in milliseconds (0.6.0).

  • protocol object required

    Fields
    • build integer or null required

      The broker's server build.

    • build_verified boolean required

      A build Termless has been checked against (see /ready).

    • undecoded_1h integer required

      Undecodable frames in the last hour.

    • undecoded_24h integer required

      Undecodable frames in the last 24 hours.

    • undecoded_by_command array of object required

      Last 24 hours, by command.

      Fields
      • command integer required

        Protocol command id.

      • count integer required

        Frames.

Example
{
  "id": "pepperstone-12345678",
  "label": "Pepperstone demo",
  "server": "Pepperstone-Demo",
  "broker": "Pepperstone",
  "enabled": true,
  "verdict": "healthy",
  "summary": "Connected for 2 h 46 min, ping 12 ms.",
  "connected": true,
  "since": 1792290000,
  "ping_ms": 12.4,
  "tracked_since": 1790000000000,
  "uptime": {
    "1h": {
      "percent": 100.0,
      "up_ms": 3600000,
      "down_ms": 0,
      "measured_ms": 3600000,
      "reconnects": 0,
      "outages": 0,
      "longest_outage_ms": 0
    },
    "24h": {
      "percent": 99.86,
      "up_ms": 86280000,
      "down_ms": 120000,
      "measured_ms": 86400000,
      "reconnects": 1,
      "outages": 1,
      "longest_outage_ms": 120000
    },
    "7d": {
      "percent": 99.97,
      "up_ms": 604620000,
      "down_ms": 180000,
      "measured_ms": 604800000,
      "reconnects": 3,
      "outages": 2,
      "longest_outage_ms": 120000
    },
    "30d": {
      "percent": 99.95,
      "up_ms": 2590710000,
      "down_ms": 1290000,
      "measured_ms": 2592000000,
      "reconnects": 9,
      "outages": 6,
      "longest_outage_ms": 600000
    }
  },
  "days": [
    {
      "date": "2026-09-19",
      "from": 1789776000000,
      "percent": null,
      "up_ms": 0,
      "down_ms": 0,
      "measured_ms": 0,
      "outages": 0
    },
    {
      "date": "2026-10-18",
      "from": 1792281600000,
      "percent": 99.35,
      "up_ms": 18280000,
      "down_ms": 120000,
      "measured_ms": 18400000,
      "outages": 1
    }
  ],
  "outages": [
    {
      "from": 1792291200000,
      "to": 1792291320000,
      "duration_ms": 120000,
      "ongoing": false,
      "start_estimated": false,
      "detected_at": null,
      "cause": "broker_maintenance",
      "message": "Pepperstone restarted its servers; back after 2 min.",
      "detail": "login refused (code 2) for 1 min after the link dropped"
    },
    {
      "from": 1792199996000,
      "to": 1792200001200,
      "duration_ms": 5200,
      "ongoing": false,
      "start_estimated": false,
      "detected_at": null,
      "cause": "termless_restart",
      "message": "Termless restarted; back after 5 s.",
      "detail": "termlessd stopped (upgrade or restart)"
    }
  ],
  "ticks": {
    "per_min": 384.0,
    "seen": 1234567,
    "last_tick_age_ms": 400,
    "feed_quiet": false,
    "symbols": [
      {
        "symbol": "EURUSD",
        "last_tick_age_ms": 400,
        "market_open": true,
        "fresh": true
      },
      {
        "symbol": "XAUUSD",
        "last_tick_age_ms": 812,
        "market_open": true,
        "fresh": true
      }
    ]
  },
  "orders": {
    "window_h": 24,
    "count": 12,
    "done": 11,
    "rejected": 1,
    "timeout": 0,
    "failed": 0,
    "latency_ms": {
      "p50": 41,
      "p95": 120,
      "max": 133
    }
  },
  "protocol": {
    "build": 6090,
    "build_verified": true,
    "undecoded_1h": 0,
    "undecoded_24h": 0,
    "undecoded_by_command": []
  },
  "pings_missed": 2,
  "trades_unconfirmed": 0,
  "trades_late": 0,
  "command_waits": 1840,
  "command_wait_ms": 3120
}

UptimeWindow

  • percent number or null required

    up_ms / measured_ms x 100, 2 decimals; null when nothing was measured.

  • up_ms integer required

    Connected.

  • down_ms integer required

    Not connected, Termless's own downtime included.

  • measured_ms integer required

    The window less the time before the account was added (or before its history starts) and the time it was turned off.

  • reconnects integer required

    Links that came back inside the window.

  • outages integer required

    Outages overlapping the window.

  • longest_outage_ms integer required

    The longest of them, clipped to the window.

Example
{
  "percent": 99.86,
  "up_ms": 86280000,
  "down_ms": 120000,
  "measured_ms": 86400000,
  "reconnects": 1,
  "outages": 1,
  "longest_outage_ms": 120000
}

UptimeDay

  • date string required

    The UTC day, YYYY-MM-DD.

  • from integer required

    Its 00:00 UTC, unix milliseconds.

  • percent number or null required

    As in a window; null for a day with nothing measured.

  • up_ms integer required

    Connected.

  • down_ms integer required

    Not connected.

  • measured_ms integer required

    Measured time in the day (today: up to now).

  • outages integer required

    Outages overlapping the day.

Example
{
  "date": "2026-10-18",
  "from": 1792281600000,
  "percent": 99.35,
  "up_ms": 18280000,
  "down_ms": 120000,
  "measured_ms": 18400000,
  "outages": 1
}
Another example
{
  "date": "2026-09-19",
  "from": 1789776000000,
  "percent": null,
  "up_ms": 0,
  "down_ms": 0,
  "measured_ms": 0,
  "outages": 0
}

Outage

  • from integer required

    When the link was lost (or Termless stopped), unix milliseconds (UTC).

  • to integer or null required

    When it was connected again; null while it lasts.

  • duration_ms integer required

    to - from, or up to now while it lasts.

  • ongoing boolean required

    True while it lasts.

  • start_estimated boolean required

    True when from is an estimate (0.6.0): a link cut for missed pings is down from its first unanswered ping, 12 to 17 s before the cut.

  • detected_at integer or null required

    When the drop was noticed (the cut), unix milliseconds (UTC), if from is an estimate; else null.

  • cause string required

    broker_maintenance (logins refused with code 2 right after the drop, or the forex weekend break), broker_unreachable (TCP, TLS or the WebSocket upgrade failed or timed out), broker_unresponsive (connected but the broker stopped answering), termless_restart (Termless stopped, restarted, upgraded or was killed, or the account's session started again), network (name lookups failing, no route, connections reset), login_refused (the login details refused), unknown.

    broker_maintenancebroker_unreachablebroker_unresponsivetermless_restartnetworklogin_refusedunknown
  • message string required

    One plain sentence for people.

  • detail string or null required

    The technical reason seen (the lost event's reason, the connect errors).

Example
{
  "from": 1792291200000,
  "to": 1792291320000,
  "duration_ms": 120000,
  "ongoing": false,
  "start_estimated": false,
  "detected_at": null,
  "cause": "broker_maintenance",
  "message": "Pepperstone restarted its servers; back after 2 min.",
  "detail": "login refused (code 2) for 1 min after the link dropped"
}
Another example
{
  "from": 1792199996000,
  "to": 1792200001200,
  "duration_ms": 5200,
  "ongoing": false,
  "start_estimated": false,
  "detected_at": null,
  "cause": "termless_restart",
  "message": "Termless restarted; back after 5 s.",
  "detail": "termlessd stopped (upgrade or restart)"
}

Gap

Ticks a stream missed (0.7.0): event: gap on SSE, type: gap on the WebSocket. They are never replayed: the broker keeps no tick history.

  • reason string required

    behind: this stream fell behind and kept only the newest tick per symbol; reconnect: the broker link was down; fanout: the account's fan-out fell behind the session.

    behindreconnectfanout
  • symbols array of string required

    behind: the symbols that lost ticks; otherwise every symbol of the stream.

  • dropped integer or null required

    behind: how many ticks this stream lost; null when nobody can count them.

  • from_msc integer required

    behind: the first dropped tick's time; otherwise the last tick this stream got before. Ticks' own clock.

  • to_msc integer required

    behind: the last dropped tick's time; otherwise the first tick after, which follows this event.

  • from_utc_msc integer

    from_msc in UTC; only with the account's clock rule (0.7.1).

  • to_utc_msc integer

    to_msc in UTC; only with the account's clock rule (0.7.1).

  • from_utc_ambiguous boolean

    true when from_msc falls in New York's repeated autumn hour (0.7.1).

  • to_utc_ambiguous boolean

    true when to_msc falls in New York's repeated autumn hour (0.7.1).

Example
{
  "reason": "reconnect",
  "symbols": [
    "XAUUSD"
  ],
  "dropped": null,
  "from_msc": 1790981170212,
  "to_msc": 1790981191408
}

Bar

A bar of a bar series (0.7.0, events=bars): event: bar on SSE, type: bar on the WebSocket.

  • symbol string required

    Symbol name.

  • timeframe string required

    Timeframe.

    M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1
  • time integer required

    Bar open time, unix seconds, trade server clock.

  • open number required

    Open.

  • high number required

    High.

  • low number required

    Low.

  • close number required

    Close.

  • tick_volume integer required

    Tick count in the bar.

  • real_volume integer required

    Exchange volume.

  • state string required

    forming: built from the bids, at most four a second per series; closed: the broker's bar once its period ended (plus 2 s), sent once per period, or later for a period whose tick came late (0.7.1: bars can arrive out of time order, place each by time); corrected: the broker's bar differs from the one sent (read again a minute later, or after the server clock went back).

    formingclosedcorrected
Example
{
  "symbol": "XAUUSD",
  "timeframe": "M1",
  "time": 1790981160,
  "open": 2391.2,
  "high": 2391.9,
  "low": 2391.1,
  "close": 2391.42,
  "tick_volume": 112,
  "real_volume": 0,
  "state": "forming"
}

BarsGap

Bars a series cannot send (0.7.0): over 500 missed during an outage, a stream far behind, or (0.7.1) a bar that could not be read again or a minute of failed reads. Read the range by REST.

  • symbol string required

    Symbol name.

  • timeframe string required

    Timeframe.

    M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1
  • from integer required

    The first missed bar's open time.

  • to integer required

    The last missed bar's open time.

  • from_utc integer

    from in UTC; only with the account's clock rule (0.7.1).

  • to_utc integer

    to in UTC; only with the account's clock rule (0.7.1).

  • from_utc_ambiguous boolean

    true when from falls in New York's repeated autumn hour (0.7.1).

  • to_utc_ambiguous boolean

    true when to falls in New York's repeated autumn hour (0.7.1).

Example
{
  "symbol": "XAUUSD",
  "timeframe": "M1",
  "from": 1790944800,
  "to": 1790981100
}

OverviewAccount

One account: its summary, or why there is none (not connected, for example).

  • id string required

    Account id.

  • summary object

    Summary fields
    • login integer required

      MT5 login number.

    • name string required

      Account holder name at the broker.

    • server string required

      Trade server name.

    • company string required

      Broker company name.

    • currency string required

      Deposit currency.

    • leverage integer required

      Leverage, for example 200 for 1:200.

    • balance number required

      Balance without open positions.

    • credit number required

      Credit from the broker.

    • profit number required

      Floating profit of open positions, live.

    • equity number required

      balance + credit + profit, live.

    • margin number required

      Margin in use, live.

    • margin_free number required

      equity - margin.

    • margin_level number required

      equity / margin x 100, in percent. 0 with no margin in use.

    • margin_so_call number required

      Margin call level.

    • margin_so_so number required

      Stop out level.

    • trade_allowed boolean required

      Whether the broker allows trading on this account.

    • demo boolean required

      True for a demo account.

    • hedging boolean required

      True for a hedging account, false for netting.

    • server_offset integer required

      Trade server clock, in seconds east of UTC. Subtract it from any market or trade time to get UTC. From the account record, read again at least hourly, and checked against live ticks (a tick's server time minus its arrival, to the quarter hour): when they disagree the ticks win while a tick agreed in the last 10 minutes, then the record. It is the offset now; times from before the broker's last summer-time switch were stamped with the old one.

    • positions integer required

      Open positions.

    • orders integer required

      Pending orders.

  • error object

    Fields
    • code string required

      Error code.

    • message string required

      What went wrong.

    • status integer required

      The HTTP status the summary route would answer.

Overview

  • accounts array of OverviewAccount required

    Every enabled account the caller may read.

    OverviewAccount fields
    • id string required

      Account id.

    • summary object

      Summary fields
      • login integer required

        MT5 login number.

      • name string required

        Account holder name at the broker.

      • server string required

        Trade server name.

      • company string required

        Broker company name.

      • currency string required

        Deposit currency.

      • leverage integer required

        Leverage, for example 200 for 1:200.

      • balance number required

        Balance without open positions.

      • credit number required

        Credit from the broker.

      • profit number required

        Floating profit of open positions, live.

      • equity number required

        balance + credit + profit, live.

      • margin number required

        Margin in use, live.

      • margin_free number required

        equity - margin.

      • margin_level number required

        equity / margin x 100, in percent. 0 with no margin in use.

      • margin_so_call number required

        Margin call level.

      • margin_so_so number required

        Stop out level.

      • trade_allowed boolean required

        Whether the broker allows trading on this account.

      • demo boolean required

        True for a demo account.

      • hedging boolean required

        True for a hedging account, false for netting.

      • server_offset integer required

        Trade server clock, in seconds east of UTC. Subtract it from any market or trade time to get UTC. From the account record, read again at least hourly, and checked against live ticks (a tick's server time minus its arrival, to the quarter hour): when they disagree the ticks win while a tick agreed in the last 10 minutes, then the record. It is the offset now; times from before the broker's last summer-time switch were stamped with the old one.

      • positions integer required

        Open positions.

      • orders integer required

        Pending orders.

    • error object

      Fields
      • code string required

        Error code.

      • message string required

        What went wrong.

      • status integer required

        The HTTP status the summary route would answer.

Example
{
  "accounts": [
    {
      "id": "pepperstone-12345678",
      "summary": {
        "login": 12345678,
        "name": "Demo Trader",
        "server": "Pepperstone-Demo",
        "company": "Pepperstone Group Limited",
        "currency": "USD",
        "leverage": 200,
        "balance": 10412.58,
        "credit": 0.0,
        "profit": 238.11,
        "equity": 10650.69,
        "margin": 878.93,
        "margin_free": 9771.76,
        "margin_level": 1211.78,
        "margin_so_call": 100.0,
        "margin_so_so": 50.0,
        "trade_allowed": true,
        "demo": true,
        "hedging": true,
        "server_offset": 10800,
        "positions": 3,
        "orders": 2
      }
    }
  ]
}

StatsDay

  • day string required

    YYYY-MM-DD: the forex day under a clock rule, else the server's date.

  • profit number required

    What the trades closed that day made.

  • trades integer required

    Trades closed that day.

Stats

A trade is a position with a closing deal in the range; its result is every deal of it the history read holds (profit, swap, commission, fee; the read starts 7 days early so an opening commission counts), its time its last closing deal's.

  • trades integer required

    Positions with a closing deal in the range.

  • wins integer required

    Trades that made money.

  • losses integer required

    Trades that lost money.

  • win_rate number or null required

    Percent of trades won; null with no trades.

  • profit_factor number or null required

    What the wins made over what the losses lost; null with no losses.

  • avg_win number or null required

    Per winning trade.

  • avg_loss number or null required

    Per losing trade (negative).

  • gross_profit number required

    What the wins made.

  • gross_loss number required

    What the losses lost (negative).

  • net number required

    The trades' results together.

  • max_drawdown number required

    The largest fall of the closed results from a high, in time order (positive).

  • by_day array of StatsDay required

    Each day with a closed trade, oldest first.

    StatsDay fields
    • day string required

      YYYY-MM-DD: the forex day under a clock rule, else the server's date.

    • profit number required

      What the trades closed that day made.

    • trades integer required

      Trades closed that day.

  • from integer required

    Range start, unix seconds, server time.

  • to integer required

    Range end.

  • from_utc integer

    Range start in UTC; only with the account's clock rule (0.7.1).

  • to_utc integer

    Range end in UTC; only with the account's clock rule (0.7.1).

  • from_utc_ambiguous boolean

    true when from falls in New York's repeated autumn hour (0.7.1).

  • to_utc_ambiguous boolean

    true when to falls in New York's repeated autumn hour (0.7.1).

  • currency string or null required

    The account's currency.

Example
{
  "trades": 5,
  "wins": 3,
  "losses": 2,
  "win_rate": 60.0,
  "profit_factor": 2.02,
  "avg_win": 29.0,
  "avg_loss": -21.5,
  "gross_profit": 87.0,
  "gross_loss": -43.0,
  "net": 44.0,
  "max_drawdown": 32.0,
  "by_day": [
    {
      "day": "2026-11-30",
      "profit": 16.0,
      "trades": 2
    },
    {
      "day": "2026-12-01",
      "profit": 28.0,
      "trades": 3
    }
  ],
  "from": 1793780000,
  "to": 1796372000,
  "currency": "USD"
}

SpecItem

A spec as GET /symbols/{symbol} gives it, plus its name and when it was read; or an error for a name the broker does not know.

spec
  • name string required

    Symbol name.

  • description string required

    Broker's description.

  • path string required

    Folder in the broker's symbol tree.

  • digits integer required

    Price decimals.

  • point number required

    Smallest price step, 10^-digits.

  • contract_size number required

    Units per 1.00 lot.

  • tick_size number required

    Smallest price change. The point when the broker does not send one.

  • tick_value number or null required

    Value of one tick_size move for 1.00 lot, in the account currency. The broker's own figure, else worked out as the terminal does: tick_size x contract_size, converted from currency_profit to the account currency, for forex, CFD, leveraged CFD and exchange stock symbols. null when the broker sends none and it cannot be worked out (futures and index CFDs, or no conversion symbol). Pepperstone sends neither tick value nor tick size.

  • currency_base string required

    Base currency.

  • currency_profit string required

    Profit currency.

  • currency_margin string required

    Margin currency.

  • volume_min number required

    Smallest order, in lots.

  • volume_max number required

    Largest order, in lots.

  • volume_step number required

    Lot step.

  • volume_limit number required

    Largest total of open positions and pending orders in one direction, in lots. 0 = no limit.

  • trade_mode string required

    Whether trading is allowed. unknown only for a value MetaTrader does not define.

    fulllong_onlyshort_onlyclose_onlydisabledunknown
  • execution string required

    Execution mode. unknown only for a value MetaTrader does not define.

    marketinstantrequestexchangeunknown
  • filling array of string required

    Filling modes the symbol allows.

    fokiocreturn
  • stops_level integer required

    Minimum distance of SL and TP from the price, in points.

  • freeze_level integer required

    Distance in points inside which orders cannot be changed.

  • swap_long number required

    Swap for long positions, in the unit swap_mode names.

  • swap_short number required

    Swap for short positions, in the unit swap_mode names.

  • swap_mode string required

    The unit of swap_long and swap_short. unknown only for a value MetaTrader does not define.

    disabledpointssymbol_currencymargin_currencydeposit_currencyinterest_currentinterest_openreopen_currentreopen_bidprofit_currencyunknown
  • swap_3day string or null required

    The day the swap is charged three times: sunday, monday, tuesday, wednesday, thursday, friday or saturday. null for none (crypto CFDs send none).

  • margin_initial number required

    Initial margin setting of the symbol, as the broker sends it.

  • margin_maintenance number required

    Maintenance margin setting, as the broker sends it.

  • margin_hedged number required

    Margin for a hedged pair of positions (one lot each way), as the broker sends it.

  • margin_rate_buy number required

    Initial margin rate for a buy (the same as margin_rates.buy).

  • margin_rate_sell number required

    Initial margin rate for a sell (the same as margin_rates.sell).

  • margin_rates object required

    Every order type's initial margin rate, as the broker sends it. A pending type's rate is what the broker holds while such an order waits: the brokers seen send 0 there (nothing is held), and once the order fills the position needs its side's market rate. A market rate of 0 counts as 1.

    Fields
    • buy number required

      Initial margin rate for a buy.

    • sell number required

      Initial margin rate for a sell.

    • buy_limit number required

      Initial margin rate for a buy limit.

    • sell_limit number required

      Initial margin rate for a sell limit.

    • buy_stop number required

      Initial margin rate for a buy stop.

    • sell_stop number required

      Initial margin rate for a sell stop.

    • buy_stop_limit number required

      Initial margin rate for a buy stop limit.

    • sell_stop_limit number required

      Initial margin rate for a sell stop limit.

  • expiration array of string required

    The expiry modes a pending order on this symbol may use.

    gtcdayspecifiedspecified_day
  • order_types array of string required

    The order types the symbol takes.

    marketlimitstopstop_limitsltpclose_by
  • sessions object required

    Fields
    • quote array of array of array of integer required

      Quote sessions: 7 lists, one per weekday, Sunday first, each a list of [open_min, close_min] in minutes from midnight, trade server time.

    • trade array of array of array of integer required

      Trade sessions, same shape as quote.

  • tradeable boolean or null required

    Whether a trade can be opened now, as on /quotes: the trade_mode is full, long_only or short_only, and one of today's trade sessions is open by the server's clock. null when the broker sent no trade sessions.

  • book_depth integer

    The levels a side of the symbol's order book may hold (0 when the broker sends none); a book past it is renewed (0.7.0).

  • fetched_at_ms integer or null required

    When it was read from the broker, unix ms.

error
  • name string required

    The name as asked.

  • error object required

    Fields
    • code string required

      Error code.

    • message string required

      What went wrong.

CandleBatchRequest

  • items array of object required

    1 to 20 ranges, at most 200,000 bars in all (each item's whole range counts).

    Fields
    • symbol string required

      Symbol name.

    • timeframe string

      Timeframe (default M5).

      M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1
    • from integer required

      Range start, unix seconds, server time.

    • to integer required

      Range end.

Example
{
  "items": [
    {
      "symbol": "XAUUSD",
      "timeframe": "M5",
      "from": 1790894400,
      "to": 1790980800
    },
    {
      "symbol": "EURUSD",
      "timeframe": "H1",
      "from": 1790376000,
      "to": 1790980800
    }
  ]
}

CandleBatchItem

candles
  • symbol string required

    Symbol name, as the broker spells it.

  • timeframe string required

    Timeframe.

    M1M2M3M4M5M6M10M12M15M20M30H1H2H3H4H6H8H12D1W1MN1
  • from integer required

    As asked.

  • to integer required

    As asked.

  • truncated boolean required

    The range held more than 50,000 bars; the newest are kept.

  • candles array of Candle required

    Bars, oldest first.

    Candle fields
    • time integer required

      Bar open time, unix seconds, trade server clock.

    • open number required

      Open.

    • high number required

      High.

    • low number required

      Low.

    • close number required

      Close.

    • tick_volume integer required

      Tick count in the bar.

    • real_volume integer required

      Exchange volume. 0 for most CFD symbols.

    • spread integer required

      Always 0: the web protocol's bars carry no spread (MetaTrader builds bars from the bid).

    • complete boolean required

      The bar has closed, by the server's clock (a month bar closes at the next month's start). The newest bar is usually still forming, but at a weekend or a daily break it may be closed too: read this rather than dropping the last bar.

    • time_utc integer

      Bar open time in UTC, unix seconds; only with the account's clock rule (0.7.0).

    • time_utc_ambiguous boolean

      true when the time falls in New York's repeated autumn hour (0.7.0).

error
  • symbol string required

    The name as asked.

  • timeframe string required

    Timeframe.

  • from integer required

    As asked.

  • to integer required

    As asked.

  • error object required

    Fields
    • code string required

      Error code.

    • message string required

      What went wrong.

    • status integer required

      The HTTP status a single read would answer.

CandleBatch

  • items array of CandleBatchItem required

    One per range asked, in order.

    See CandleBatchItem.