This endpoint returns information about price of ERC20 tokens. Use this endpoint to return the latest, as well as historical dollar prices of tokens.
Method: POST
Endpoint: https://api.syve.ai/v1/prices_usd
Request Body
The request body is used to specify how you want to query the data. There are four different parameters you can provide. Each parameter is an optional JSON object.
Name | Type | Description |
---|---|---|
filter | object | The filter parameter is used to retrieve a subset of the data. You can filter according to exact values, between ranges, and using conjunctions (AND/OR). For more information read the query syntax section or look at one of the examples. |
bucket | object | The bucket parameter is used to group the underlying data. You can group data according to exact values or value ranges.For more information read the query syntax section or look at one of the examples. |
aggregate | object | The aggregate parameter is used to apply one or more aggregation functions (e.g. min , max , sum , avg , open , close ) to the results of a query.If used together with the bucket parameter, the aggregation functions are applied to every bucket separately.For more information read the query syntax section or look at one of the examples. |
options | object | The options parameter is used to specify the results of query. E.g. the size of the response, or the order in which to return results in. For more information read the query syntax section or look at one of the examples. |
Response Fields
Name | Type | Description |
---|---|---|
block_number | integer | The block number (i.e. height) of the event log. |
timestamp | integer | UNIX timestamp in seconds. The zero value corresponds to the 1st of January 1970 at UTC, called the Unix Epoch. |
transaction_hash | string | The transaction hash of the |
token_address | string | The unique address of the ERC20 token. |
price_token_usd_tick_1 | double | The dollar price of the token according to the most recent trade. If the dollar value of the trade was less than 1 the price is recorded as null . |
`price_token_usd_tick_100 | double | The dollar price of the token according to the most recent trade. If the dollar value of the trade was less than 100 the price is recorded as null . |
price_token_usd_wavg_1h | double | The volume weighted average price across all trades for a token in the last 1 hour across all DEX protocols. |
price_token_usd_wavg_24h | double | The volume weighted average price across all trades for a token in the last 24 hours across all DEX protocols. |
protocol_name | string | The name of the DEX protocol that the trade was made on. Note: Currently we cover Uniswap V2 and Uniswap V3. |
pool_address | string | The DEX pool that the trade was made on. |
side | string | Whether a trade was abuy (the token was purchased) or a sell (the token was sold). |
amount_token | double | The amount of the token that was traded. |
amount_eth | double | The Ether value of the amount of the token that was traded. |
amount_usd | double | The dollar value of the amount of the token that was traded. |
Example
Query
curl --location --request POST 'https://api.syve.ai/v1/prices_usd' \
--header 'Content-Type: application/json' \
--data-raw '{
"options": [
{
"type": "size",
"params": {
"value": 3
}
}
]
}'
Response
The results
object contains the logs that match the query. The cursor
can be used to fetch the next page of results provided the number of records that match the query exceeds the provided size.
{
"results": [
{
"block_number": 11625352,
"date_time": "2021-01-10T06:08:51",
"timestamp": 1610258931,
"transaction_hash": "0x5db6e9f40afb6c2e49593c4c6a093df405f7addee261c0e1b332e3a6d4bfdf3a",
"token_address": "0xe28b3b32b6c345a34ff64674606124dd5aceca30",
"price_token_usd_tick_1": 4.874291875202424,
"price_token_usd_tick_100": null,
"price_token_usd_wavg_1h": 4.784023008581769,
"price_token_usd_wavg_24h": 5.048970864782802,
"protocol_name": "uniswap_v2",
"pool_address": "0x3c70f4faea49e50adc8305f2e1aa0ea326a54ffc",
"side": "buy",
"amount_token": 7.2113075151665464,
"amount_eth": 0.026655818436212297,
"amount_usd": 35.15001763076247
},
{
"block_number": 11625352,
"date_time": "2021-01-10T06:08:51",
"timestamp": 1610258931,
"transaction_hash": "0x5db6e9f40afb6c2e49593c4c6a093df405f7addee261c0e1b332e3a6d4bfdf3a",
"token_address": "0xc944e90c64b2c07662a292be6244bdf05cda44a7",
"price_token_usd_tick_1": 0.35150017630762476,
"price_token_usd_tick_100": null,
"price_token_usd_wavg_1h": 0.3507309628919862,
"price_token_usd_wavg_24h": 0.37118582192161503,
"protocol_name": "uniswap_v2",
"pool_address": "0x2e81ec0b8b4022fac83a21b2f2b4b8f5ed744d70",
"side": "sell",
"amount_token": 100.0,
"amount_eth": 0.026655818436212297,
"amount_usd": 35.15001763076247
},
{
"block_number": 11625352,
"date_time": "2021-01-10T06:08:51",
"timestamp": 1610258931,
"transaction_hash": "0x1c0f113043825b821bfa5e010c58d4ec422749c5686527f4ab3e8c74d774ce34",
"token_address": "0xbc396689893d065f41bc2c6ecbee5e0085233447",
"price_token_usd_tick_1": 2.1621104807409606,
"price_token_usd_tick_100": null,
"price_token_usd_wavg_1h": 2.1620316524603846,
"price_token_usd_wavg_24h": 2.151252091503544,
"protocol_name": "uniswap_v2",
"pool_address": "0xf66369997ae562bc9eec2ab9541581252f9ca383",
"side": "buy",
"amount_token": 33.727237815545244,
"amount_eth": 0.0553,
"amount_usd": 72.92201436743323
}
],
"cursor": {
"next": "NDY1MDE0MDgwMDAwMDI0MToxNjg2ODQ3MzUx"
}
}