quantdata.massive.expiries#

quantdata.massive.expiries

Per-ticker option expiry flags via the Massive API.

For each trading day, checks whether ANY option on the underlying expires on that day and classifies it (MONTHLY, QUAD_WITCHING, etc.).

The ticker_expiries() function uses an incremental cache: it only fetches the dates that are not already stored, so repeated calls for overlapping date ranges are cheap.

quantdata.massive.expiries.classify_expiry(df)[source]#

Add has_expiry (Int8, values from quantdata.tickers.ticker_calendar.EXPIRY) to a DataFrame that already contains a date column of trading days.

The classification is purely calendar-based:

  • EXPIRY.QUAD_WITCHING: shifted third Friday of Mar/Jun/Sep/Dec

  • EXPIRY.MONTHLY: shifted third Friday of other months

  • EXPIRY.NORMAL: any other trading day

quantdata.massive.expiries.ticker_expiries_day(ticker, dt)[source]#

Check via the Massive API whether any option on ticker expires on dt.

Returns:

expiry_code is an EXPIRY int value, or None if no options expire.

Return type:

(dt, expiry_code)

quantdata.massive.expiries.ticker_expiries(ticker, business_days, *, num_workers=-2, threading=False, verbose=<cdxcore.verbose.Context object>)[source]#

For each date in business_days, flag whether any option on ticker expires (0-DTE check) and return the expiry type.

Results are stored in an incremental cache keyed by ticker so only the missing dates are fetched on subsequent calls.

Parameters:
  • ticker (str)

  • business_days (list[date]) – Sorted list of NYSE trading days to check.

  • num_workers (int) – Parallel workers.

  • threading (bool) – Use threads instead of processes.

  • verbose (Context)

Returns:

Columns: date (Date), has_expiry (Int8) — only rows where has_expiry is not null.

Return type:

pl.DataFrame