Freelancer: mustaphaliaichi
Compartilhar:
Denunciar Inscrição

Uinswap Python code

To fetch Uniswap's order book data, one typically interacts with their Graph API. However, there's a catch: Uniswap V2 and V3 are automated market makers (AMM), which means they don't maintain a traditional order book like centralized exchanges. Instead, they utilize liquidity pools. So, you can't retrieve a traditional order book with bids and asks. Instead, you can derive the current price by querying the reserves of the liquidity pools. But this will not give you an "order size" like in traditional order books. Given this context, here's an outline of what you can do: Use the Uniswap Graph API to query the reserves of liquidity pools. Derive the price of a token in terms of USDT or ETH. Update the data every 10 seconds. i can give a skeleton code and it won't give you a traditional order book. It fetches the price of a token in terms of USDT based on the current state of the liquidity pool.

Inscrição nº 16 do Concurso para                                                 I'm looking for python script which one will return Uniswap orderbook
Inscrição nº16

Painel de Comentários

  • mdabdulkader2162
    Proprietário do Concurso
    • 5 meses atrás

    I did not get the my 1st job expected result to send one request and collect all coins order books and some of you told me it's not possible in decentralized exchange.

    So you can try 2nd job if it's possible.

    Thank you for your time and cooperation.

    • 5 meses atrás
    1. mustaphaliaichi
      mustaphaliaichi
      • 5 meses atrás

      Basically my script work based on some APIs as you can see, so i may need that .

      • 5 meses atrás
  • mdabdulkader2162
    Proprietário do Concurso
    • 5 meses atrás

    I need order book with top trading pairs for example (ETH & sushi , USDT & sushi, I need USDT & sushi ). and I need all coins order book within 10 sec. It's mean I want to send one request with multiple coins and I order book given by pairs. Thanks.

    • 5 meses atrás
    1. mustaphaliaichi
      mustaphaliaichi
      • 5 meses atrás

      The traditional concept of an order book (like on centralized exchanges) doesn't apply to Uniswap due to its design as an Automated Market Maker (AMM). Instead of bid and ask orders placed by traders, Uniswap relies on liquidity pools and a mathematical formula to determine prices.

      However, I can provide you with a script to fetch the current price for multiple trading pairs from Uniswap and give you an approximate "order book" based on that. But remember, these are not real order books; they are approximations based on the current price.

      • 5 meses atrás