> ## Documentation Index
> Fetch the complete documentation index at: https://hypernova.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Trades and funding

> ListTrades and ListFundingPayments - page through every fill on an account and every funding settlement on its positions.

Both take `{ "accountId": "…", "symbol": "BTC", "window": { "from": "…", "to": "…" }, "limit": 100, "offset": 0 }`.
Only `accountId` is required; `window`, `limit` and `offset` work as in [Paging](https://hypernova.xyz/docs/api/conventions.md#paging).

## ListTrades

`ListTrades` · **read key**

The account's fills, newest first, with `window` applied to `executedAt`. A trade is one fill of one order.

| Field | Type | Description |
| - | - | - |
| `tradeId` | string | Fill id. |
| `orderId` | string | The order that filled, found in [ListOrderHistory](https://hypernova.xyz/docs/api/orders.md#listorderhistory). |
| `symbol`, `side` | string, OrderSide | Market and side. |
| `direction` | TradeDirection | Whether the fill opened or closed a long or short. |
| `quantity`, `price` | decimal | Filled size and price. |
| `fee` | decimal | Positive is a fee charged. |
| `realizedPnl` *optional* | decimal | Set only on fills that reduce or close a position. |
| `allocatedFunding` | decimal | Funding attributed at close, positive received; `"0"` on opening fills. See [Funding timing](#funding-timing). |
| `executedAt` | timestamp | When the fill happened. |
| `positionId` *optional* | string | The position the fill opened, added to, reduced or closed. |

```json theme={null}
{ "trades": [{ "tradeId": "019f3df4-b220-731f-ba61-c1424e797bfb", "orderId": "019f3df4-b220-7314-86e0-cab3e7283631", "symbol": "BTC", "side": "ORDER_SIDE_SELL", "direction": "TRADE_DIRECTION_CLOSE_LONG", "quantity": "0.1", "price": "100200", "fee": "5.01", "realizedPnl": "220", "allocatedFunding": "-1.1", "executedAt": "2026-10-14T05:12:08.401925Z", "positionId": "019f8b1c-0d2e-7f31-a4b5-c6d7e8f90a1b" }], "hasMore": true }
```

* `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](https://hypernova.xyz/docs/api/streaming.md) 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.

| Field | Type | Description |
| - | - | - |
| `paymentId` | string | Payment id. |
| `positionId` | string | The position it settled on. |
| `symbol` | string | Market symbol. |
| `fundingTime` | timestamp | The funding hour it settles. |
| `fundingRate` | decimal | The rate applied. |
| `payment` | decimal | Positive when the position received funding, negative when it paid. |
| `positionNotional` | decimal | The position's size at the oracle price when funding settled, in USD. |

```json theme={null}
{ "payments": [{ "paymentId": "019f7b21-3c40-7d1e-8a2f-6b9c0d1e2f30", "positionId": "019f7a90-1e22-7c4d-9b1a-3d4e5f607182", "symbol": "BTC", "fundingTime": "2026-10-14T08:00:00Z", "fundingRate": "0.0000125", "payment": "-0.75", "positionNotional": "60000" }], "hasMore": false }
```

### 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](https://hypernova.xyz/docs/trading-fees.md) for how funding is charged.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.