quantdata.tickers.ticker_calendar#
quantdata.tickers.ticker_calendar#
Build a calendar for a given ticker:
Option Expiries (standard mechanical ones, i.e. monthly, quarterly, EOM)
Dividends
Stock splits
Ticker changes (e.g. name changes, ticker changes, etc.)
Earnings (from Yahoo Finance, as these are not easily available from other sources)
- class quantdata.tickers.ticker_calendar.EXPIRY(*values)[source]#
Bases:
IntEnumExpory codes
- NONE = 0#
- STANDARD = 1#
- QUAD_WITCHING = 2#
- MONTHLY = 3#
- QUARTERLY = 4#
- EOM = 5#
- quantdata.tickers.ticker_calendar.SCHEMA_TICKER_CALENDAR = {'date': Date, 'expiry_code': Int8, 'has_ticker_change': Boolean, 'is_earnings': Boolean, 'is_ex_div': Boolean, 'is_half_day': Boolean, 'is_split': Boolean}#
Schema of the
polars.DataFramereturned bybuild_ticker_calendar().
- quantdata.tickers.ticker_calendar.get_standard_expiries(date_range)[source]#
Computes standard expiry codes for a list of dates. Expiry codes computed by this function are mechanical:
QUAD_WITCHING: third friday of March, June, September, DecemberMONTHLY: third friday of other monthsEOM: last business day of the monthQUARTERLY: quarterly expiry, i.e. last business day of the month of March, June, September, December
- Parameters:
date_range (
DateRange) – Date range for which to compute expiry codes. The function will only return expiry codes for dates within this range.- Returns:
Expiries – DataFrame with columns: *
date: date of the expiry *expiry_code: expiry code, one of the values of theEXPIRYenum.- Return type:
polars.DataFrame
- quantdata.tickers.ticker_calendar.has_dividends(ticker, start, end)[source]#
Retrieve dividends between two dates from [
/stocks/v1/dividends](https://massive.com/docs/api/stocks/v1/dividends/).
- quantdata.tickers.ticker_calendar.has_splits(ticker, start, end)[source]#
Retrieve stock splits between two dates from [
/stocks/v1/splits](https://massive.com/docs/api/stocks/v1/splits/).
- quantdata.tickers.ticker_calendar.build_ticker_calendar(ticker, date_range, *, verbose=<cdxcore.verbose.Context object>)[source]#
Build a per-day ticker-specific calendar for a given equity ticker.
- Parameters:
- Returns:
Calendar – DataFrame with the schema
SCHEMA_TICKER_CALENDARwith columns:date: date of the calendar entryexpiry_code: expiry code, one of the values of theEXPIRYenum, indicating the type of expiry on that date (if any).is_ex_div: boolean indicating whether this date is an ex-dividend date for the ticker.is_split: boolean indicating whether this date is a stock split date for the ticker.has_ticker_change: boolean indicating whether this date has a ticker change event for the ticker.is_earnings: boolean indicating whether this date is an earnings date for the ticker.is_half_day: boolean indicating whether this date is a half trading day (e.g. day before a holiday).
- Return type:
polars.DataFrame