An account's full deal history
Request
Synthetic example for the production API. Replace YOUR_API_KEY and the ids. Do not send it against a live account until you mean to.
curl -X GET "https://api.fxapis.com/v1/accounts/ACCOUNT_ID/deals" \
-H "Authorization: Bearer YOUR_API_KEY"Everything the broker recorded against this account, including deals no order of yours caused — a stop loss firing, a swap charge, a deposit, or somebody trading the same login from the MetaTrader desktop.
That inclusion is the point. A history containing only your own orders would show an account whose balance moves for no visible reason. Ordered by the broker's timestamp, not ours.
Authorization
apiKey Authorization: Bearer fx_live_<id>_<secret>.
A key is shown once, at creation. We cannot show it again or recover it for you.
Keys carry a label (live or test) in the key itself, so each configuration is easy to tell
apart. Both reach real brokers: test with a broker demo account.
Scopes are per key. A key without accounts:write can read accounts and nothing else.
In: header
Path Parameters
uuidQuery Parameters
Only deals on this symbol, as the broker names it.
length <= 32Deals at or after this time (the broker's timestamp).
date-timeDeals at or before this time.
date-time1 <= value <= 20050The nextCursor from the previous page.
Response Body
application/json
application/json
application/json
curl -X GET "https://api.fxapis.com/v1/accounts/497f6eca-6276-4993-bfeb-53cbbbba6f08/deals"{ "data": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "accountId": "3d07c219-0a88-45be-9cfc-91e9d095a1e9", "orderId": null, "brokerDealId": "string", "brokerOrderId": null, "brokerPositionId": null, "symbol": "string", "dealType": "string", "entry": null, "volume": null, "price": null, "commission": null, "swap": null, "profit": null, "fee": null, "dealtAt": "2019-08-24T14:15:22Z", "comment": null } ], "page": { "hasMore": true, "nextCursor": null }}Price history (candles) from the account's broker GET
Open, high, low and close bars for one symbol or instrument, read from the account's own MetaTrader terminal: `timeframe` M1, M5, M15, M30, H1, H4, D1, W1 or MN1, and up to 1,000 bars (`count`, default 100) counting back from the current one, oldest first; the last bar is still forming. Times are when each bar opened, in UTC (converted with the broker's current clock offset, so bars from before its last daylight-saving change can be an hour out). `tickVolume` counts price changes, not traded volume. The account must be online (409 `ACCOUNT_NOT_READY` otherwise). Each call reaches the terminal and is charged to the account's live budget (300 a minute + 50, shared with quotes and fresh figures); past it this answers 429 `RATE_LIMITED` with `retry-after`. An account whose terminal is not yet updated — rare — answers 501 `CAPABILITY_UNAVAILABLE` instead.
Deals produced by one order GET
One order can produce several deals — a partial fill leaves more than one. These are the broker's own records of money changing hands, which is what a statement is reconciled against.