Trades
Endpoint
GET /api/v1/trades
Description
Understanding the asset_id
Parameter
asset_id
ParameterWhen specifying the asset_id
, you are essentially choosing the token from the liquidity pair you wish to focus on. This choice affects how trades are represented in the response:
Buy or Sell Side: The
side
of each trade (buy or sell) is determined relative to theasset_id
.If the
asset_id
matches the sold token in the swap, the trade is considered a "sell" from the perspective of that asset.Conversely, if the
asset_id
matches the bought token, the trade is viewed as a "buy."
For instance, consider a trading pair of BNB (token0) and USDT (token1):
If
asset_id
is set to BNB, then:A swap exchanging BNB for USDT is shown as a "sell" because BNB is being sold.
A swap exchanging USDT for BNB is shown as a "buy" because BNB is being bought.
If
asset_id
is set to USDT, then:The perspective reverses: swaps exchanging BNB for USDT are seen as "buys" (buying USDT), and those exchanging USDT for BNB are "sells" (selling USDT).
Price Representation
Price Value: The
price
field in the response reflects the price of theasset_id
targeted in each swap. This means the price is presented from the perspective of theasset_id
chosen, ensuring consistency with the side (buy or sell) designation.
Query String Parameters
asset_id (required): A string in the format <TOKEN_CONTRACT_ADDRESS>:<NETWORK_ID> that identifies the token you are interested in, in the LP pair. This should be either the token1_id or token0_id on the trading pair.
pair_id (required): A string in the format <PAIR_CONTRACT_ADDRESS>:<NETWORK_ID>.
Headers
x-api-key (required): A valid API key.
Example
Response
Response Codes
200
: Success. Returns the trades for the given pair and token.400
: Bad Request. The asset_id or pair_id were not provided.403: Forbidden. The x-api-key header is not provided or is invalid.
Last updated