About refresh frequency
Data timeliness and accuracy is of the utmost importance in Binance Oracle. To ensure accurate data are fed to the smart contracts in a timely manner, Binance Oracle will feed the price to the smart contracts in regard to two dimensions, price and time.
A blockchain oracle is not going to feed the data to the on-chain smart contracts in a real time manner. Every transaction on-chain is going to incur a gas fee. To balance the data timeliness and the well spent of the gas fee, the price will only be fed when there is a significant change.
In Binance Oracle, we evaluate the asset pair in a case by case manner. For each asset pair, there will be a deviation threshold being assigned to it. Whenever the price deviation is compared to the last update crosses the threshold, a new update will be triggered.
Very often, the price of a particular asset may stay within a certain price range, so that the price deviation doesn't cross the threshold. Binance Oracle will still feed the price to the on-chain smart contracts from time to time, to ensure that users are not getting a stale price. The longest time period that the Binance Oracle will feed the price is called heartbeat. It is a signal to the users that the service is still up and running healthily.
These two parameters are meticulously configured to ensure data timeliness and accuracy.
Referring to the , the deviation threshold and heartbeat of BNB/USD are 1% and 60s.
For example, the price on-chain differed from the latest price by 1.2% at TB, which exceeds the assigned deviation threshold by 0.2%. Therefore, the update condition is met and triggers an on-chain oracle price update.
As BNB/USD's heartbeat is 60s, it will be updated at TA, TC and TD and you may notice that all of them are separated by a 60s time interval.