You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**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 Stonfiand Dedust, offering a comprehensive view of verified tokens, their reserves, and holder counts.
10
+
**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.
11
11
12
12
<Callouttype="warning"emoji="⚠️">
13
13
The rates provided are for informational purposes only. Do not use this data for financial transactions.
@@ -19,12 +19,16 @@ Our Rates service utilizes a systematic approach to gather and process data:
19
19
20
20
21
21
#### Data Sources:
22
-
- By leveraging the [analytics service](/tonconsole/analytics) in tonconsole, we obtain data on pools from Stonfiand Dedust.
22
+
- By leveraging the [analytics service](/tonconsole/analytics) in tonconsole, we obtain data on pools from Stonfi, Dedust, SwapCoffee, Tonco, Bidask and Mooncx.
23
23
- The collected information includes token **_addresses_**, **_reserves_**, and the **_number of holders_** for verified tokens.
24
24
25
25
#### Price Calculation:
26
26
- For standard pools: We apply the formula $xy = k$, where $x$ and $y$ are volumes of two assets in the pool, and $k$ is a constant.
27
27
- For Dedust stable pools: We use a modified formula $x^3y + y^3x = k$ to account for the specifics of these pools.
28
+
- For Stonfi weighted constant product pool: We use standart formula ($xy = k$) with weight value $w0$ from the pool settings $x^{w_0}y^{1-w_0} = k$.
29
+
- For Stonfi stable pools: We work with the following formula $4A(x + y) + D = 4AD + \frac{D^3}{4xy}$, where $A$ is amplifier from pool's settings and $D$ is a constant, so it much more complicated to calculate $D$ value, so we use iteratively, calculating $D$ more accurate each step.
30
+
- For Stonfi weighted stable pools: We use a bit simplified formula for stable pools with rate $r$ and weight $w0$ parameters from pool's settings $(x + ry)A + x^{w0}y \cdot (ry)^{1-w0} = k$.
31
+
- For Bidask pools: We get already calculated price from the pool data, butwe need to proccess this value using this formula ${(\frac{P}{2^{128}})}^2 = price$, where $P$ is the value of price that need to be proccessed.
28
32
29
33
You can view the implementation of these calculations <ExternalLinkhref={GITHUB_LINKS.RATES_PRICE_CALCULATION_CODE}>here</ExternalLink> .
30
34
@@ -46,4 +50,4 @@ Send this information to <ExternalLink href={LINKS.ZAKHAR_TG}>@zakhar_petukhov</
46
50
47
51
<SchemaLoadertag={SWAGGER_TAGS.RATES} />
48
52
49
-
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.
53
+
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.
0 commit comments