Lean  $LEAN_TAG$
QuantConnect.Algorithm.Framework.Alphas.PearsonCorrelationPairsTradingAlphaModel Class Reference

This alpha model is designed to rank every pair combination by its pearson correlation and trade the pair with the hightest correlation This model generates alternating long ratio/short ratio insights emitted as a group More...

Inheritance diagram for QuantConnect.Algorithm.Framework.Alphas.PearsonCorrelationPairsTradingAlphaModel:
[legend]

Public Member Functions

 PearsonCorrelationPairsTradingAlphaModel (int lookback=15, Resolution resolution=Resolution.Minute, decimal threshold=1m, double minimumCorrelation=.5)
 Initializes a new instance of the PearsonCorrelationPairsTradingAlphaModel class More...
 
override void OnSecuritiesChanged (QCAlgorithm algorithm, SecurityChanges changes)
 Event fired each time the we add/remove securities from the data feed More...
 
override bool HasPassedTest (QCAlgorithm algorithm, Symbol asset1, Symbol asset2)
 Check whether the assets pass a pairs trading test More...
 
- Public Member Functions inherited from QuantConnect.Algorithm.Framework.Alphas.BasePairsTradingAlphaModel
 BasePairsTradingAlphaModel (int lookback=1, Resolution resolution=Resolution.Daily, decimal threshold=1m)
 Initializes a new instance of the BasePairsTradingAlphaModel class More...
 
override IEnumerable< InsightUpdate (QCAlgorithm algorithm, Slice data)
 Updates this alpha model with the latest data from the algorithm. This is called each time the algorithm receives data for subscribed securities More...
 
- Public Member Functions inherited from QuantConnect.Algorithm.Framework.Alphas.AlphaModel
 AlphaModel ()
 Initialize new AlphaModel More...
 

Additional Inherited Members

- Properties inherited from QuantConnect.Algorithm.Framework.Alphas.BasePairsTradingAlphaModel
HashSet< SecuritySecurities [get]
 List of security objects present in the universe More...
 
- Properties inherited from QuantConnect.Algorithm.Framework.Alphas.AlphaModel
virtual string Name [get, set]
 Defines a name for a framework model More...
 
- Properties inherited from QuantConnect.Algorithm.Framework.Alphas.INamedModel
string Name [get]
 Defines a name for a framework model More...
 

Detailed Description

This alpha model is designed to rank every pair combination by its pearson correlation and trade the pair with the hightest correlation This model generates alternating long ratio/short ratio insights emitted as a group

Definition at line 30 of file PearsonCorrelationPairsTradingAlphaModel.cs.

Constructor & Destructor Documentation

◆ PearsonCorrelationPairsTradingAlphaModel()

QuantConnect.Algorithm.Framework.Alphas.PearsonCorrelationPairsTradingAlphaModel.PearsonCorrelationPairsTradingAlphaModel ( int  lookback = 15,
Resolution  resolution = Resolution.Minute,
decimal  threshold = 1m,
double  minimumCorrelation = .5 
)

Initializes a new instance of the PearsonCorrelationPairsTradingAlphaModel class

Parameters
lookbackLookback period of the analysis
resolutionAnalysis resolution
thresholdThe percent [0, 100] deviation of the ratio from the mean before emitting an insight
minimumCorrelationThe minimum correlation to consider a tradable pair

Definition at line 44 of file PearsonCorrelationPairsTradingAlphaModel.cs.

Member Function Documentation

◆ OnSecuritiesChanged()

override void QuantConnect.Algorithm.Framework.Alphas.PearsonCorrelationPairsTradingAlphaModel.OnSecuritiesChanged ( QCAlgorithm  algorithm,
SecurityChanges  changes 
)
virtual

Event fired each time the we add/remove securities from the data feed

Parameters
algorithmThe algorithm instance that experienced the change in securities
changesThe security additions and removals from the algorithm

Reimplemented from QuantConnect.Algorithm.Framework.Alphas.BasePairsTradingAlphaModel.

Definition at line 57 of file PearsonCorrelationPairsTradingAlphaModel.cs.

Here is the call graph for this function:

◆ HasPassedTest()

override bool QuantConnect.Algorithm.Framework.Alphas.PearsonCorrelationPairsTradingAlphaModel.HasPassedTest ( QCAlgorithm  algorithm,
Symbol  asset1,
Symbol  asset2 
)
virtual

Check whether the assets pass a pairs trading test

Parameters
algorithmThe algorithm instance that experienced the change in securities
asset1The first asset's symbol in the pair
asset2The second asset's symbol in the pair
Returns
True if the statistical test for the pair is successful

Reimplemented from QuantConnect.Algorithm.Framework.Alphas.BasePairsTradingAlphaModel.

Definition at line 93 of file PearsonCorrelationPairsTradingAlphaModel.cs.


The documentation for this class was generated from the following file: