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

This alpha model is designed to accept every possible pair combination from securities selected by the universe selection model This model generates alternating long ratio/short ratio insights emitted as a group More...

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

Public Member Functions

 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...
 
override void OnSecuritiesChanged (QCAlgorithm algorithm, SecurityChanges changes)
 Event fired each time the we add/remove securities from the data feed More...
 
virtual 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.AlphaModel
 AlphaModel ()
 Initialize new AlphaModel More...
 

Properties

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 accept every possible pair combination from securities selected by the universe selection model This model generates alternating long ratio/short ratio insights emitted as a group

Definition at line 33 of file BasePairsTradingAlphaModel.cs.

Constructor & Destructor Documentation

◆ BasePairsTradingAlphaModel()

QuantConnect.Algorithm.Framework.Alphas.BasePairsTradingAlphaModel.BasePairsTradingAlphaModel ( int  lookback = 1,
Resolution  resolution = Resolution.Daily,
decimal  threshold = 1m 
)

Initializes a new instance of the BasePairsTradingAlphaModel class

Parameters
lookbackLookback period of the analysis
resolutionAnalysis resolution
thresholdThe percent [0, 100] deviation of the ratio from the mean before emitting an insight

Definition at line 52 of file BasePairsTradingAlphaModel.cs.

Member Function Documentation

◆ Update()

override IEnumerable<Insight> QuantConnect.Algorithm.Framework.Alphas.BasePairsTradingAlphaModel.Update ( QCAlgorithm  algorithm,
Slice  data 
)
virtual

Updates this alpha model with the latest data from the algorithm. This is called each time the algorithm receives data for subscribed securities

Parameters
algorithmThe algorithm instance
dataThe new data available
Returns
The new insights generated

Reimplemented from QuantConnect.Algorithm.Framework.Alphas.AlphaModel.

Definition at line 75 of file BasePairsTradingAlphaModel.cs.

◆ OnSecuritiesChanged()

override void QuantConnect.Algorithm.Framework.Alphas.BasePairsTradingAlphaModel.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.AlphaModel.

Reimplemented in QuantConnect.Algorithm.Framework.Alphas.PearsonCorrelationPairsTradingAlphaModel.

Definition at line 92 of file BasePairsTradingAlphaModel.cs.

Here is the call graph for this function:

◆ HasPassedTest()

virtual bool QuantConnect.Algorithm.Framework.Alphas.BasePairsTradingAlphaModel.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 in QuantConnect.Algorithm.Framework.Alphas.PearsonCorrelationPairsTradingAlphaModel.

Property Documentation

◆ Securities

HashSet<Security> QuantConnect.Algorithm.Framework.Alphas.BasePairsTradingAlphaModel.Securities
get

List of security objects present in the universe

Definition at line 44 of file BasePairsTradingAlphaModel.cs.


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