MarketCapWeightedIndex

MarketCapWeightedIndex#

class sigtech.framework.instruments.indices.MarketCapWeightedIndex

Baseclasses: Index

A class representing market cap-weighted indices.

constituents(start_datetime: datetime = None) DataFrame

Index constituents.

Parameters:

start_datetime – Starting point in time of the index constituents (optional).

Returns:

pandas DataFrame containing the index constituents.

constituents_dict(dates: list = None, start_date: datetime = None, end_date: datetime = None) dict[datetime.datetime, dict[str, float]]

Return a dict containing the index constituents and relative weights given a range or list of dates. If no parameters are provided, the dict will contain the most recent list of constituents.

Parameters:
  • datesDatetimeIndex or datetime list (optional).

  • start_date – Start datetime (optional).

  • end_date – End datetime (optional).

Returns:

dict.

data_df(data_point: DataPoint = None, multi_index: bool = False, drop_nan_cols: bool = False, pretty_print=True) DataFrame

Return a DataFrame containing all data available for this object.

Parameters:
  • data_point – Optional data point used to load the object history.

  • multi_index – If set to True, rows are uniquely indexed by a multi index (if applicable). Default is False.

  • drop_nan_cols – If set to True, all-NaN columns are dropped. Default is False.

  • pretty_print – If set to True, formatting is added to columns names and data values. Rates will be represented as percentage number instead of decimal number (e.g. 3.5 instead of 0.035).

Returns:

pandas DataFrame.