arbitragelab.cointegration_approach.base
Base class for cointegration approach in statistical arbitrage.
Module Contents
Classes
Class for portfolios formed using the cointegration method (Johansen test, Engle-Granger test). |
- class CointegratedPortfolio
Bases:
abc.ABC
Class for portfolios formed using the cointegration method (Johansen test, Engle-Granger test).
- __slots__ = ()
- construct_mean_reverting_portfolio(price_data: pandas.DataFrame, cointegration_vector: pandas.Series = None) pandas.Series
When cointegration vector was formed, this function is used to multiply asset prices by cointegration vector to form mean-reverting portfolio which is analyzed for possible trade signals.
- Parameters:
price_data – (pd.DataFrame) Price data with columns containing asset prices.
cointegration_vector – (pd.Series) Cointegration vector used to form a mean-reverting portfolio. If None, a cointegration vector with maximum eigenvalue from fit() method is used.
- Returns:
(pd.Series) Cointegrated portfolio dollar value.
- get_scaled_cointegration_vector(cointegration_vector: pandas.Series = None) pandas.Series
This function returns the scaled values of the cointegration vector in terms of how many units of other cointegrated assets should be bought if we buy one unit of one asset.
- Parameters:
cointegration_vector – (pd.Series) Cointegration vector used to form a mean-reverting portfolio. If None, a cointegration vector with maximum eigenvalue from fit() method is used.
- Returns:
(pd.Series) The scaled cointegration vector values.