Uniswap V3 SDK and GraphQL Walkthrough

Поділитися
Вставка
  • Опубліковано 11 гру 2024
  • Whilst exploring the possibility of triangular arbitrage on Uniswap V3, working with the SDK can be somewhat daunting or feel complex. Wanted to put this video together to show actual code behind the scenes on how to a) get GraphQl price data and b) price information for a Swap directly to the smart contract with depth.
    In this video, we do not show triangular arbitrage itself, but the first building blocks to get there. Feel confident that many programmers will be looking to connect to price information on Uniswap V3. The aim of this video is to be able to use the V3 SDK and understand how to query data.
    cryptowizards.net

КОМЕНТАРІ • 59

  • @m3ll0f3ll0
    @m3ll0f3ll0 2 роки тому +1

    I've been looking for this type of content for months, keep it coming

    • @CryptoWizards
      @CryptoWizards  2 роки тому +1

      Thanks so much brother. Really appreciate the encouragement.

  • @m3ll0f3ll0
    @m3ll0f3ll0 2 роки тому +3

    one thing to make sure of when talking about price differences is making sure the sources you are comparing are from the same block; sometimes the graph indexers might not be "caught up" to the current block, therefore giving you stale data

  • @heycherry100
    @heycherry100 2 роки тому +1

    More behind the scenes please! Great video!

  • @Ruben-zm7pm
    @Ruben-zm7pm 2 роки тому +1

    Finally, something that really clear. Please keep it up! Thanks!

  • @web3Physics
    @web3Physics Рік тому

    Your research are so interesting and nice to see your videos

  • @psychoT233
    @psychoT233 3 роки тому

    Oh sh*t! The Wizard has returned from his quest and dropping some hot new content! Always worth the wait. Cheers

    • @CryptoWizards
      @CryptoWizards  3 роки тому

      LOL! Thank you brother. Appreciated that.

  • @Rafael-tx8tr
    @Rafael-tx8tr 2 роки тому +1

    This tip might save a lot of people a lot of time: There are two reasons your output amount might deviate from the one on Uniswap's page.
    1) You have to consider price impact in your calculations. The more you swap, the less you get with AMMs.
    2) You also have to subtract the swap fee from the output.
    If your output is not the same (I mean every decimal place), then you are missing 1) and/or 2).
    I hope this helps ♡

  • @koficodrington6381
    @koficodrington6381 2 роки тому

    This was a great video I’m attempting to create a multi DEX price oracle in Python and gave up on integrating uniswap v3!!

    • @CryptoWizards
      @CryptoWizards  2 роки тому

      Awesome initiative - keep going brother!

  • @proro485
    @proro485 2 роки тому +1

    Extremely helpful content. Thanks for making this video. Subscribed.

  • @eltoniteblockchain6713
    @eltoniteblockchain6713 2 роки тому +1

    I believe the price difference is because of the time delay between querying the indexed data from Graph QL versus directly querying from the blockchain itself. So in essence, theGraph data might just be one or two blocks behind the present

    • @CryptoWizards
      @CryptoWizards  2 роки тому

      Aaaahhhh - you know your stuff. Thank you for the contribution!

  • @atliholmgrimsson2387
    @atliholmgrimsson2387 3 роки тому +1

    Awesome stuff, more behind the scenes please

  • @shura8678
    @shura8678 2 роки тому

    This was extremely helpful thank you very much.

  • @LawTzuTao
    @LawTzuTao 2 роки тому

    yes! More behind the scenes, please. You have good content. I'm getting more confident with your videos.

  • @AllenAndersonTaylor
    @AllenAndersonTaylor Рік тому

    Great content man

  • @bozospecialbenk
    @bozospecialbenk Рік тому

    Hey mr Wizard! Could you help me on how to calculate the unclaimed fees for a running LP position?

  • @lauisiada
    @lauisiada 2 роки тому

    whats the unit of the liquidity value

  • @stuafleish
    @stuafleish 2 роки тому

    great video! thanks for the content. Were you able to preform a triangular arbitrage? Also, thoughts on how to take this data and compare it to other dexs for more arbitrage?

    • @CryptoWizards
      @CryptoWizards  2 роки тому

      No, I really just research this right now. The feedback from those acting on it is that Polygon is the way to go right now.

    • @stuafleish
      @stuafleish 2 роки тому

      @@CryptoWizards Ok. Is there a video going over the code for the triangular arbitrage? I'm interested in how this is done, even though it is not very profitable on Uniswap

  • @ShoterOTP
    @ShoterOTP 9 місяців тому

    Hey, thanks for tutorial. Do you know how to change liquidity format to USD? Like there are wierd big numbers such as "75097587164108417545395" under field of "liquidity" by any chance what does that number mean? Can it be transformed to USD?

  • @b1010101
    @b1010101 2 роки тому

    Great content, but how to do actual swap with V3 SDK?

    • @CryptoWizards
      @CryptoWizards  2 роки тому

      You just need to follow their documentation "Uniswap V3 SDK docs" - then search for placing a trade. We also cover this in the Trading Execution course.

  • @andreyl2705
    @andreyl2705 2 роки тому

    Hi.
    did you have problems with the function quoteExactInputSingle?
    For me it works 50/50.
    But for some pools it failed with 'call revert exception' error .

    • @CryptoWizards
      @CryptoWizards  2 роки тому +1

      Yes for sure. One other method is to use the reserves calculation approach. However, the best way is to just fork the mainnet. Will do a video on this shortly.

    • @andreyl2705
      @andreyl2705 2 роки тому

      @@CryptoWizards Thank you sir. it would be very interesting to watch this video

  • @TheJakeRobinson
    @TheJakeRobinson 3 роки тому

    Awesome stuff - but I do admit this is way beyond my paygrade! :>)

  • @unaiiglesias9901
    @unaiiglesias9901 2 роки тому

    great video!

  • @hakaryusuf7950
    @hakaryusuf7950 2 роки тому

    thanks, keep it up bro

  • @schrodingerscat3912
    @schrodingerscat3912 3 роки тому

    that's strange that the price varies. should you just scrape the string directly off the webpage then? lol

    • @CryptoWizards
      @CryptoWizards  3 роки тому

      Haha. Its not a bad idea, but for scanning so many currencies the price would change by the time you get to do the calculation. Also, I reckon there are multiple pools for the same swap pair...could be wrong but will find out.

  • @THEfAMILLYGAMERS
    @THEfAMILLYGAMERS 3 роки тому +1

    BTC to 69+ by EOY. No doubt

  • @pantoea6089
    @pantoea6089 3 роки тому

    Behind the scenes, more please...

    • @CryptoWizards
      @CryptoWizards  3 роки тому +1

      Thanks for feedback - next one just got published.

  • @pberent
    @pberent 2 роки тому

    Love the vid. I've been playing with the v3 sandbox and I'm trying to find a way to match the 24h and 7d volume figures shown on the pools info page
    as an example I use
    pool(id:"0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8"){
    totalValueLockedUSD
    poolDayData{
    date
    volumeUSD
    }
    }
    which gives me the right TVL but it only gives me data from dates from last year. Any idea how to get current data? I would be most grateful for any input

    • @CryptoWizards
      @CryptoWizards  2 роки тому

      Thanks Philip. Another approach is to get the prices direction from the smart contract (that would be the most accurate).

  • @parkerdinkins5541
    @parkerdinkins5541 2 роки тому

    behind the scenes

  • @feresewa
    @feresewa 2 роки тому

    maybe try 1inch they have an API and they already get the best price for a pair between all dexs

  • @pasqualevazzana7627
    @pasqualevazzana7627 2 роки тому

    Excellent content, I appreciate the behind the scenes. Have you thought about adjusting the price yourself by using the same AMM formula used by Uniswap, just to see if it matches what's displayed on their page?

    • @CryptoWizards
      @CryptoWizards  2 роки тому +1

      What a cool idea. I hadn't thought of that!

    • @pasqualevazzana7627
      @pasqualevazzana7627 2 роки тому

      @@CryptoWizards they all use the formula uniswap uses, we'll... not all of them but most of them

    • @pasqualevazzana7627
      @pasqualevazzana7627 2 роки тому

      @@CryptoWizards I made a simplified version for node.js and one for rust, what's your bot written in?

    • @pasqualevazzana7627
      @pasqualevazzana7627 2 роки тому

      I think it was python, I've watched si many vids since then 😆