Lean
$LEAN_TAG$
|
Abstract base data class of QuantConnect. It is intended to be extended to define generic user customizable data types while at the same time implementing the basics of data where possible More...
Public Member Functions | |
BaseData () | |
Constructor for initialising the dase data class More... | |
virtual BaseData | Reader (SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode) |
Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object each time it is called. The returned object is assumed to be time stamped in the config.ExchangeTimeZone. More... | |
virtual BaseData | Reader (SubscriptionDataConfig config, StreamReader stream, DateTime date, bool isLiveMode) |
Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object each time it is called. The returned object is assumed to be time stamped in the config.ExchangeTimeZone. More... | |
virtual SubscriptionDataSource | GetSource (SubscriptionDataConfig config, DateTime date, bool isLiveMode) |
Return the URL string source of the file. This will be converted to a stream More... | |
virtual bool | RequiresMapping () |
Indicates if there is support for mapping More... | |
virtual bool | IsSparseData () |
Indicates that the data set is expected to be sparse More... | |
virtual bool | ShouldCacheToSecurity () |
Indicates whether this contains data that should be stored in the security cache More... | |
virtual Resolution | DefaultResolution () |
Gets the default resolution for this data and security type More... | |
virtual List< Resolution > | SupportedResolutions () |
Gets the supported resolution for this data and security type More... | |
virtual DateTimeZone | DataTimeZone () |
Specifies the data time zone for this data type. This is useful for custom data types More... | |
void | UpdateTrade (decimal lastTrade, decimal tradeSize) |
Updates this base data with a new trade More... | |
void | UpdateQuote (decimal bidPrice, decimal bidSize, decimal askPrice, decimal askSize) |
Updates this base data with new quote information More... | |
void | UpdateBid (decimal bidPrice, decimal bidSize) |
Updates this base data with the new quote bid information More... | |
void | UpdateAsk (decimal askPrice, decimal askSize) |
Updates this base data with the new quote ask information More... | |
virtual void | Update (decimal lastTrade, decimal bidPrice, decimal askPrice, decimal volume, decimal bidSize, decimal askSize) |
Update routine to build a bar/tick from a data update. More... | |
virtual BaseData | Clone (bool fillForward) |
Return a new instance clone of this object, used in fill forward More... | |
virtual BaseData | Clone () |
Return a new instance clone of this object, used in fill forward More... | |
override string | ToString () |
Formats a string with the symbol and value. More... | |
virtual BaseData | Reader (SubscriptionDataConfig config, string line, DateTime date, DataFeedEndpoint dataFeed) |
Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object each time it is called. More... | |
virtual string | GetSource (SubscriptionDataConfig config, DateTime date, DataFeedEndpoint datafeed) |
Return the URL string source of the file. This will be converted to a stream More... | |
Static Public Member Functions | |
static IEnumerable< BaseData > | DeserializeMessage (string serialized) |
Deserialize the message from the data server More... | |
Public Attributes | |
virtual decimal | Price => Value |
As this is a backtesting platform we'll provide an alias of value as price. More... | |
Static Protected Attributes | |
static readonly List< Resolution > | AllResolutions |
A list of all Resolution More... | |
static readonly List< Resolution > | DailyResolution = new List<Resolution> { Resolution.Daily } |
A list of Resolution.Daily More... | |
static readonly List< Resolution > | MinuteResolution = new List<Resolution> { Resolution.Minute } |
A list of Resolution.Minute More... | |
static readonly List< Resolution > | HighResolution = new List<Resolution> { Resolution.Minute, Resolution.Second, Resolution.Tick } |
A list of high Resolution, including minute, second, and tick. More... | |
static readonly List< Resolution > | OptionResolutions = new List<Resolution> { Resolution.Daily, Resolution.Hour, Resolution.Minute } |
A list of resolutions support by Options More... | |
Properties | |
MarketDataType | DataType = MarketDataType.Base [get, set] |
Market Data Type of this data - does it come in individual price packets or is it grouped into OHLC. More... | |
bool | IsFillForward [get] |
True if this is a fill forward piece of data More... | |
DateTime | Time [get, set] |
Current time marker of this data packet. More... | |
virtual DateTime | EndTime [get, set] |
The end time of this data. Some data covers spans (trade bars) and as such we want to know the entire time span covered More... | |
Symbol | Symbol = Symbol.Empty [get, set] |
Symbol representation for underlying Security More... | |
virtual decimal | Value [get, set] |
Value representation of this data packet. All data requires a representative value for this moment in time. For streams of data this is the price now, for OHLC packets this is the closing price. More... | |
Properties inherited from QuantConnect.Data.IBaseData | |
MarketDataType | DataType [get, set] |
Market Data Type of this data - does it come in individual price packets or is it grouped into OHLC. More... | |
DateTime | Time [get, set] |
Time keeper of data – all data is timeseries based. More... | |
DateTime | EndTime [get, set] |
End time of data More... | |
decimal | Value [get, set] |
All timeseries data is a time-value pair: More... | |
decimal | Price [get] |
Alias of Value. More... | |
Properties inherited from QuantConnect.Data.ISymbolProvider | |
Symbol | Symbol [get, set] |
Gets the Symbol More... | |
Abstract base data class of QuantConnect. It is intended to be extended to define generic user customizable data types while at the same time implementing the basics of data where possible
Definition at line 38 of file BaseData.cs.
QuantConnect.Data.BaseData.BaseData | ( | ) |
Constructor for initialising the dase data class
Definition at line 127 of file BaseData.cs.
|
virtual |
Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object each time it is called. The returned object is assumed to be time stamped in the config.ExchangeTimeZone.
config | Subscription data config setup object |
line | Line of the source document |
date | Date of the requested data |
isLiveMode | true if we're in live mode, false for backtesting mode |
Implements QuantConnect.Data.IBaseData.
Reimplemented in QuantConnect.Data.Market.Tick, QuantConnect.Data.Market.QuoteBar, QuantConnect.Data.Market.TradeBar, QuantConnect.Data.Custom.Tiingo.TiingoPrice, QuantConnect.Indicators.IndicatorDataPoint, QuantConnect.Data.Custom.Intrinio.IntrinioEconomicData, QuantConnect.Data.Custom.FxcmVolume, QuantConnect.Python.PythonData, QuantConnect.Data.Market.OpenInterest, QuantConnect.Data.Market.Dividend, QuantConnect.Data.UniverseSelection.CoarseFundamental, QuantConnect.Data.UniverseSelection.ETFConstituentUniverse, QuantConnect.Data.Market.Split, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData2, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData, QuantConnect.Data.Market.Delisting, QuantConnect.Data.UniverseSelection.ConstituentsUniverseData, QuantConnect.Data.Auxiliary.ZipEntryName, QuantConnect.Data.Custom.IconicTypes.UnlinkedDataTradeBar, QuantConnect.Data.Custom.IconicTypes.UnlinkedData, QuantConnect.Data.Fundamental.FundamentalUniverse, QuantConnect.Data.Market.BaseRenkoBar, and QuantConnect.Data.Custom.IconicTypes.LinkedData.
Definition at line 141 of file BaseData.cs.
|
virtual |
Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object each time it is called. The returned object is assumed to be time stamped in the config.ExchangeTimeZone.
config | Subscription data config setup object |
stream | The data stream |
date | Date of the requested data |
isLiveMode | true if we're in live mode, false for backtesting mode |
Implements QuantConnect.Data.IBaseData.
Reimplemented in QuantConnect.Data.Market.Tick, QuantConnect.Data.Market.QuoteBar, QuantConnect.Data.Market.TradeBar, QuantConnect.Data.UniverseSelection.OptionUniverse, and QuantConnect.Data.Market.MarginInterestRate.
Definition at line 159 of file BaseData.cs.
|
virtual |
Return the URL string source of the file. This will be converted to a stream
config | Configuration object |
date | Date of this source file |
isLiveMode | true if we're in live mode, false for backtesting mode |
Reimplemented in QuantConnect.Data.Market.TradeBar, QuantConnect.Data.Market.Tick, QuantConnect.Data.Market.QuoteBar, QuantConnect.Data.UniverseSelection.OptionUniverse, QuantConnect.Indicators.IndicatorDataPoint, QuantConnect.Data.Custom.Tiingo.TiingoPrice, QuantConnect.Data.Market.OpenInterest, QuantConnect.Data.Custom.Intrinio.IntrinioEconomicData, QuantConnect.Data.Market.Dividend, QuantConnect.Data.Market.Split, QuantConnect.Data.Custom.FxcmVolume, QuantConnect.Python.PythonData, QuantConnect.Data.Market.Delisting, QuantConnect.Data.UniverseSelection.CoarseFundamental, QuantConnect.Data.Auxiliary.ZipEntryName, QuantConnect.Data.Market.BaseRenkoBar, QuantConnect.Data.UniverseSelection.ETFConstituentUniverse, QuantConnect.Data.Market.MarginInterestRate, QuantConnect.Data.Market.SymbolChangedEvent, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData2, QuantConnect.Data.Fundamental.FundamentalUniverse, QuantConnect.Data.Custom.IconicTypes.UnlinkedDataTradeBar, QuantConnect.Data.UniverseSelection.ConstituentsUniverseData, QuantConnect.Data.Custom.IconicTypes.UnlinkedData, QuantConnect.Data.IndexedBaseData, and QuantConnect.Data.Custom.IconicTypes.LinkedData.
Definition at line 171 of file BaseData.cs.
|
virtual |
Indicates if there is support for mapping
Relies on the Symbol property value
Implements QuantConnect.Data.IBaseData.
Reimplemented in QuantConnect.Data.Custom.Tiingo.TiingoPrice, QuantConnect.Data.UniverseSelection.ETFConstituentUniverse, QuantConnect.Python.PythonData, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData2, QuantConnect.Data.UniverseSelection.ConstituentsUniverseData, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData, QuantConnect.Data.Custom.IconicTypes.UnlinkedDataTradeBar, QuantConnect.Data.Custom.IconicTypes.UnlinkedData, and QuantConnect.Data.Custom.IconicTypes.LinkedData.
Definition at line 201 of file BaseData.cs.
|
virtual |
Indicates that the data set is expected to be sparse
Relies on the Symbol property value
This is a method and not a property so that python custom data types can override it
Reimplemented in QuantConnect.Data.UniverseSelection.ETFConstituentUniverse, QuantConnect.Python.PythonData, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData2, QuantConnect.Data.UniverseSelection.ConstituentsUniverseData, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData, QuantConnect.Data.Custom.IconicTypes.UnlinkedDataTradeBar, QuantConnect.Data.Custom.IconicTypes.UnlinkedData, and QuantConnect.Data.Custom.IconicTypes.LinkedData.
Definition at line 213 of file BaseData.cs.
|
virtual |
Indicates whether this contains data that should be stored in the security cache
Reimplemented in QuantConnect.Data.UniverseSelection.BaseDataCollection, and QuantConnect.Data.Auxiliary.ZipEntryName.
Definition at line 223 of file BaseData.cs.
|
virtual |
Gets the default resolution for this data and security type
This is a method and not a property so that python custom data types can override it
Reimplemented in QuantConnect.Data.UniverseSelection.OptionUniverse, QuantConnect.Data.Custom.Tiingo.TiingoPrice, QuantConnect.Data.UniverseSelection.ETFConstituentUniverse, QuantConnect.Python.PythonData, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData2, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData, QuantConnect.Data.UniverseSelection.ConstituentsUniverseData, QuantConnect.Data.Custom.IconicTypes.UnlinkedDataTradeBar, QuantConnect.Data.Custom.IconicTypes.UnlinkedData, QuantConnect.Data.Custom.IconicTypes.LinkedData, and QuantConnect.Data.Fundamental.FundamentalUniverse.
Definition at line 233 of file BaseData.cs.
|
virtual |
Gets the supported resolution for this data and security type
Relies on the Symbol property value
This is a method and not a property so that python custom data types can override it
Reimplemented in QuantConnect.Data.Custom.Tiingo.TiingoPrice, QuantConnect.Data.UniverseSelection.ETFConstituentUniverse, QuantConnect.Python.PythonData, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData2, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData, QuantConnect.Data.UniverseSelection.ConstituentsUniverseData, QuantConnect.Data.Custom.IconicTypes.UnlinkedDataTradeBar, QuantConnect.Data.Custom.IconicTypes.UnlinkedData, and QuantConnect.Data.Custom.IconicTypes.LinkedData.
Definition at line 244 of file BaseData.cs.
|
virtual |
Specifies the data time zone for this data type. This is useful for custom data types
Will throw InvalidOperationException for security types other than SecurityType.Base
Reimplemented in QuantConnect.Data.UniverseSelection.ETFConstituentUniverse, QuantConnect.Data.Custom.Tiingo.TiingoPrice, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData2, QuantConnect.Data.Custom.IconicTypes.IndexedLinkedData, QuantConnect.Data.Custom.IconicTypes.UnlinkedDataTradeBar, QuantConnect.Data.Custom.IconicTypes.UnlinkedData, QuantConnect.Data.Custom.IconicTypes.LinkedData, and QuantConnect.Data.Market.MarginInterestRate.
Definition at line 260 of file BaseData.cs.
void QuantConnect.Data.BaseData.UpdateTrade | ( | decimal | lastTrade, |
decimal | tradeSize | ||
) |
Updates this base data with a new trade
lastTrade | The price of the last trade |
tradeSize | The quantity traded |
Definition at line 274 of file BaseData.cs.
void QuantConnect.Data.BaseData.UpdateQuote | ( | decimal | bidPrice, |
decimal | bidSize, | ||
decimal | askPrice, | ||
decimal | askSize | ||
) |
Updates this base data with new quote information
bidPrice | The current bid price |
bidSize | The current bid size |
askPrice | The current ask price |
askSize | The current ask size |
Definition at line 286 of file BaseData.cs.
void QuantConnect.Data.BaseData.UpdateBid | ( | decimal | bidPrice, |
decimal | bidSize | ||
) |
Updates this base data with the new quote bid information
bidPrice | The current bid price |
bidSize | The current bid size |
Definition at line 296 of file BaseData.cs.
void QuantConnect.Data.BaseData.UpdateAsk | ( | decimal | askPrice, |
decimal | askSize | ||
) |
Updates this base data with the new quote ask information
askPrice | The current ask price |
askSize | The current ask size |
Definition at line 306 of file BaseData.cs.
|
virtual |
Update routine to build a bar/tick from a data update.
lastTrade | The last trade price |
bidPrice | Current bid price |
askPrice | Current asking price |
volume | Volume of this trade |
bidSize | The size of the current bid, if available |
askSize | The size of the current ask, if available |
Reimplemented in QuantConnect.Data.Market.TradeBar, QuantConnect.Data.Market.Tick, and QuantConnect.Data.Market.QuoteBar.
Definition at line 320 of file BaseData.cs.
|
virtual |
Return a new instance clone of this object, used in fill forward
This base implementation uses reflection to copy all public fields and properties
fillForward | True if this is a fill forward clone |
Reimplemented in QuantConnect.Data.Market.TradeBar.
Definition at line 333 of file BaseData.cs.
|
virtual |
Return a new instance clone of this object, used in fill forward
This base implementation uses reflection to copy all public fields and properties
Implements QuantConnect.Data.IBaseData.
Reimplemented in QuantConnect.Data.Market.TradeBar, QuantConnect.Data.Market.Tick, QuantConnect.Data.Market.QuoteBar, QuantConnect.Data.Market.OptionChain, QuantConnect.Data.Market.FuturesChain, QuantConnect.Data.UniverseSelection.OptionUniverse, QuantConnect.Data.UniverseSelection.BaseDataCollection, QuantConnect.Data.DynamicData, QuantConnect.Data.Market.RenkoBar, QuantConnect.Data.Market.OpenInterest, QuantConnect.Data.UniverseSelection.ETFConstituentUniverse, QuantConnect.Data.Market.Dividend, QuantConnect.Data.Market.Split, QuantConnect.Data.Market.RangeBar, QuantConnect.Data.Market.Delisting, QuantConnect.Data.Fundamental.FundamentalUniverse, and QuantConnect.Data.Market.SymbolChangedEvent.
Definition at line 347 of file BaseData.cs.
override string QuantConnect.Data.BaseData.ToString | ( | ) |
Formats a string with the symbol and value.
Definition at line 356 of file BaseData.cs.
|
virtual |
Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object each time it is called.
OBSOLETE:: This implementation is added for backward/forward compatibility purposes. This function is no longer called by the LEAN engine.
config | Subscription data config setup object |
line | Line of the source document |
date | Date of the requested data |
dataFeed | Type of datafeed we're requesting - a live or backtest feed. |
Implements QuantConnect.Data.IBaseData.
Definition at line 372 of file BaseData.cs.
|
virtual |
Return the URL string source of the file. This will be converted to a stream
OBSOLETE:: This implementation is added for backward/forward compatibility purposes. This function is no longer called by the LEAN engine.
config | Configuration object |
date | Date of this source file |
datafeed | Type of datafeed we're reqesting - backtest or live |
Implements QuantConnect.Data.IBaseData.
Definition at line 388 of file BaseData.cs.
|
static |
Deserialize the message from the data server
serialized | The data server's message |
Definition at line 400 of file BaseData.cs.
|
staticprotected |
A list of all Resolution
Definition at line 45 of file BaseData.cs.
|
staticprotected |
A list of Resolution.Daily
Definition at line 51 of file BaseData.cs.
|
staticprotected |
A list of Resolution.Minute
Definition at line 56 of file BaseData.cs.
|
staticprotected |
A list of high Resolution, including minute, second, and tick.
Definition at line 61 of file BaseData.cs.
|
staticprotected |
A list of resolutions support by Options
Definition at line 66 of file BaseData.cs.
virtual decimal QuantConnect.Data.BaseData.Price => Value |
As this is a backtesting platform we'll provide an alias of value as price.
Definition at line 122 of file BaseData.cs.
|
getset |
Market Data Type of this data - does it come in individual price packets or is it grouped into OHLC.
Data is classed into two categories - streams of instantaneous prices and groups of OHLC data.
Definition at line 73 of file BaseData.cs.
|
get |
True if this is a fill forward piece of data
Definition at line 78 of file BaseData.cs.
|
getset |
Current time marker of this data packet.
All data is timeseries based.
Definition at line 85 of file BaseData.cs.
|
getset |
The end time of this data. Some data covers spans (trade bars) and as such we want to know the entire time span covered
Definition at line 92 of file BaseData.cs.
|
getset |
Symbol representation for underlying Security
Definition at line 100 of file BaseData.cs.
|
getset |
Value representation of this data packet. All data requires a representative value for this moment in time. For streams of data this is the price now, for OHLC packets this is the closing price.
Definition at line 108 of file BaseData.cs.