arbitragelab.hedge_ratios.spread_construction

Utility functions used to construct spreads.

Module Contents

Functions

construct_spread(→ pandas.Series)

Construct spread from price_data and hedge_ratios. If a user sets dependent_variable it means that a

construct_spread(price_data: pandas.DataFrame, hedge_ratios: pandas.Series, dependent_variable: str = None) pandas.Series

Construct spread from price_data and hedge_ratios. If a user sets dependent_variable it means that a spread will be:

hedge_ratio_dependent_variable * dependent_variable - sum(hedge_ratios * other variables). Otherwise, spread is: hedge_ratio_0 * variable_0 - sum(hedge ratios * variables[1:]).

Parameters:
  • price_data – (pd.DataFrame) Asset prices data frame.

  • hedge_ratios – (pd.Series) Hedge ratios series (index-tickers, values-hedge ratios).

  • dependent_variable – (str) Dependent variable to use. Set None for dependent variable being equal to 0 column.

Returns:

(pd.Series) Spread series.