Return the change in price over a given period for up to 10,000 tokens in a single request.
Method: GET
or POST
Endpoint: https://api.syve.ai/v1/price-api/batch-latest-price-change
Recently Added
This endpoint has been recently added. It's possible for there to still be bugs. If you find any bugs please send us a message in our Discord: https://discord.com/invite/rs5GPAZ7tG
Fetching 10,000 tokens in a single request
You have to use a
POST
request.GET
requests are limited to 25 addresses per request. Look at the example at the bottom of this page for how to construct aPOST
request.
Request Parameters
Time period of price change
The time period over which the price change is calculated is the interval
[timestamp - lookback, timestamp]
, where bothtimestamp
andlookback
are request parameters.
Name | Type(s) | Description |
---|---|---|
token_address | string | This is the address or list of addresses for which to return latest price information for. If making a GET request use a comma separated list to provide the list of addresses. If POST use a list in the request body.This is a required parameter. |
price_type | string | The type of price to return in the response. The default is price_token_usd_tick_1 . All possible options for price_type are given in the table below. |
timestamp | integer | The unix timestamp of the close of the period you want to calculate price change over. Default: The current time. |
lookback | string | How far back relative to timestamp the open of the period you want to calculate price change over is.Default: 24h . The maximum lookback is 30 days.Possible values: [i][T] where i is an integer greater than 0 , and T is a time format s (seconds), m (minutes), or d (days). |
Possible Price Types
The possible price types correspond to the prices returned by our DEX Trades table. Each price type corresponds to a different method of calculating price.
Price Type | Description |
---|---|
price_token_usd_tick_1 | The price at which a token was traded based on the most recent swap. |
price_token_usd_robust_tick_1 | The same as price_token_usd_tick_1 but with significant outliers removed. |
Response Fields
Name | Type | Description |
---|---|---|
token_address | integer | The address of the token. |
timestamp_open | integer | The Unix timestamp of the beginning of the period selected. |
timestamp_close | integer | The Unix timestamp of the end of the period selected. |
price_open | double | The price of the token at the beginning of the period selected. |
price_close | double | The price of the token at the end of the period selected. |
change_pct | double | The percentage difference between price_close and price_open . |
change_abs | double | The absolute difference between price_close and price_open . |
Example: The 24h
price change for $UNIBOT and $PEPE
24h
price change for $UNIBOT and $PEPETry it out
In the Live Example section you can try out the request with different arguments.
Query
In the requests below 0xf819d9cb1c2a819fd991781a822de3ca8607c3c9
is the address of $UNIBOT
and 0x6982508145454ce325ddbe47a25d4ec3d2311933
of $PEPE
.
Example GET Request
Example POST Request
curl --location --request POST 'https://api.syve.ai/v1/price-api/batch-latest-price-change' \
--header 'Content-Type: application/json' \
--data '{
"lookback": "24h",
"token_address": [
"0xf819d9cb1c2a819fd991781a822de3ca8607c3c9",
"0x6982508145454ce325ddbe47a25d4ec3d2311933"
]
}'
Try in Postman: https://www.postman.com/dark-equinox-191074/workspace/syve-examples/request/11895150-ecfde65c-582c-4880-a647-0cfe595237fd?ctx=documentation
Response
[
{
"token_address": "0xf819d9cb1c2a819fd991781a822de3ca8607c3c9",
"timestamp_open": 1701614001,
"timestamp_close": 1701700401,
"price_open": 65.87754677265109,
"price_close": 60.24896613863827,
"change_pct": -8.544004611218318,
"change_abs": -5.628580634012813
},
{
"token_address": "0x6982508145454ce325ddbe47a25d4ec3d2311933",
"timestamp_open": 1701614001,
"timestamp_close": 1701700401,
"price_open": 1.1848945781592235e-06,
"price_close": 1.2518643124893624e-06,
"change_pct": 5.651957192189949,
"change_abs": 6.696973433013899e-08
}
]
Live Example
Press Try It to make a request and see what the response looks like. Feel free to try different query parameters.