Fallback Logic

In case the oracle publishes clearly erroneous prices after the filtering checks already applied and the historical backfill prices are clearly erroneous as well, Friktion will fall back on using an off-chain calculation for the settlement price based on data pulled from centralized exchanges via a public library ccxt.
It will take a TWAP of the average of each minutely close from FTX, Binance and Okex if those exchanges have the symbol listed.
Here is a python code snippet on how that fallback price is calculated:
import ccxt
import pandas as pd
import datetime
time_since = 1648171800*1000
okex = ccxt.okex()
okex_px = pd.DataFrame(okex.fetchOHLCV("SRM/USDT", '1m', since=time_since, limit=30),
columns=["time", "open", "high", "low", "close_okex", "volume"])
binance = ccxt.binance()
binance_px = pd.DataFrame(binance.fetchOHLCV("SRM/USDT", '1m', since=time_since, limit=30),
columns=["time", "open", "high", "low", "close_binance", "volume"])
data = cftx.fetchOHLCV("SRM/USD", '1m', since=time_since, limit=30)
ftx_px = pd.DataFrame(data, columns=["time", "open", "high", "low", "close_ftx", "volume"])
prices = [binance_px[["time", "close_binance"]].set_index("time"), okex_px[["time", "close_okex"]].set_index("time"), ftx_px[["time", "close_ftx"]].set_index("time")]
twaps = prices[0].join(prices[1:])
twaps["avg"] = twaps.mean(axis=1)
twaps.to_csv("SRM_settle.csv", index=False)