Lean
$LEAN_TAG$
|
TradeBar class for second and minute resolution data: An OHLC implementation of the QuantConnect BaseData class with parameters for candles. More...
Public Member Functions | |
TradeBar () | |
Default initializer to setup an empty tradebar. More... | |
TradeBar (TradeBar original) | |
Cloner constructor for implementing fill forward. Return a new instance with the same values as this original. More... | |
TradeBar (DateTime time, Symbol symbol, decimal open, decimal high, decimal low, decimal close, decimal volume, TimeSpan? period=null) | |
Initialize Trade Bar with OHLC Values: More... | |
override BaseData | Reader (SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode) |
TradeBar Reader: Fetch the data from the QC storage and feed it line by line into the engine. More... | |
override BaseData | Reader (SubscriptionDataConfig config, StreamReader stream, DateTime date, bool isLiveMode) |
TradeBar Reader: Fetch the data from the QC storage and feed it directly from the stream into the engine. More... | |
override void | Update (decimal lastTrade, decimal bidPrice, decimal askPrice, decimal volume, decimal bidSize, decimal askSize) |
Update the tradebar - build the bar from this pricing information: More... | |
override SubscriptionDataSource | GetSource (SubscriptionDataConfig config, DateTime date, bool isLiveMode) |
Get Source for Custom Data File More... | |
override BaseData | Clone (bool fillForward) |
Return a new instance clone of this object, used in fill forward More... | |
override BaseData | Clone () |
Return a new instance clone of this object More... | |
override string | ToString () |
Formats a string with the symbol and value. More... | |
Public Member Functions inherited from QuantConnect.Data.BaseData | |
BaseData () | |
Constructor for initialising the dase data class 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... | |
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 TradeBar | Parse (SubscriptionDataConfig config, string line, DateTime baseDate) |
Parses the trade bar data line assuming QC data formats More... | |
static T | ParseEquity< T > (SubscriptionDataConfig config, string line, DateTime date) |
Parses equity trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static TradeBar | ParseEquity (SubscriptionDataConfig config, StreamReader streamReader, DateTime date) |
Parses equity trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static TradeBar | ParseEquity (SubscriptionDataConfig config, string line, DateTime date) |
Parses equity trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static T | ParseForex< T > (SubscriptionDataConfig config, string line, DateTime date) |
Parses forex trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static T | ParseCrypto< T > (SubscriptionDataConfig config, string line, DateTime date) |
Parses crypto trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static TradeBar | ParseCrypto (SubscriptionDataConfig config, string line, DateTime date) |
Parses crypto trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static TradeBar | ParseCrypto (SubscriptionDataConfig config, StreamReader streamReader, DateTime date) |
Parses crypto trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static TradeBar | ParseForex (SubscriptionDataConfig config, string line, DateTime date) |
Parses forex trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static TradeBar | ParseForex (SubscriptionDataConfig config, StreamReader streamReader, DateTime date) |
Parses forex trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static T | ParseCfd< T > (SubscriptionDataConfig config, string line, DateTime date) |
Parses CFD trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static TradeBar | ParseCfd (SubscriptionDataConfig config, string line, DateTime date) |
Parses CFD trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static TradeBar | ParseCfd (SubscriptionDataConfig config, StreamReader streamReader, DateTime date) |
Parses CFD trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static T | ParseOption< T > (SubscriptionDataConfig config, string line, DateTime date) |
Parses Option trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static T | ParseOption< T > (SubscriptionDataConfig config, StreamReader streamReader, DateTime date) |
Parses Option trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static T | ParseFuture< T > (SubscriptionDataConfig config, StreamReader streamReader, DateTime date) |
Parses Future trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static T | ParseFuture< T > (SubscriptionDataConfig config, string line, DateTime date) |
Parses Future trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static TradeBar | ParseIndex (SubscriptionDataConfig config, string line, DateTime date) |
Parse an index bar from the LEAN disk format More... | |
static TradeBar | ParseIndex (SubscriptionDataConfig config, StreamReader streamReader, DateTime date) |
Parse an index bar from the LEAN disk format More... | |
static TradeBar | ParseOption (SubscriptionDataConfig config, string line, DateTime date) |
Parses Option trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static TradeBar | ParseOption (SubscriptionDataConfig config, StreamReader streamReader, DateTime date) |
Parses Option trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static TradeBar | ParseFuture (SubscriptionDataConfig config, string line, DateTime date) |
Parses Future trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
static TradeBar | ParseFuture (SubscriptionDataConfig config, StreamReader streamReader, DateTime date) |
Parses Future trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar More... | |
Static Public Member Functions inherited from QuantConnect.Data.BaseData | |
static IEnumerable< BaseData > | DeserializeMessage (string serialized) |
Deserialize the message from the data server More... | |
Properties | |
virtual decimal | Volume [get, set] |
Volume: More... | |
virtual decimal | Open [get, set] |
Opening price of the bar: Defined as the price at the start of the time period. More... | |
virtual decimal | High [get, set] |
High price of the TradeBar during the time period. More... | |
virtual decimal | Low [get, set] |
Low price of the TradeBar during the time period. More... | |
virtual decimal | Close [get, set] |
Closing price of the TradeBar. Defined as the price at Start Time + TimeSpan. More... | |
override DateTime | EndTime [get, set] |
The closing time of this bar, computed via the Time and Period More... | |
virtual TimeSpan | Period [get, set] |
The period of this trade bar, (second, minute, daily, ect...) More... | |
Properties inherited from QuantConnect.Data.BaseData | |
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... | |
Properties inherited from QuantConnect.Data.Market.IBar | |
decimal | Open [get] |
Opening price of the bar: Defined as the price at the start of the time period. More... | |
decimal | High [get] |
High price of the bar during the time period. More... | |
decimal | Low [get] |
Low price of the bar during the time period. More... | |
decimal | Close [get] |
Closing price of the bar. Defined as the price at Start Time + TimeSpan. More... | |
Additional Inherited Members | |
Public Attributes inherited from QuantConnect.Data.BaseData | |
virtual decimal | Price => Value |
As this is a backtesting platform we'll provide an alias of value as price. More... | |
Static Protected Attributes inherited from QuantConnect.Data.BaseData | |
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... | |
TradeBar class for second and minute resolution data: An OHLC implementation of the QuantConnect BaseData class with parameters for candles.
Definition at line 33 of file TradeBar.cs.
QuantConnect.Data.Market.TradeBar.TradeBar | ( | ) |
Default initializer to setup an empty tradebar.
Definition at line 134 of file TradeBar.cs.
QuantConnect.Data.Market.TradeBar.TradeBar | ( | TradeBar | original | ) |
Cloner constructor for implementing fill forward. Return a new instance with the same values as this original.
original | Original tradebar object we seek to clone |
Definition at line 146 of file TradeBar.cs.
QuantConnect.Data.Market.TradeBar.TradeBar | ( | DateTime | time, |
Symbol | symbol, | ||
decimal | open, | ||
decimal | high, | ||
decimal | low, | ||
decimal | close, | ||
decimal | volume, | ||
TimeSpan? | period = null |
||
) |
Initialize Trade Bar with OHLC Values:
time | DateTime Timestamp of the bar |
symbol | Market MarketType Symbol |
open | Decimal Opening Price |
high | Decimal High Price of this bar |
low | Decimal Low Price of this bar |
close | Decimal Close price of this bar |
volume | Volume sum over day |
period | The period of this bar, specify null for default of 1 minute |
Definition at line 172 of file TradeBar.cs.
|
virtual |
TradeBar Reader: Fetch the data from the QC storage and feed it line by line into the engine.
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | Date of this reader request |
isLiveMode | true if we're in live mode, false for backtesting mode |
Reimplemented from QuantConnect.Data.BaseData.
Definition at line 195 of file TradeBar.cs.
|
virtual |
TradeBar Reader: Fetch the data from the QC storage and feed it directly from the stream into the engine.
config | Symbols, Resolution, DataType, |
stream | The file data stream |
date | Date of this reader request |
isLiveMode | true if we're in live mode, false for backtesting mode |
Reimplemented from QuantConnect.Data.BaseData.
Definition at line 259 of file TradeBar.cs.
|
static |
Parses the trade bar data line assuming QC data formats
Definition at line 320 of file TradeBar.cs.
|
static |
Parses equity trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
T | The requested output type, must derive from TradeBar |
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | Date of this reader request |
T | : | TradeBar | |
T | : | new() |
Definition at line 347 of file TradeBar.cs.
|
static |
Parses equity trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
config | Symbols, Resolution, DataType, |
streamReader | The data stream of the requested file |
date | Date of this reader request |
Definition at line 368 of file TradeBar.cs.
|
static |
Parses equity trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | Date of this reader request |
Definition at line 392 of file TradeBar.cs.
|
static |
Parses forex trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
T | The requested output type, must derive from TradeBar |
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
T | : | TradeBar | |
T | : | new() |
Definition at line 411 of file TradeBar.cs.
|
static |
Parses crypto trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
T | The requested output type, must derive from TradeBar |
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
T | : | TradeBar | |
T | : | new() |
Definition at line 431 of file TradeBar.cs.
|
static |
Parses crypto trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
Definition at line 450 of file TradeBar.cs.
|
static |
Parses crypto trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
config | Symbols, Resolution, DataType, |
streamReader | The data stream of the requested file |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
Definition at line 461 of file TradeBar.cs.
|
static |
Parses forex trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
Definition at line 473 of file TradeBar.cs.
|
static |
Parses forex trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
config | Symbols, Resolution, DataType, |
streamReader | The data stream of the requested file |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
Definition at line 485 of file TradeBar.cs.
|
static |
Parses CFD trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
T | The requested output type, must derive from TradeBar |
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
T | : | TradeBar | |
T | : | new() |
Definition at line 498 of file TradeBar.cs.
|
static |
Parses CFD trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
Definition at line 512 of file TradeBar.cs.
|
static |
Parses CFD trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
config | Symbols, Resolution, DataType, |
streamReader | The data stream of the requested file |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
Definition at line 525 of file TradeBar.cs.
|
static |
Parses Option trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
T | The requested output type, must derive from TradeBar |
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
T | : | TradeBar | |
T | : | new() |
Definition at line 539 of file TradeBar.cs.
|
static |
Parses Option trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
T | The requested output type, must derive from TradeBar |
config | Symbols, Resolution, DataType, |
streamReader | The data stream of the requested file |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
T | : | TradeBar | |
T | : | new() |
Definition at line 560 of file TradeBar.cs.
|
static |
Parses Future trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
T | The requested output type, must derive from TradeBar |
config | Symbols, Resolution, DataType, |
streamReader | The data stream of the requested file |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
T | : | TradeBar | |
T | : | new() |
Definition at line 581 of file TradeBar.cs.
|
static |
Parses Future trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
T | The requested output type, must derive from TradeBar |
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
T | : | TradeBar | |
T | : | new() |
Definition at line 602 of file TradeBar.cs.
|
static |
Parse an index bar from the LEAN disk format
Definition at line 618 of file TradeBar.cs.
|
static |
Parse an index bar from the LEAN disk format
Definition at line 731 of file TradeBar.cs.
|
static |
Parses Option trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
Definition at line 743 of file TradeBar.cs.
|
static |
Parses Option trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
config | Symbols, Resolution, DataType, |
streamReader | The data stream of the requested file |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
Definition at line 755 of file TradeBar.cs.
|
static |
Parses Future trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
config | Symbols, Resolution, DataType, |
line | Line from the data file requested |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
Definition at line 767 of file TradeBar.cs.
|
static |
Parses Future trade bar data into the specified tradebar type, useful for custom types with OHLCV data deriving from TradeBar
config | Symbols, Resolution, DataType, |
streamReader | The data stream of the requested file |
date | The base data used to compute the time of the bar since the line specifies a milliseconds since midnight |
Definition at line 779 of file TradeBar.cs.
|
virtual |
Update the tradebar - build the bar from this pricing information:
lastTrade | This trade price |
bidPrice | Current bid price (not used) |
askPrice | Current asking price (not used) |
volume | Volume of this trade |
bidSize | The size of the current bid, if available |
askSize | The size of the current ask, if available |
Reimplemented from QuantConnect.Data.BaseData.
Definition at line 793 of file TradeBar.cs.
|
virtual |
Get Source for Custom Data File
What source file location would you prefer for each type of usage:
config | Configuration object |
date | Date of this source request if source spread across multiple files |
isLiveMode | true if we're in live mode, false for backtesting mode |
Reimplemented from QuantConnect.Data.BaseData.
Definition at line 812 of file TradeBar.cs.
|
virtual |
Return a new instance clone of this object, used in fill forward
fillForward | True if this is a fill forward clone |
Reimplemented from QuantConnect.Data.BaseData.
Definition at line 833 of file TradeBar.cs.
|
virtual |
Return a new instance clone of this object
Reimplemented from QuantConnect.Data.BaseData.
Definition at line 849 of file TradeBar.cs.
override string QuantConnect.Data.Market.TradeBar.ToString | ( | ) |
Formats a string with the symbol and value.
Definition at line 858 of file TradeBar.cs.
|
getset |
Volume:
Definition at line 47 of file TradeBar.cs.
|
getset |
Opening price of the bar: Defined as the price at the start of the time period.
Definition at line 54 of file TradeBar.cs.
|
getset |
High price of the TradeBar during the time period.
Definition at line 68 of file TradeBar.cs.
|
getset |
Low price of the TradeBar during the time period.
Definition at line 82 of file TradeBar.cs.
|
getset |
Closing price of the TradeBar. Defined as the price at Start Time + TimeSpan.
Definition at line 96 of file TradeBar.cs.
|
getset |
The closing time of this bar, computed via the Time and Period
Definition at line 110 of file TradeBar.cs.
|
getset |
The period of this trade bar, (second, minute, daily, ect...)
Definition at line 120 of file TradeBar.cs.