xExchange API: the price of a LP token is 0

xExchange API: the price of a LP token is 0


0

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

Quentin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

1 Answer
1


0

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

Quentin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



Leave a Reply

Your email address will not be published. Required fields are marked *