MarketDataService
Get Trades
Retrieve recent public trades for a spot symbol, ordered newest first. Supports optional aggressor side, inclusive time-range, and opaque page-token pagination filters. With afterTradeId, walks the symbol's trades by trade identifier, oldest first and gap-free, to backfill trades missed on a live stream.
Request
curl --request GET \ \ --url 'https://api.testnet.polyester.com/v1/spot/markets/BTC-USDT/trades?limit=100' \ --header 'Accept: */*'
Responses
{
"completeThroughTradeId": "1",
"epochEnds": [
{
"epoch": "1",
"lastTradeId": "1"
}
],
"nextAfterTradeId": "1",
"nextPageToken": "eyJvZmZzZXQiOjIwMH0",
"trades": [
{
"executedAt": "2025-01-01T00:00:00Z",
"matchId": "100001",
"price": "61000.25",
"qty": "0.001",
"side": "BUY",
"symbol": "BTC-USDT"
}
]
}Trading pair symbol, e.g. BTC-USDT
Exclusive trade-identifier cursor (unsigned 64-bit decimal string) for gap-free backfill: returns trades with matchId above it, ascending, up to completeThroughTradeId. Use 0 to start from the first trade, then nextAfterTradeId. Cannot be combined with side, startTime, endTime or pageToken.
Filter trades executed at or before this time (inclusive, RFC3339)
Maximum trades to return. Default 100, max 1000.
Opaque cursor from the previous response.
Filter by aggressor side. BUY means the taker bought the base asset; SELL means the taker sold the base asset.
Filter trades executed at or after this time (inclusive, RFC3339)
With afterTradeId only: every trade with matchId at or below it exists and is returned by this endpoint.
1The epoch.
1match_id of the epoch's last trade; (epoch-1) * 2^40 when the epoch ended without trades.
1With afterTradeId only: the afterTradeId of the next call. It never moves backwards; equal to the request's afterTradeId when nothing newer is available yet.
1Opaque cursor for the next page. Empty when no more results exist, and always empty with after_trade_id.
eyJvZmZzZXQiOjIwMH0Trade execution timestamp, in nanoseconds since the Unix epoch (UTC).
2025-01-01T00:00:00ZStable trade id within the symbol, suitable for pagination and de-duplication.
100001Trade price as a decimal string in quote asset units per base asset unit, for example '61000.25'.
61000.25Traded quantity as a decimal string in base asset units, for example '0.001'.
0.001True when the taker/aggressor bought the base asset; false when the taker/aggressor sold the base asset.
BUYStable numeric pair id from GetSpotConfig.
BTC-USDT| Key | HTTP status | Connect code | Error | When |
|---|---|---|---|---|
| unauthenticated | 401 | unauthenticated | Unauthenticated | Authentication required. |
| permission-denied | 403 | permission_denied | Permission Denied | Permission denied. |
| invalid-argument | 400 | invalid_argument | Invalid Argument | Invalid argument. |
| not-found | 404 | not_found | Not Found | Not found. |
| unavailable | 503 | unavailable | Unavailable | Service unavailable. |