Price calculation for WBTC/USDC pair using current tick #30
-
|
I'm having trouble with price calculations for the WBTC/USDC pair and hoping someone can help clarify where I'm going wrong. Pool details: Calculation: Considering decimal adjustment:
But if use I'm quite confused why the same approach haven't really worked out. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
If you have a pair like this p = y / x = 1e8 / 1e6 = 1e2 [because `WBTC` has 8 decimal and `USDC` has 6 decimal
finalPrice = (1.0001 ** 70538) * 1e2 = 115,683 (which makes sense as the current price of BTC)In conclusion, your mistake was in misplacing the decimals. |
Beta Was this translation helpful? Give feedback.
-
|
mmm didnt really get how the Great if you could clarify. |
Beta Was this translation helpful? Give feedback.
I am sorry if the answer above was confusing. You are correct that
WBTCwill betoken xin the pool, considering it has a lesser hexadecimal value. So the price isUSDC/WBTC[This simply means that by default, the pool will return the price ofWBTCin terms ofUSDC]To account for the decimal of the price so that the price reflects the actual price, we would need to do the decimal ratio calculation, but we won't say simply because the pool has its token in this form
USDC/WBTC, then our ratio calculation will be10**6/10**8but instead we want to calculate the price ofWBTCin term ofUSDCso we will divide thePabove by the decimal ofUSDCand then multi…