GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — uniswapv3 get_raw_price error · Issue #269 · uniswap-python/uniswap-python

uniswapv3 get_raw_price error #269

New issue
Copy link
New issue
Copy link
Open
Open
uniswapv3 get_raw_price error#269
Copy link
Labels
bugSomething isn't workingSomething isn't working

Description

@YANGXIAO-LI
YANGXIAO-LI
opened on Aug 5, 2022
Issue body actions

raw_price = (sqrtPriceX96 * sqrtPriceX96 * 10 ** den1 >> (96 * 2)) / (
10 ** den0
)

DAI USDT The calculation results is 0?

Activity

  1. YANGXIAO-LI
    added
    bugSomething isn't workingSomething isn't working
    on Aug 5, 2022
  2. YANGXIAO-LI commented on Aug 5, 2022

    @YANGXIAO-LI
    YANGXIAO-LI
    on Aug 5, 2022
    Author
    More actions

    sqrtPriceX961 = pool_contract.functions.slot0().call()[0]
    sqrtPriceX961 is 79224306130848112672356

  3. YANGXIAO-LI commented on Aug 5, 2022

    @YANGXIAO-LI
    YANGXIAO-LI
    on Aug 5, 2022
    Author
    More actions

    DAI decimal is 18
    USDT decimal is 6

  4. ytoast commented on Oct 14, 2022

    @ytoast
    ytoast
    on Oct 14, 2022
    Contributor
    More actions

    I believe the calculation is correct though, seems like den0 and den1 might have been switched in your calculations

    # DAI/USDT pool; t0 = DAI, t1 = USDT
    sqrtPriceX96 = 79224306130848112672356
    den1 = 18 # DAI (Token In)
    den0 = 6 # USDT (Token Out)
    (sqrtPriceX96 * sqrtPriceX96 * 10 ** den1 >> (96 * 2)) / 10 ** den0 # equals to 0.999902
  5. shakibaei65 commented on Oct 14, 2022

    @shakibaei65
    shakibaei65
    on Oct 14, 2022 · Hidden as spam
    show commentMore actions
  6. TimeToBuildBob
    added a commit that references this issue on Oct 6, 2026

    fix: correct integer-shift price floor and odd-tick TVL bounds

    7ea6442
  7. TimeToBuildBob
    added a commit that references this issue on Oct 14, 2026

    fix: correct integer-shift price floor and odd-tick TVL bounds

    587a7eb
  8. ErikBjare
    added a commit that references this issue on Oct 26, 2026

    fix: correct integer-shift price floor and odd-tick TVL bounds (#482)

    bd4bd39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.