Uniswap V2 Prices
Fetch prices for a specific pair or list of pairs in the last 24hrs (8640 blocks):
curl -s --location --request GET \
"https://app.pangea.foundation/v1/api/uniswap/v2/prices?chains=ETH&pair_address__in=0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc&from_block=-8640&to_block=latest" \
--header "Accept: application/jsonstream" \
--header "Accept-Encoding: gzip" --compressed \
--header "Authorization: Basic $PANGEA_AUTH" | jq
Response
{
...
{
"chain": 1,
"block_number": 18918998,
"block_hash": "0x1962d15d1feaffa0c1dcaf3edebb85a2ac74014695eaf297d5c0e296cc52057c",
"transaction_hash": "0x354d31eb4f34135addda837f619343b170160e3ec953b8a55a67d356b3f99afa",
"transaction_index": 139,
"log_index": 198,
"pair_address": "0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc",
"event": "swap",
"reserve0": "0x30d35961fdd5",
"reserve1": "0x4b29ee82c04e24119f1",
"price": 2419.9079852881446,
"sender": "0x7a250d5630b4cf539739df2c5dacb4c659f2488d",
"receiver": "0x4cb6f0ef0eeb503f8065af1a6e6d5dd46197d3d9",
"amount0": 3028.627959,
"amount1": 1.2552416537518787,
"lp_amount": 0,
"protocol_fee": null,
"token0_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"token0_decimals": 6,
"token0_name": "USD Coin",
"token0_symbol": "USDC",
"token1_address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"token1_decimals": 18,
"token1_name": "Wrapped Ether",
"token1_symbol": "WETH",
"timestamp": 1704190007
}
}
Query parameters
v1/api/uniswap/v2/prices
chains
: This parameter is used to filter the data by chain. Supported chains are advertised on/v1/api/status
URLfrom_block
: This parameter is used to filter the data by a starting block number.to_block
: This parameter is used to filter the data by an ending block number.pair_address__in
: This parameter is used to filter the data by a list of pair addresses.pair_factory_address__in
: This parameter is used to filter the data by a list of pair factory addresses.reserve0__gte
: This parameter is used to filter on the reserve of token0 if it is greater than or equal to value.reserve0__lte
: This parameter is used to filter on the reserve of token0 if it is less than or equal to value.reserve1__gte
: This parameter is used to filter on the reserve of token1 if it is greater than or equal to value.reserve1__lte
: This parameter is used to filter on the reserve of token1 if it is less than or equal to value.price__gte
: This parameter is used to filter on price if it is greater than or equal to value.price__lte
: This parameter is used to filter on price if it is less than or equal to value.sender__in
: This parameter is used to filter the data by a list of sender addresses.receiver__in
: This parameter is used to filter the data by a list of receiver addresses.amount0__gte
: This parameter is used to filter the data if greater than or equal to value for amount0.amount0__lte
: This parameter is used to filter the data if less than or equal to value for amount0.amount1__gte
: This parameter is used to filter the data by a minimum value for amount1.amount1__lte
: This parameter is used to filter the data by a maximum value for amount1.lp_amount__gte
: This parameter is used to filter the data by a minimum value for lp_amount.lp_amount__lte
: This parameter is used to filter the data by a maximum value for lp_amount.protocol_fee__gte
: This parameter is used to filter the data by a minimum value for protocol_fee.protocol_fee__lte
: This parameter is used to filter the data by a maximum value for protocol_fee.token0_address__in
: This parameter is used to filter the data by a list of token0 addresses.token0_symbol__in
: This parameter is used to filter the data by a list of token0 symbols.token1_address__in
: This parameter is used to filter the data by a list of token1 addresses.token1_symbol__in
: This parameter is used to filter the data by a list of token1 symbols.tokens_address__in
: This parameter is used to filter the data by a list of token addresses.tokens_symbol__in
: This parameter is used to filter the data by a list of token symbols.
These parameters can be used in combination to create complex filters for the data returned by the API.