skip to Main Content

I am trying to use the Uniswap SDK to get historical rates between two coins on a pool. I believe the rate is simply just xy = k, where k is a constant. If someone buys n coins of x, the cost in terms of y coins would be whatever m value that makes the equation (x - n)(y + m) = k still hold.

I’ve been looking all over the Uniswap’s SDK page and can’t really find where I can find the historical data regarding this xy = k curve. I think it should be possible, but I’m not exactly sure where to find it.

I’m also looking for how the current swap rate (that is what the current values of x and y are).

I think it can be done via GraphQL, but I’m looking for a solution using the SDK. Can anyone help?

2

Answers


  1. with uniswap SDK you can only get the current swap rate. You’d need to combine this with GraphQL API to get historical data.

    Hope this helps!

    Login or Signup to reply.
  2. Two options

    You will find some historical Uniswap v3 price tutorial here.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search