Uniswap V3 SDK and GraphQL Walkthrough

Поделиться
HTML-код
  • Опубликовано: 17 окт 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 года назад +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

    • @CryptoWizards
      @CryptoWizards  2 года назад

      Well spotted. I need to work on this!

  • @web3Physics
    @web3Physics Год назад

    Your research are so interesting and nice to see your videos

  • @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.

  • @Ruben-zm7pm
    @Ruben-zm7pm 2 года назад +1

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

  • @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!

  • @heycherry100
    @heycherry100 2 года назад +1

    More behind the scenes please! Great video!

  • @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 ♡

  • @proro485
    @proro485 2 года назад +1

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

  • @psychoT233
    @psychoT233 2 года назад

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

    • @CryptoWizards
      @CryptoWizards  2 года назад

      LOL! Thank you brother. Appreciated that.

  • @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

  • @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!

  • @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

  • @atliholmgrimsson2387
    @atliholmgrimsson2387 2 года назад +1

    Awesome stuff, more behind the scenes please

  • @DaloloDiak
    @DaloloDiak Год назад

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

  • @ShoterOTP
    @ShoterOTP 8 месяцев назад

    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?

  • @shura8678
    @shura8678 2 года назад

    This was extremely helpful thank you very much.

  • @AllenAndersonTaylor
    @AllenAndersonTaylor Год назад

    Great content man

  • @LawTzuTao
    @LawTzuTao 2 года назад

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

  • @lauisiada
    @lauisiada 2 года назад

    whats the unit of the liquidity value

  • @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.

  • @unaiiglesias9901
    @unaiiglesias9901 2 года назад

    great video!

  • @hakaryusuf7950
    @hakaryusuf7950 2 года назад

    thanks, keep it up bro

  • @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).

  • @schrodingerscat3912
    @schrodingerscat3912 2 года назад

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

    • @CryptoWizards
      @CryptoWizards  2 года назад

      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.

  • @TheJakeRobinson
    @TheJakeRobinson 2 года назад

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

  • @THEfAMILLYGAMERS
    @THEfAMILLYGAMERS 2 года назад +1

    BTC to 69+ by EOY. No doubt

  • @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 😆

  • @parkerdinkins5541
    @parkerdinkins5541 2 года назад

    behind the scenes

  • @pantoea6089
    @pantoea6089 2 года назад

    Behind the scenes, more please...

    • @CryptoWizards
      @CryptoWizards  2 года назад +1

      Thanks for feedback - next one just got published.

  • @feresewa
    @feresewa 2 года назад

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