Created
March 3, 2025 05:18
-
-
Save databento-bot/00274853c3cc55bd4a89b030d4484c77 to your computer and use it in GitHub Desktop.
Compare Databento vs. CME end-of-day settlement volumes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum | |
import databento as db | |
import pandas as pd | |
class Stat(Enum): | |
SETTLEMENT_VOLUME = 6 | |
client = db.Historical() | |
data = client.timeseries.get_range( | |
dataset="GLBX.MDP3", | |
schema="statistics", | |
stype_in="parent", | |
symbols=["SR3.OPT"], | |
start="2024-10-16", # CME publishes previous trade date's settlement volume on next day | |
end="2024-10-17", | |
) | |
df = data.to_df() | |
df = df[df["symbol"].str.startswith("SR3Z4")] | |
df = df[df.stat_type == Stat.SETTLEMENT_VOLUME.value] | |
df = df.groupby("symbol").last()[["quantity"]].rename({"quantity": "volume_databento"}, axis="columns") | |
def symbol_rename(s): | |
strike = s.split(" ")[0] | |
put_call = "C" if s.endswith("Call") else "P" | |
return f"SR3Z4 {put_call}{strike}" | |
# Official statistics from: | |
# https://www.cmegroup.com/markets/interest-rates/stirs/three-month-sofr.volume.options.html | |
# https://www.cmegroup.com/CmeWS/exp/voiProductDetailsViewExport.ctl?media=xls&tradeDate=20241015&reportType=F&productId=8462 | |
# Expiration: Dec 2024 | |
# Trade date: Tuesday, 15 Oct 24 | |
# Last updated: 16 Oct 2024 09:02:47 AM CT | |
df_cme = pd.read_csv("cme_voi_details.csv", sep="\t", thousands=",") | |
df_cme = df_cme[["strike", "volume_total"]] | |
df_cme = df_cme.rename({"strike": "symbol", "volume_total": "volume_cme"}, axis="columns") | |
df_cme["symbol"] = df_cme["symbol"].apply(symbol_rename) | |
df_cme["volume_cme"] = df_cme["volume_cme"].astype("Int64") | |
df_merged = pd.merge(df, df_cme, on="symbol", how="left") | |
df_merged.to_csv("comparison-databento-vs-cme.csv", index=False) | |
print(df_merged) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment