Health
How Tickwire decides whether an account is working.
A running terminal isn’t necessarily a working one. A terminal can be alive while logged out, stuck on a dialog, or connected to a broker whose price feed has stopped. So Tickwire measures health from work that succeeded, using three independent signals:
- Broker link: the connection state the terminal itself reports.
- Account reads: when we last read the account successfully. That shows the broker is answering, not just that a socket is open.
- Price movement: whether any symbol in the terminal’s Market Watch has a new price.
The ladder
| Status | Meaning | What to do |
|---|---|---|
healthy | Connected, the account is readable, and prices are moving (prices_live true, or null just after start) | Nothing |
degraded | Connected and readable, but no Market Watch price has moved for 30 s (prices_live false). reason_codes holds prices_stale | The market is likely closed, or the broker’s feed paused. Reads work; new market orders are refused with quote_stale (see below) |
disconnected | Terminal up, but no broker link, or no account read in the last 60 s, or still reconciling after a restart (reconciling is true) | Usually the broker. We reconnect automatically and escalate if it persists. After a restart it clears once positions and orders are read again |
down | We can’t read the terminal at all, or the account isn’t running | A running account: ours to fix, and you’ll get a webhook. An account that isn’t running: reason_code says why (see below) |
A health snapshot
curl -s https://api.tickwire.io/users/current/accounts/acc_7Qx/health -H "auth-token: $TW_KEY"
{
"status": "healthy",
"connected": true,
"read_only": false,
"trading_enabled": true,
"reasons": [],
"last_account_read_age_s": 2.1,
"last_tick_age_s": 0.4,
"last_action_age_s": 812.0,
"prices_live": true,
"last_price_at": "2026-09-23T11:02:12.6Z",
"last_price_symbol": "EURUSD",
"last_price_age_s": 0.4,
"symbols_checked": 14,
"prices_reason": null,
"broker_time": "2026-09-23 14:02:11.480",
"broker_utc_offset_minutes": 180,
"checked_at": "2026-09-23T11:02:13Z",
"reconciling": false,
"restart_recovery": {
"reconciled": true,
"reconciled_at": "2026-09-23T08:15:40Z",
"durable_idempotency": true,
"durable_idempotency_error": null,
"last_error": null,
"unknown_outcomes": []
}
}
- The HTTP status is
200while the account ishealthyordegraded, and503otherwise. The body is the same either way, so you can read why. A monitor that only checks the status code sees a quiet market as200: readstatusto telldegradedfromhealthy. trading_enabledis true only if an order could be accepted right now: connected, not an investor login, and trading switched on in the terminal.reasonsexplains any status other thanhealthyin plain words.reason_codesgives stable codes to branch on:prices_stalewhen prices are not moving.reconcilingis true after the terminal restarts, until positions and orders have been read again. Until then the status isdisconnectedand the first reason starts “reconciling after restart”.restart_recoveryshows that state, and lists any order whose outcome wasunknownwhen the restart happened.restart_recovery.unknown_outcomesalso lists orders whose outcome becameunknownwhile running, for example a lost broker reply (sandbox login1032). These entries havesource: "while_running"; ones left by a restart havesource: "restart". A call sent without anIdempotency-Keyis listed too, withidempotency_key: nulland aref. They don’t changestatus. On the next connected check Tickwire reads positions and orders and adds the matching ones asevidence, withreconciled_at. An entry stays listed until it expires (24 hours), because its outcome staysunknown.broker_timeis the time on the broker’s clock, asYYYY-MM-DD HH:mm:ss.SSS. It has no offset. It is not UTC.broker_utc_offset_minutesis how far the broker’s clock is east of UTC, in minutes.180means UTC+3, and a negative number means west of UTC. It isnullwhen the offset is not known. Tickwire never guesses it.- The ages let you apply your own, stricter thresholds.
last_tick_age_sis the age of the account’s reference symbol (EURUSD where the broker has it);last_price_age_sis the age of the newest price in the whole Market Watch. - A quote older than four days never counts as a live price. Some brokers serve a cached quote from years ago right after login.
When prices stop moving
The account is still connected and readable, but its status is degraded, with reason code
prices_stale. It is not down, and no disconnect alert fires, because the broker link is up.
A market order at a price that is not moving could fill far from what you saw, so Tickwire
refuses it (below).
- The terminal checks every symbol in its Market Watch (up to 64), not one pair. A price counts as moving when the symbol’s tick time goes forward.
prices_liveistruewhen some symbol moved in the last 30 s,falsewhen none did, andnullwhile it can’t tell yet (just after start, or when the check failed).- When it is
false,prices_reasonsays so in plain words, for example: “Connected. No price has changed in any of the 14 Market Watch symbols for 12 min. The market is likely closed, or the broker’s feed has paused.” - There is no calendar. Tickwire does not guess from the day or the time whether a market is open:
a crypto symbol trading on a Saturday makes
prices_livetrue, and a frozen feed on a Wednesday makes it false. - On
/users/current/…,healthStatuscarries the same fields as one object:{connected, connectedToBroker, quoteStreamingHealthy, synchronized, healthy, message, pricesLive, lastPriceAt, lastPriceSymbol, symbolsChecked}. The dashboard shows “Connected · no live prices (market likely closed)”. - On
/users/current/…,healthStatus.healthyisfalsewhile prices are stale, andhealthStatus.statusisdegradedwithreasonCodes: ["prices_stale"].connectedToBrokerstaystrue.
Market orders at a stale quote
A new market order (buy or sell at market) is checked against a fresh quote for its symbol before anything is sent. It is refused when:
- no Market Watch price has moved for 30 s (
prices_livefalse), or - this symbol’s price has not changed for 5 minutes while we watched it, or
- the symbol’s quote is days old (a cached quote, as some brokers serve after login).
The answer is HTTP 409 with sent: false. Nothing reached the broker, and the idempotency key is
freed, so you can send the same request again with the same key once prices move.
{
"error": "quote_stale",
"message": "Connected. No price has changed in any of the 14 Market Watch symbols for 12 min. ... Nothing was sent. Retry when prices move, or set allowStaleQuote: true to send it anyway.",
"sent": false,
"symbol": "EURUSD",
"staleScope": "account",
"quietSeconds": 720.0
}
staleScope is account, symbol or cached. On /users/current/…/trade the body follows that
surface’s error shape: error is ConflictError and code is quote_stale, with the same fields.
- Why 409, not 503: the service works and the request is valid, but it conflicts with the market’s state right now. Many HTTP clients retry a 503 on their own, which could fill the order minutes later at a price nobody chose.
- To send it anyway, add
allowStaleQuote: trueto the order (allow_stale_quotealso works on the/mt5/{id}/…and/mt4/{id}/…routes). The broker then decides, and on a closed market it rejects the order itself. - Never refused for a stale quote: closing a position (full, partial, close-by, close all), pending orders (they fill later, at their own price), and changes to SL/TP or pending orders.
- A symbol seen for the first time is never refused: there is no evidence yet.
Accounts that aren’t running
An account can exist without a terminal: its deploy failed (for example the broker asked for a
one-time password), or you undeployed it. There is nothing to measure, but the answer is still
known, so health says so instead of returning 404:
curl -s https://api.tickwire.io/users/current/accounts/acc_7Qx/health -H "auth-token: $TW_KEY"
{
"status": "down",
"connected": false,
"read_only": null,
"trading_enabled": false,
"reasons": ["account is not running (state DEPLOY_FAILED)",
"ERR_OTP_REQUIRED: the broker asks for a one-time password"],
"last_account_read_age_s": null,
"last_tick_age_s": null,
"last_action_age_s": null,
"broker_time": null,
"checked_at": "2026-09-23T11:02:13Z",
"fx_status": "error",
"deployed": false,
"state": "DEPLOY_FAILED",
"reason_code": "ERR_OTP_REQUIRED",
"error": "ERR_OTP_REQUIRED: the broker asks for a one-time password"
}
- The answer is
200, not503. The state is known, and the body says why the account isn’t running.stateis the account’s lifecycle state, andreason_codethe code at the start of its error (ERR_OTP_REQUIRED,E_AUTH, …), ornullwhen the error has no code or there is none.erroris the same text ashealth.erroron the account object. - Anything we can’t know without a terminal, such as
read_onlyand the ages, isnull. - The terminal routes match:
GET /mt5/{id}/status(and/mt4/…) is200withstatus: "down"plusdeployed,state,reasonCodeanderror;/healthzand/livezare503. - Agents:
GET /v1/agent/accounts/{id}/healthsaysdisconnected, withstateandreason_codein itsevidence. - An account that is still deploying answers
503account_deployingwithRetry-After: it may be up in a moment. An account that doesn’t exist, isn’t yours, or isn’t covered by your key is404account_not_found. All three give the same answer, so account ids can’t be probed. - Other data and trade calls on an account that isn’t running are
409account_not_deployed(ConflictErroron/users/current/…), with the samestateandreasonCode. Fix the cause and redeploy it.
How it reaches you
- Polling:
GET …/health, as above. - Streaming:
healthandbrokerConnectionStatusframes on the account stream. - Webhooks:
account.health_changedon every transition, within 60 seconds. See Webhooks. /users/current/…fields:connectionStatuson the account isCONNECTEDonly when health ishealthyand the broker link is up; otherwiseDISCONNECTED_FROM_BROKERorDISCONNECTED./v1and terminal-route fields:statusmapshealthytoconnected,disconnectedtodisconnected, anddowntoerror.
Account snapshot
GET /users/current/accounts/{id}/snapshot (agents: GET /v1/agent/accounts/{id}/snapshot) returns
everything needed to rebuild your picture of an MT4 or MT5 account in one call: account information,
open positions, pending orders, health and the broker’s server time.
{
"account_id": "acc_7Qx", "platform": "mt5",
"as_of": "2026-09-23T11:02:13.412Z", "complete": true, "terminal_connected": true,
"account_information": { "status": "ok", "read_at": "2026-09-23T11:02:13.380Z", "age_ms": 32, "data": { "balance": 10000, "equity": 10012.5 } },
"positions": { "status": "ok", "read_at": "…", "age_ms": 25, "data": [] },
"orders": { "status": "ok", "read_at": "…", "age_ms": 18, "data": [] },
"health": { "status": "ok", "read_at": "…", "age_ms": 9, "data": { "status": "healthy" } },
"server_time": { "status": "ok", "read_at": "…", "age_ms": 2,
"data": { "time": "2026-09-23T11:02:13.410Z", "brokerTime": "2026-09-23 14:02:13.410", "brokerUtcOffsetMinutes": 180 } }
}
- Each section has its own
status:ok(read from a terminal connected to its broker),stale(read, but the terminal was not connected, so values may be out of date) orunavailable(the read failed;dataisnullanderrorsays why).completeistrueonly when every section isok. read_atandage_msshow how fresh each section is. Sections are read one after another, not atomically.datauses the same shapes as the individual routes.brokerUtcOffsetMinutesis explicit and isnulluntil measured; broker time is never assumed to be UTC.- The answer is
200whenever anything could be read, and503only when no section could be.
Missing data shows as unknown
If a measurement is missing, the answer is unknown. The status page works the same way: a component without a recent check shows as unknown.