1. The fair price of stablecoins is calculated by weighting the price of stablecoins in the major exchanges, and the fair price is marked as the Benchmark. Different stablecoins have different prices.
P1 represents the price of Exchange A, and V1 represents the weight of Exchange A.
The Benchmark is renewed every 10s, and the market price of the corresponding exchange is taken as the market price.
2. Extra offset is calculated based on stablecoin positions and is marked as Premium. Different stablecoins have different offsets.
Calculate the proportion of position deviation. The current position data is the available withdraw amount. Available withdraw amount = hot wallet balance – amount in the withdrawal process.
Calculate the level of deviation. “Step” is the deviation proportion for each level:
Calculate the Premium according to the following formula. Pstep is the increased Premium proportion for each level’s deviation:
3. The price of stablecoins being exchanged to and from is determined by Benchmark and Premium.
1) Price of being exchanged to:
2) Price of being exchanged from:
4. The exchange rate is calculated by the above two prices. 5 decimal places are preserved in the exchange rate at first, and the 5th place is rounded to 4th place. Finally, the exchange rate has 4 decimal places.