Skip to main content

Price calculation

Binance Oracle sources price data from multiple sources to ensure accuracy and reliability. This method is advantageous as it minimizes the risk of inaccurate pricing due to anomalies or manipulation within a single data source. The data from these various sources are then aggregated together using a weighted average formula to provide a more balanced and representative price.

WeightedAverage=(PriceWeight)WeightWeighted Average = \frac{\sum(Price * Weight)}{\sum Weight}

Here's a breakdown of the formula:

  • Price refers to the price data from each data source.
  • Weight is the weight allocated to each data source, which is largely correlated with the trading volume or liquidity provided by that source.

This ensures that more reliable and liquid sources have a greater influence on the final price. In addition, there is a mechanism in place to exclude outliers. An outlier in this context refers to a data source that is providing a price significantly deviated from the others, which could potentially skew the average. This safeguard further enhances the credibility and stability of the price data provided by Binance Oracle.

About picking data sources

Selecting the right data sources for price information is a critical part of our process. We prioritize credible sources, such as large centralized exchanges including Binance itself and decentralized exchanges. These platforms are known for their substantial trading volumes and high liquidity, making them reliable sources of price data.

Beyond merely selecting these sources, Binance Oracle also commits to regularly reviewing and updating its data sources. This ongoing process is crucial to ensure the accuracy and timeliness of the information we provide. We understand that markets evolve and new credible sources may emerge over time. Hence, we actively seek out and validate new data sources to keep our price data comprehensive and correct.

About price from volatile markets

Sourcing price data from volatile markets can pose significant challenges. These markets are characterized by rapid and substantial price fluctuations, which can impact the accuracy of the weighted average price. More importantly, during times of high volatility, the risk of price manipulation or anomalies is heightened. However, by sourcing data from multiple credible sources and implementing the Time Weighted Average Price (TWAP) method, we are able to provide a more accurate and balanced price, even in volatile market conditions.

The Time Weighted Average Price (TWAP) is calculated using a weighted formula that gives more importance to recent intervals. The formula is:

TWAP=i=1NPrice(ti)WeightiNTWAP = \frac{\sum^N_{i=1}{Price(t_i)*Weight_i}}{N}

Here's a breakdown of the formula:

  • Price refers to each price point at a particular time.
  • t is the time that the price snapshot is fetched.
  • Weight reflects the importance of that price snapshot, with more recent snapshot receiving a higher weight. This adjustment allows the TWAP to be more responsive to recent market changes.
  • N=5. There are 5 snapshots in total, each with different weights.

By using the Time Weighted Average Price (TWAP), the price is effectively "smoothed" over a period of time. A sudden spike or dip in price will be averaged out over time, resulting in a more consistent and stable price that better represents the true market value. This approach helps Binance Oracle ensure the accuracy and reliability of the price data it provides, even in the face of sudden market volatility.