Lean
$LEAN_TAG$
|
Corporate related factor provider. Factors based on splits and dividends More...
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< BaseData > | GetSplitsAndDividends (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< IFactorRow > | GetEnumerator () |
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... | |
Corporate related factor provider. Factors based on splits and dividends
Definition at line 30 of file CorporateFactorProvider.cs.
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.
|
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.
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.
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.
date | The date to check the factor file for a dividend event |
priceFactorRatio | When 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) |
referencePrice | When 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.
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.
date | The date to check the factor file for a split event |
splitFactor | When this function returns true, this value will be populated with the split factor ratio required to scale the closing value |
referencePrice | When 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.
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
symbol | The symbol to ues for the dividend and split objects |
exchangeHours | Exchange hours used for resolving the previous trading day |
decimalPlaces | The number of decimal places to round the dividend's distribution to, defaulting to 2 |
Definition at line 176 of file CorporateFactorProvider.cs.
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.
data | The data to apply |
exchangeHours | Exchange hours used for resolving the previous trading day |
Definition at line 215 of file CorporateFactorProvider.cs.