fixed
Dex TWAP/VWAP Pair Endpoints
8 months ago by Amberdata Support
2024-05-09
Similar to previous TWAP/VWAP posts, our team has fixed an issue on the
https://api.amberdata.com/market/defi/twap/pairs/bases/{base}/quotes/{quote}/historical
DEFI - Pairs Global TWAPhttps://api.amberdata.com/market/defi/vwap/pairs/bases/{base}/quotes/{quote}/historical
DEFI - Pairs Global VWAP
endpoints where the value of the vwap
and twap
property was not idempotent across different startDate
and endDate
ranges specified by the user. This was due to the query parameter lookbackPeriod
not being correctly processed as part of the API request
{
"timestamp": "2024-05-09 00:32:00 000",
"pair": "DAI_WETH",
"price": "0.000335832968098396",
"vwap": "0.000336320935556669", <<<< was not idempotent because the lookbackPeriod was not respected
"volume": "53.012715024142088478",
"baseAddress": "0x6b175474e89094c44da98b954eedeac495271d0f",
"baseSymbol": "DAI",
"quoteAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"quoteSymbol": "WETH"
}
{
"timestamp": "2024-05-09 00:31:00 000",
"pair": "DAI_WETH",
"price": "0.000335683579457130",
"twap": "0.000336197332360440", <<<< was not idempotent because the lookbackPeriod was not respected
"volume": "293.996142934586830647",
"baseAddress": "0x6b175474e89094c44da98b954eedeac495271d0f",
"baseSymbol": "DAI",
"quoteAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"quoteSymbol": "WETH"
}
This issue has now been resolved. For a given lookbackPeriod
, default or user-specified, the vwap
or twap
values will remain consistent regardless of the startDate
and endDate
range. The value of vwap
or twap
is ONLY affected if the value of lookbackPeriod
is changed by the user.