volkit.datasets¶
This module contains sample datasets
- volkit.datasets.spxw(min_volume=0, D=None, *, full=False)[source]¶
Load a sample SPXW options slice and apply simple filters.
- Parameters:
min_volume (int, default 0) – Minimum per-option trade volume required for both the call and the put at a given strike. Rows are kept only if
C_vol >= min_volumeandP_vol >= min_volume. Use0to disable the volume filter.D (int or None, default None) – If provided, keep only rows whose computed calendar days-to-expiry equals this value. For example,
D=7keeps only the 7-calendar-day slice. UseNoneto keep all expiries.full (bool, default False) –
Select between a compact, most-relevant schema (False) and a full schema (True).
- When
full=False(default), return: ["K", "D", "T"]— strike and days/time to expiry["F_bid", "F_ask"]— underlying future quotes["C_bid", "C_ask", "P_bid", "P_ask"]— call/put quotes["C_vol", "P_vol"]— call/put traded volume (day)
- When
full=True, additionally include: ["quote_date", "expiration_date"]— actual datetimes["C_bid_size", "C_ask_size", "P_bid_size", "P_ask_size"]— order book sizes["C_oi", "P_oi"]— open interest
- When
- Returns:
One row per strike with at least:
K,D,Tand the selected extra columns.- Return type:
pandas.DataFrame
Notes
Tuses 252 trading days/year to align with options practice. If you prefer ACT/365 or ACT/ACT, convert after loading.Date columns (
quote_date,expiration_date) are parsed as datetimes.
Examples
Load defaults (compact schema): >>> df = spxw()
Keep only options with at least 100 contracts traded on both sides: >>> df = spxw(min_volume=100)
Work with a single tenor (e.g., 7 days to expiry): >>> df_7 = spxw(D=7)
Get the full column set: >>> df_full = spxw(full=True)