API Reference

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 POSTrequest. GET requests are limited to 25 addresses per request. Look at the example at the bottom of this page for how to construct a POST 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 both timestamp and lookback are request parameters.

NameType(s)Description
token_addressstringThis 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_typestringThe 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.
timestampintegerThe unix timestamp of the close of the period you want to calculate price change over.

Default: The current time.
lookbackstringHow 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 TypeDescription
price_token_usd_tick_1The price at which a token was traded based on the most recent swap.
price_token_usd_robust_tick_1The same as price_token_usd_tick_1 but with significant outliers removed.

Response Fields

NameTypeDescription
token_addressintegerThe address of the token.
timestamp_openintegerThe Unix timestamp of the beginning of the period selected.
timestamp_closeintegerThe Unix timestamp of the end of the period selected.
price_opendoubleThe price of the token at the beginning of the period selected.
price_closedoubleThe price of the token at the end of the period selected.
change_pctdoubleThe percentage difference between price_close and price_open.
change_absdoubleThe absolute difference between price_close and price_open.

Example: The 24h price change for $UNIBOT and $PEPE

📘

Try 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

Request: https://api.syve.ai/v1/price-api/batch-latest-price-change?lookback=24h&token_address=0xf819d9cb1c2a819fd991781a822de3ca8607c3c9,0x6982508145454ce325ddbe47a25d4ec3d2311933

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.

Language
Click Try It! to start a request and see the response here!