Integrate Volatility Pricing into Friktion Frontend

I think users would like to know their chance of getting exercised at all points within each epoch.
This project is part of a larger goal of a portfolio page.
It will help users get a better understanding of how their portfolio is performing.

What we need:

  1. Systematically scrape spot prices + calculate historical realized volatility

  2. Scrape options data from CEX options exchange (deribit directly or via gvol for BTC/ETH, for SOL)

  3. Map altcoin vol from BTC/ETH/VOL (will work with you on this)

  4. Create a function given current time, expiry, current spot, and strike, return an estimate for % ending in expiry. (can use naive black scholes, will work with you on this)

  5. Use this estimate to show users their “danger level” at all times on the personal portfolio page. (optional)

This is a Data collection/automation task that will be helpful for the protocol’s users.
The most important part is creating a production-level reliable process that will serve the front-end

Proposed Grant size:
5 Lightning OGs

1 Like

As discussed on Discord, here are some helpful materials:

  1. Realized Volatility Scraping code:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

import requests
import json
import ccxt

import datetime

cftx = ccxt.ftx(

markets = cftx.load_markets()
binance = ccxt.binance()

# 10 days
time_since = datetime.datetime.timestamp(*1000-10*24*60*60*1000

symbols = [

data_dict = {}
for symbol in symbols:
    data = cftx.fetchOHLCV(symbol, '1d', since=time_since, limit=10)
    df = pd.DataFrame(data, columns=["time", "open", "high", "low", "close", "volume"])
    data_dict[symbol] = df
    df["vol"] = np.log(df.high/df.low)**2
    sample = pd.DataFrame(data, columns=["time", "open", "high", "low", "close", "volume"])
    print("{} 10-day Realized Vol: {}".format(symbol, np.sqrt(df.vol.sum()*1/(4*10*np.log(2)))*np.sqrt(365)*100))
    print("{}: {:.6f}".format(symbol, sample.close.mean()))
  1. Volatility Data:
    Switchboard or Deribit
    GitHub - switchboard-xyz/switchboardv2-py-api

I’ve gotten most of this one done here: GitHub - Sharpieman20/task-bounties

Still working on getting it integrated into the frontend, but hopefully we can get it closed out soon!