Rates
Rates service provides access to exchange rates for various tokens on the TON blockchain. This service calculates token prices using data from our indexer and liquidity pools such as Stonfi, Dedust, SwapCoffee, Tonco, Bidask and Mooncx, offering a comprehensive view of verified tokens, their reserves, and holder counts.
The rates provided are for informational purposes only. Do not use this data for financial transactions.
Logic of Token Price Calculation
Our Rates service utilizes a systematic approach to gather and process data:
Data Sources:
- By leveraging the analytics service in tonconsole, we obtain data on pools from Stonfi, Dedust, SwapCoffee, Tonco, Bidask and Mooncx.
- The collected information includes token addresses, reserves, and the number of holders for verified tokens.
Price Calculation:
- For standard pools: We apply the formula , where and are volumes of two assets in the pool, and is a constant.
- For Dedust stable pools: We use a modified formula to account for the specifics of these pools.
- For Stonfi weighted constant product pool: We use standart formula () with weight value from the pool settings .
- For Stonfi stable pools: We work with the following formula , where is amplifier from pool's settings and is a constant, so it much more complicated to calculate value, so we use iteratively, calculating more accurate each step.
- For Stonfi weighted stable pools: We use a bit simplified formula for stable pools with rate and weight parameters from pool's settings .
- For Bidask pools: We get already calculated price from the pool data, butwe need to proccess this value using this formula , where is the value of price that need to be proccessed.
You can view the implementation of these calculations here .
Data Analysis:
- We evaluate minimum holder counts to ensure token relevance.
- Pool reserves are analyzed and equated to TON for consistency.
Troubleshooting
If your token has over 100 TON in liquidity but doesn't receive a price from the API, please contact us with the following information:
- Token address
- Liquidity amount
- Number of holders
Send this information to @zakhar_petukhov for assistance.
Operations
getRates- Get the token price in the chosen currency for display only. Don’t use this for financial transactions.getChartRates- Get chart by tokengetMarketsRates- Get the TON price from markets
Remember, while this service provides valuable insights into token rates on the TON blockchain, it should not be used as the sole basis for financial decisions or transactions.