finds.structured.benchmarks
Benchmarks dataset for index returns
Copyright 2022, Terence Lim
MIT License
- class finds.structured.benchmarks.Benchmarks(sql: SQL, bd: BusDay, verbose: int = 0)[source]
Bases:
Stocks
Provide Structured Stocks interface to benchmark and index returns
- load_series(df: DataFrame, name: str, item: str = '', monthly: bool = False) DataFrame [source]
Loads a Series containing benchmark returns to sql
- Parameters:
df – DataFrame with time-series in each column to load to sql
name – Primary description to insert into ident table
item – Secondary description to insert into ident table
monthly – if True: convert index to business calendar endmo dates
- Returns:
DataFrame of identifiers metadata for series successfully loaded
Notes:
Each column of input data frame is loaded to sql table ‘daily’, with its series name as ‘permno’ field, values as ‘ret’ field, and series index as ‘date’ field.
‘idents’ table in sql is updated with identifier and descriptive info