Trade History
Returns the AMM legs of a token, newest first in chain order, with cursor pagination. One user trade can write several legs (a routed buy writes a leg on the main and a leg on the token); legRole says which. Protocol legs are left out unless include=protocol.
Query Parameters
| Param | Type | Description |
|---|---|---|
| cursor | string | Opaque cursor from pagination.nextCursor |
| limit | number | Items per page (default: 20, max: 100) |
| type | string | buy, sell, leverage_buy, or leverage_sell |
| include | string | protocol: also return protocol legs |
| from | number | Window start, unix seconds (inclusive), on the leg's timestamp; combinable with the cursor |
| to | number | Window end, unix seconds (exclusive); combinable with the cursor |
| legRole | string | Only legs of this role: trade, route_hop, cross_leg, leverage_open, leverage_exit, loan_exit, liquidation, convert, or protocol with include=protocol |
Response
{
"data": [
{
"id": 500,
"contractAddress": "0x...",
"type": "buy",
"amountToken": "1000000000000000000",
"amountUSDC": "5000000000000000000",
"amountQuote": "5000000000000000000",
"quoteAsset": "0x...",
"quoteDecimals": 18,
"user": "0x...",
"price": "5000000",
"main": "0x...",
"pairAsset": "0x...",
"pairDecimals": 6,
"pairSymbol": "USDG",
"valueUsdE18": "5000000000000000000",
"legValueUsdE18": "4970000000000000000",
"legRole": "trade",
"tradeLogIndex": 7,
"isPresale": false,
"userIsProtocol": false,
"viaContract": null,
"txHash": "0x...",
"logIndex": 5,
"blockNumber": 12345678,
"timestamp": "2026-03-13T12:00:00.000Z"
}
],
"pagination": {
"limit": 20,
"hasMore": true,
"nextCursor": "12345678:5"
}
}amountToken is in 18-decimal token units. amountQuote (and the deprecated amountUSDC, same value) is the quote leg in quoteAsset units: the main's units (18 decimals) for a factory token, raw pair-asset units (pairDecimals) for a main. It is not a dollar amount; use valueUsdE18 (USD × 1e18, null when unknown). On a trade or cross_leg leg that is the trade's USD before fees, the same figure /api/v1/trades shows for that trade; on any other leg it is the leg's own value. legValueUsdE18 is always the leg's own value: what the pool saw (a buy after the swap fee, a sell before it). price is the contract's integer price in raw pair-asset units per whole token, a display hint: divide by 10^pairDecimals. A cross-pair swap appears as legs with legRole: "cross_leg" that share a tradeLogIndex; one row per user trade is at /api/v1/trades. nextCursor is blockNumber:logIndex; pass it back as ?cursor=. viaContract is the contract the transaction was sent to when it was not ASwap (a router or another wrapper), null when the trade went straight to ASwap and on legs that belong to no user trade (leverage opens, loan exits, protocol legs).
// Get trade history with cursor pagination
const res = await fetch(
"https://launchonbasis.com/api/v1/tokens/0xTokenAddress/trades?limit=50",
{ headers: { "X-API-Key": "bsk_your_key" } }
);
const { data, pagination } = await res.json();
// pagination = { limit, hasMore, nextCursor }
// Next page:
const page2 = await fetch(
`https://launchonbasis.com/api/v1/tokens/0xTokenAddress/trades?cursor=${pagination.nextCursor}&limit=50`,
{ headers: { "X-API-Key": "bsk_your_key" } }
);