Skip to main content
Both take { "accountId": "…", "symbol": "BTC", "window": { "from": "…", "to": "…" }, "limit": 100, "offset": 0 }. Only accountId is required; window, limit and offset work as in Paging.

ListTrades

ListTrades · read key The account’s fills, newest first, with window applied to executedAt. A trade is one fill of one order.
  • price and fee carry at most 8 decimal places.
  • positionId is the id GetAccountSnapshot and ListFundingPayments show, kept for the position’s whole life, so the trades sharing it are the position’s full round trip.
  • A fill that reverses a position is two trades on one orderId: the closing trade carries the old position’s id, the opening trade the new one’s.
  • Each pair-trade leg carries its own leg’s position. Closes from ClosePosition and CloseAllPositions, closes the platform makes on a rule breach, and the settlement of a delisted market each carry the position they closed.
  • positionId is absent only on fills recorded before trades carried their position.

Polling for new trades

The real-time stream sends fills as they happen. Poll when you are not on it, or to backfill when its ready event says tradesComplete is false. Keep, for each account, the window.to of the last poll that completed every page, and start the next poll two minutes before it.
  • Start from that completed window, never from the newest executedAt you hold. The stream or a partial replay can deliver a fill that is newer than one you have not seen, and a from just before the newer one skips the older for good.
  • A trade can be listed a moment after one with a later executedAt, which is what the two-minute overlap covers.
  • Keep window.from and window.to unchanged across every page of one poll, fetch another page after every full one, and move the saved window only once the poll completes.
  • De-duplicate on tradeId, because every poll returns the overlap again.
  • When the poll is a backfill for the stream, finish it for every account before you save that ready event’s resumeToken.

ListFundingPayments

ListFundingPayments · read key The account’s funding payments, newest first, with window applied to fundingTime. A payment is one funding settlement on one open position.

Funding timing

A position open at fundingTime is eligible for that hour’s funding, and a payment is usually booked about 7 minutes later, once the hour’s rate has settled, or later if the rate is late. An eligible position can also get no payment at all for an hour, as on a market exempt from funding, so never wait for a row: sum the payments that are booked. A position closed in that window gets the hour’s payment after its close, so the closing trade’s allocatedFunding leaves it out, but the payment still reaches the balance and is listed here. Summing payment by positionId therefore gives a position’s exact funding, which summing its trades’ allocatedFunding may not. See Trading Fees for how funding is charged.