I’m querying the xExchange’s GraphQL API, but when I’m requesting the price of an LP token the field price
is 0 (but it shouldn’t). Does anyone know how to fetch the price of an LP token through this API?
Here is the query I’m doing:
query {
pairs(firstTokenID: "BUSD-40b57e") {
liquidityPoolToken {
identifier,
price
}
}
}
The response:
{
"data": {
"pairs": [
{
"liquidityPoolToken": {
"identifier": "BUSDWEGLD-c3b2f6",
"price": "0"
}
}
]
}
}
New contributor
1 Answer
Update: I got the solution from a member of the xExchange’s team.
For LP tokens, the field price
is not used. Instead, we should use the liquidityPoolTokenPriceUSD
field available under the pair
query, like this:
query {
pairs(firstTokenID: "BUSD-40b57e") {
liquidityPoolTokenPriceUSD
}
}
And the response:
{
"data": {
"pairs": [
{
"liquidityPoolTokenPriceUSD": "77.1959373311156606038999772721289720677588609448209439346070102479305240341465078296"
}
]
}
}
New contributor