Manager API
The Manager API reports the accounts, positions and transactions of the trading engine to systems that manage them, such as a CRM, a risk tool or a data warehouse. The admin portal uses it as well. It only reads. Deposits, withdrawals and changes to accounts go through the CRM API.
It has two parts on the gateway host, both under /manager:
| Part | Use |
|---|---|
wss://<gateway host>/manager/ws | A WebSocket stream of changes as they happen, which can be resumed after a disconnect |
GET https://<gateway host>/manager/positions, /manager/accounts, /manager/transactions | Lists, for the first load and for anything older than the stream keeps |
No other path of the engine is reachable under /manager.
Authentication
An integration gets a client id and a client secret from wintrado. With them it requests a token from the CRM, using the client-credentials grant of OAuth 2:
curl https://<cashier host>/api/oauth/token \
-d grant_type=client_credentials \
-d client_id=manager-4f1c2a9b7d3e6a10 \
-d client_secret=<client secret>
The credentials can also be sent with HTTP Basic authentication instead of the two fields.
{
"access_token": "<token>",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "manager-read"
}
A token is valid for one hour. Request a new one before it expires. There is no refresh token.
| Scope | Grants |
|---|---|
manager-read | The lists, and every topic of the stream |
market-data | The topic price only |
A client has one or both scopes. The optional field scope of the token request narrows a token to some of them. A client is valid either for all accounts or for the accounts of certain groups, and its tokens show the same accounts.
A wrong client id or secret, or a disabled client, is answered with status 401 and {"error": "invalid_client"}. A scope the client does not have is answered with status 400 and {"error": "invalid_scope"}.
Disabling a client stops it from getting new tokens. A token it already has stays valid until it expires.
Clients are managed by an admin of the CRM with the permission to manage general settings, through /api/admin/manager-clients of the CRM API. The secret is shown once, when the client is created.
Session tokens of admins, sales agents and group admins of the CRM are accepted too. This is how the admin portal uses the API.
A manager token is not accepted by the Trader API or the CRM API.
Lists
Send the token as Authorization: Bearer <token>.
curl -H "Authorization: Bearer <token>" \
"https://<gateway host>/manager/transactions?modifiedSince=2026-03-01T00:00:00Z&limit=1000"
| Endpoint | Returns | Query parameters |
|---|---|---|
GET /manager/accounts | accounts, count | modifiedSince, accountIds[], limit, offset, sortBy, sortDir |
GET /manager/positions | positions, count | modifiedSince, accountId, statuses[], symbols[], side, from, to, limit, offset |
GET /manager/transactions | transactions, count | modifiedSince, limit, offset |
modifiedSince is an RFC 3339 time. The list then only holds what changed after it. For accounts, a transaction counts as a change.
limit of positions and transactions is 10000 at most, which is also the default. count is the number of entries that match, regardless of limit and offset.
Amounts and prices are decimal strings.
{
"count": 1,
"transactions": [
{
"id": 104,
"type": "balance",
"accountId": 30,
"balance": "250",
"closingBalance": "250",
"credit": "0",
"closingCredit": "0",
"comment": "DEPOSIT 5d1c",
"createdAt": "2026-03-02T14:45:30.598282Z",
"currency": "USD",
"idempotencyKey": "deposit-5d1c"
}
]
}
| Status | Meaning |
|---|---|
| 401 | The token is missing, invalid or expired |
| 403 | The token is for prices only, or for no group |
| 404 | The path is not one of the three lists |
| 405 | The method is not GET |
Stream
A consumer subscribes to topics and receives their messages as JSON over the open connection. One connection can subscribe to several topics by sending several Subscribe messages.
| Topic | Events | Values that follow the market |
|---|---|---|
positions | PositionOpened, PositionUpdated, PositionClosed | PositionStatus |
accounts | AccountCreated, AccountUpdated | AccountStatus |
transactions | TransactionCreated | |
price | PriceUpdate |
The two kinds of messages differ:
- An event is a committed change in the engine. It has a
seq, is sent once and in order, and can be read again after a disconnect. - A value that follows the market is sent as it changes and is replaced by the next one. It has no
seqand is not repeated.
Subscribing
{
"messageType": "Subscribe",
"topic": "positions",
"auth": "<token>",
"after": 48211,
"snapshot": false,
"floating": true,
"accountIds": [123, 456]
}
topic and auth are required. The other fields are optional:
| Field | Default | Meaning |
|---|---|---|
after | Send the events with a higher seq first, then continue with new ones | |
snapshot | false | Send the current state first, then the events after it. For positions these are the open positions, for accounts all accounts. Not available for transactions, and not together with after |
floating | true | Set to false to leave out PositionStatus and AccountStatus and receive events only |
accountIds | Only messages about these accounts, 1 to 1000 ids |
The stream answers once the subscription is live. seq is the last event before it. Everything requested with after or snapshot is sent before this message, new events after it.
{ "messageType": "Subscribed", "topic": "positions", "seq": 48215 }
Subscribing to a topic again replaces the subscription.
The token sent with the most recent Subscribe applies to all subscriptions of the connection. When it expires, the stream closes the connection. To keep a connection open for longer than a token is valid, subscribe again with a new token and after before the old one expires.
Events
Every event has the same envelope and carries the whole stored state after the change, not what changed.
| Field | Meaning |
|---|---|
messageType | The type of the event |
seq | The position of the event in the record of the engine. It grows with every event of any type, so a consumer sees gaps in it |
eventId | A unique id of the event |
accountId | The account the event is about |
occurredAt | When the change was committed |
origin | On transaction and account events: what the caller named itself, or wintrado.com/positions for changes the engine made on its own. Left out when neither applies |
position, transaction or account | The state after the change |
Amounts and prices are decimal strings. Times are RFC 3339. A field without a value is left out.
{
"messageType": "PositionClosed",
"seq": 48216,
"eventId": "5f0c1a52-0d3e-4c53-9a37-3d2f3f1f6a10",
"accountId": 42,
"occurredAt": "2026-03-03T10:00:00.503Z",
"position": {
"id": 7001,
"accountId": 42,
"version": 4,
"symbol": "EURUSD",
"side": "buy",
"size": "100000",
"status": "closed",
"platform": "pro",
"openPrice": "1.08512",
"openedAt": "2026-03-02T09:15:30.123Z",
"closePrice": "1.09012",
"closedAt": "2026-03-03T10:00:00.500Z",
"closeReason": "take_profit",
"closedPL": "500",
"closedPLInAccountCurrency": "500",
"marginRate": "1.08512",
"swap": "0.35",
"commission": "7",
"updatedAt": "2026-03-03T10:00:00.502Z"
}
}
A position can also have stopLoss, takeProfit, trailingStopLossPct, invest, closePositionAfterSeconds and expiresAt. closeReason is one of user_requested, admin_requested, account_disabled, time_expired, stop_loss, stop_out, take_profit and invest. version grows by one with each event of the position.
{
"messageType": "TransactionCreated",
"seq": 48217,
"eventId": "1a1dd33f-9e42-4700-aa49-7aeb0a2080ef",
"accountId": 42,
"occurredAt": "2026-03-03T10:00:00.503Z",
"origin": "wintrado.com/positions",
"transaction": {
"id": 502,
"accountId": 42,
"type": "order",
"balance": "492.65",
"credit": "-10",
"closingBalance": "1743.15",
"closingCredit": "90",
"currency": "USD",
"comment": "",
"positionId": 7001,
"tradeId": 8002,
"createdAt": "2026-03-03T10:00:00.500Z"
}
}
type is balance for a deposit or a withdrawal and order for a closed position. The other types are order_correction, commission, negative_balance_protection, credit_removal and credit_expired. balance and credit are the amounts of the transaction, closingBalance and closingCredit the values of the account after it. A transaction booked with an idempotency key has it as idempotencyKey.
{
"messageType": "AccountUpdated",
"seq": 48218,
"eventId": "7968c138-2f0b-4f0e-9d0a-51d6a3a7c1e2",
"accountId": 42,
"occurredAt": "2026-03-04T12:00:00.004Z",
"origin": "wintrado.com/cashier",
"account": {
"id": 42,
"version": 5,
"tradingType": "HEDGING",
"accountType": "REGULAR",
"group": "LIVE-USD",
"currency": "USD",
"leverage": 30,
"isDemo": false,
"enabled": false,
"disableReason": "admin_requested",
"userTradingEnabled": true,
"pendingWithdrawal": "0",
"createdAt": "2026-03-01T08:00:00Z",
"updatedAt": "2026-03-04T12:00:00Z"
}
}
Account events carry neither balances, which only change with a transaction, nor the personal details of the holder.
Snapshots
With snapshot set, the current state is sent in one or more Snapshot messages of up to 500 entries. The last one has complete set to true. seq is the last event the state includes, and the events after it follow.
{
"messageType": "Snapshot",
"topic": "accounts",
"seq": 48215,
"accounts": [
{
"id": 42,
"version": 4,
"tradingType": "HEDGING",
"accountType": "REGULAR",
"group": "LIVE-USD",
"currency": "USD",
"leverage": 100,
"isDemo": false,
"enabled": true,
"userTradingEnabled": true,
"pendingWithdrawal": "0",
"createdAt": "2026-03-01T08:00:00Z",
"updatedAt": "2026-03-01T08:00:00Z",
"balance": "1250.5",
"credit": "100"
}
],
"complete": true
}
An account of a snapshot has its balance and credit in addition to the fields of an account event. A snapshot of positions has the open positions under positions, with the fields of a position event.
Resuming after a disconnect
Keep the seq of the last event you processed, per topic. After a disconnect, subscribe with after set to it. The stream sends the events you missed, each once and in order, and then continues with new ones.
Events are kept for 7 days. If after is older, the subscription is answered with the error EVENTS_NO_LONGER_KEPT. Load what changed from the lists with modifiedSince, or subscribe with snapshot, and continue from there.
Values that follow the market
PositionStatus is sent when the profit or loss of an open position changes. Its amounts are numbers, and a value that is not reported is left out.
{ "messageType": "PositionStatus", "positionId": 7001, "accountId": 42, "symbol": "EURUSD", "profitLoss": 12.3, "margin": 271.28, "swap": -0.42 }
AccountStatus is sent when a value of the account such as margin or equity changes. marginCall is true while the account is in a margin call.
{ "messageType": "AccountStatus", "accountId": 42, "balance": "1250.5", "credit": "100", "equity": "1262.8", "margin": "271.28", "marginFree": "991.52", "marginCall": false, "profitLoss": "12.3" }
Prices
The topic price has the current price of every symbol, without the markup of a group. A symbol gets a new price at most once per second. The topic needs a token like the others, and has no optional fields.
{ "messageType": "Subscribe", "topic": "price", "auth": "<token>" }
{ "messageType": "PriceUpdate", "symbol": "EURUSD", "ask": 1.08514, "bid": 1.08511 }
Unsubscribing
{ "messageType": "Unsubscribe", "topic": "positions" }
Keeping the connection open
The stream answers a Ping message with a Pong message.
{ "messageType": "Ping" }
Errors
{ "messageType": "Error", "code": "EVENTS_NO_LONGER_KEPT", "error": "the events after 12 are no longer kept", "topic": "positions" }
A subscription that is not accepted is answered with one of these codes. The connection and its other subscriptions stay open.
| Code | Meaning |
|---|---|
UNKNOWN_TOPIC | There is no such topic |
FORBIDDEN | The token is for prices only |
INVALID_SUBSCRIPTION | An optional field has a value that cannot be used |
EVENTS_NO_LONGER_KEPT | The events after after are older than 7 days |
SEQ_AHEAD | after is higher than the latest event |
UNAVAILABLE | The events cannot be read at the moment. Subscribe again after a short wait |
With these, the stream closes the connection after the Error message:
| Close code | Code | Meaning |
|---|---|---|
| 4001 | ERROR_MALFORMED_JSON | A message was not valid JSON |
| 4002 | UNAUTHENTICATED | The token is missing, invalid or not allowed to use the stream |
| 4002 | TOKEN_EXPIRED | The token expired |
| 1012 | LOG_RESTARTED | The record of events was replaced, for example by a restored backup. A seq from before no longer points to the same event. Load the current state again and subscribe without after |
A consumer that does not read its messages fast enough is disconnected.
During a deploy the server closes connections with code 1012 and the reason SERVICE_RESTART, without an Error message. Reconnect after a short random wait and subscribe with after set to the last seq you received. Tell this apart from LOG_RESTARTED by the close reason.