Lean  $LEAN_TAG$
QuantConnect.Data.Auxiliary.CorporateFactorProvider Class Reference

Corporate related factor provider. Factors based on splits and dividends More...

Inheritance diagram for QuantConnect.Data.Auxiliary.CorporateFactorProvider:
[legend]

Public Member Functions

 CorporateFactorProvider (string permtick, IEnumerable< CorporateFactorRow > data, DateTime? factorFileMinimumDate=null)
 Creates a new instance More...
 
override decimal GetPriceFactor (DateTime searchDate, DataNormalizationMode dataNormalizationMode, DataMappingMode? dataMappingMode=null, uint contractOffset=0)
 Gets the price scale factor that includes dividend and split adjustments for the specified search date More...
 
CorporateFactorRow GetScalingFactors (DateTime searchDate)
 Gets price and split factors to be applied at the specified date More...
 
bool HasDividendEventOnNextTradingDay (DateTime date, out decimal priceFactorRatio, out decimal referencePrice)
 Returns true if the specified date is the last trading day before a dividend event is to be fired More...
 
bool HasSplitEventOnNextTradingDay (DateTime date, out decimal splitFactor, out decimal referencePrice)
 Returns true if the specified date is the last trading day before a split event is to be fired More...
 
List< BaseDataGetSplitsAndDividends (Symbol symbol, SecurityExchangeHours exchangeHours, int decimalPlaces=2)
 Gets all of the splits and dividends represented by this factor file More...
 
CorporateFactorProvider Apply (List< BaseData > data, SecurityExchangeHours exchangeHours)
 Creates a new factor file with the specified data applied. Only Dividend and Split data types will be used. More...
 
- Public Member Functions inherited from QuantConnect.Data.Auxiliary.FactorFile< CorporateFactorRow >
IEnumerable< string > GetFileFormat ()
 Writes this factor file data to an enumerable of csv lines More...
 
void WriteToFile (Symbol symbol)
 Write the factor file to the correct place in the default Data folder More...
 
IEnumerator< IFactorRowGetEnumerator ()
 Returns an enumerator that iterates through the collection. More...
 

Additional Inherited Members

- Public Attributes inherited from QuantConnect.Data.Auxiliary.FactorFile< CorporateFactorRow >
DateTime MostRecentFactorChange
 Gets the most recent factor change in the factor file More...
 
- Protected Member Functions inherited from QuantConnect.Data.Auxiliary.FactorFile< CorporateFactorRow >
 FactorFile (string permtick, IEnumerable< T > data, DateTime? factorFileMinimumDate=null)
 Initializes a new instance of the FactorFile class. More...
 
- Protected Attributes inherited from QuantConnect.Data.Auxiliary.FactorFile< CorporateFactorRow >
readonly List< DateTime > _reversedFactorFileDates
 Keeping a reversed version is more performant that reversing it each time we need it More...
 
- Properties inherited from QuantConnect.Data.Auxiliary.FactorFile< CorporateFactorRow >
SortedList< DateTime, List< T > > SortedFactorFileData [get, set]
 The factor file data rows sorted by date More...
 
DateTime? FactorFileMinimumDate [get, set]
 The minimum tradeable date for the symbol More...
 
string Permtick [get]
 Gets the symbol this factor file represents More...
 

Detailed Description

Corporate related factor provider. Factors based on splits and dividends

Definition at line 30 of file CorporateFactorProvider.cs.

Constructor & Destructor Documentation

◆ CorporateFactorProvider()

QuantConnect.Data.Auxiliary.CorporateFactorProvider.CorporateFactorProvider ( string  permtick,
IEnumerable< CorporateFactorRow data,
DateTime?  factorFileMinimumDate = null 
)

Creates a new instance

Definition at line 35 of file CorporateFactorProvider.cs.

Here is the caller graph for this function:

Member Function Documentation

◆ GetPriceFactor()

override decimal QuantConnect.Data.Auxiliary.CorporateFactorProvider.GetPriceFactor ( DateTime  searchDate,
DataNormalizationMode  dataNormalizationMode,
DataMappingMode dataMappingMode = null,
uint  contractOffset = 0 
)
virtual

Gets the price scale factor that includes dividend and split adjustments for the specified search date

Implements QuantConnect.Data.Auxiliary.FactorFile< CorporateFactorRow >.

Definition at line 42 of file CorporateFactorProvider.cs.

◆ GetScalingFactors()

CorporateFactorRow QuantConnect.Data.Auxiliary.CorporateFactorProvider.GetScalingFactors ( DateTime  searchDate)

Gets price and split factors to be applied at the specified date

Definition at line 81 of file CorporateFactorProvider.cs.

◆ HasDividendEventOnNextTradingDay()

bool QuantConnect.Data.Auxiliary.CorporateFactorProvider.HasDividendEventOnNextTradingDay ( DateTime  date,
out decimal  priceFactorRatio,
out decimal  referencePrice 
)

Returns true if the specified date is the last trading day before a dividend event is to be fired

NOTE: The dividend event in the algorithm should be fired at the end or AFTER this date. This is the date in the file that a factor is applied, so for example, MSFT has a 31 cent dividend on 2015.02.17, but in the factor file the factor is applied to 2015.02.13, which is the first trading day BEFORE the actual effective date.

Parameters
dateThe date to check the factor file for a dividend event
priceFactorRatioWhen this function returns true, this value will be populated with the price factor ratio required to scale the closing value (pf_i/pf_i+1)
referencePriceWhen this function returns true, this value will be populated with the reference raw price, which is the close of the provided date

Definition at line 110 of file CorporateFactorProvider.cs.

◆ HasSplitEventOnNextTradingDay()

bool QuantConnect.Data.Auxiliary.CorporateFactorProvider.HasSplitEventOnNextTradingDay ( DateTime  date,
out decimal  splitFactor,
out decimal  referencePrice 
)

Returns true if the specified date is the last trading day before a split event is to be fired

NOTE: The split event in the algorithm should be fired at the end or AFTER this date. This is the date in the file that a factor is applied, so for example MSFT has a split on 1999.03.29, but in the factor file the split factor is applied on 1999.03.26, which is the first trading day BEFORE the actual split date.

Parameters
dateThe date to check the factor file for a split event
splitFactorWhen this function returns true, this value will be populated with the split factor ratio required to scale the closing value
referencePriceWhen this function returns true, this value will be populated with the reference raw price, which is the close of the provided date

Definition at line 147 of file CorporateFactorProvider.cs.

◆ GetSplitsAndDividends()

List<BaseData> QuantConnect.Data.Auxiliary.CorporateFactorProvider.GetSplitsAndDividends ( Symbol  symbol,
SecurityExchangeHours  exchangeHours,
int  decimalPlaces = 2 
)

Gets all of the splits and dividends represented by this factor file

Parameters
symbolThe symbol to ues for the dividend and split objects
exchangeHoursExchange hours used for resolving the previous trading day
decimalPlacesThe number of decimal places to round the dividend's distribution to, defaulting to 2
Returns
All splits and dividends represented by this factor file in chronological order

Definition at line 176 of file CorporateFactorProvider.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Apply()

CorporateFactorProvider QuantConnect.Data.Auxiliary.CorporateFactorProvider.Apply ( List< BaseData data,
SecurityExchangeHours  exchangeHours 
)

Creates a new factor file with the specified data applied. Only Dividend and Split data types will be used.

Parameters
dataThe data to apply
exchangeHoursExchange hours used for resolving the previous trading day
Returns
A new factor file that incorporates the specified dividend

Definition at line 215 of file CorporateFactorProvider.cs.

Here is the call graph for this function:

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