Lean  $LEAN_TAG$
QuantConnect.Data.Market.Tick Class Reference

Tick class is the base representation for tick data. It is grouped into a Ticks object which implements IDictionary and passed into an OnData event handler. More...

Inheritance diagram for QuantConnect.Data.Market.Tick:
[legend]

Public Member Functions

 Tick ()
 Initialize tick class with a default constructor. More...
 
 Tick (Tick original)
 Cloner constructor for fill forward engine implementation. Clone the original tick into this new tick: More...
 
 Tick (DateTime time, Symbol symbol, decimal bid, decimal ask)
 Constructor for a FOREX tick where there is no last sale price. The volume in FX is so high its rare to find FX trade data. To fake this the tick contains bid-ask prices and the last price is the midpoint. More...
 
 Tick (DateTime time, Symbol symbol, decimal openInterest)
 Initializes a new instance of the Tick class to TickType.OpenInterest. More...
 
 Tick (DateTime time, Symbol symbol, decimal last, decimal bid, decimal ask)
 Initializer for a last-trade equity tick with bid or ask prices. More...
 
 Tick (DateTime time, Symbol symbol, string saleCondition, string exchange, decimal quantity, decimal price)
 Trade tick type constructor More...
 
 Tick (DateTime time, Symbol symbol, string saleCondition, Exchange exchange, decimal quantity, decimal price)
 Trade tick type constructor More...
 
 Tick (DateTime time, Symbol symbol, string saleCondition, string exchange, decimal bidSize, decimal bidPrice, decimal askSize, decimal askPrice)
 Quote tick type constructor More...
 
 Tick (DateTime time, Symbol symbol, string saleCondition, Exchange exchange, decimal bidSize, decimal bidPrice, decimal askSize, decimal askPrice)
 Quote tick type constructor More...
 
 Tick (Symbol symbol, string line)
 Constructor for QuantConnect FXCM Data source: More...
 
 Tick (Symbol symbol, string line, DateTime baseDate)
 Constructor for QuantConnect tick data More...
 
 Tick (SubscriptionDataConfig config, StreamReader reader, DateTime date)
 Parse a tick data line from quantconnect zip source files. More...
 
 Tick (SubscriptionDataConfig config, string line, DateTime date)
 Parse a tick data line from quantconnect zip source files. More...
 
override BaseData Reader (SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode)
 Tick implementation of reader method: read a line of data from the source and convert it to a tick object. More...
 
override BaseData Reader (SubscriptionDataConfig config, StreamReader stream, DateTime date, bool isLiveMode)
 Tick implementation of reader method: read a line of data from the source and convert it to a tick object. More...
 
override SubscriptionDataSource GetSource (SubscriptionDataConfig config, DateTime date, bool isLiveMode)
 Get source for tick data feed - not used with QuantConnect data sources implementation. More...
 
override void Update (decimal lastTrade, decimal bidPrice, decimal askPrice, decimal volume, decimal bidSize, decimal askSize)
 Update the tick price information - not used. More...
 
bool IsValid ()
 Check if tick contains valid data (either a trade, or a bid or ask) More...
 
override BaseData Clone ()
 Clone implementation for tick class: More...
 
override string ToString ()
 Formats a string with the symbol and value. More...
 
void SetValue ()
 Sets the tick Value based on ask and bid price 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< ResolutionSupportedResolutions ()
 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 BaseData Clone (bool fillForward)
 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...
 

Properties

TickType TickType = TickType.Trade [get, set]
 Type of the Tick: Trade or Quote. More...
 
decimal Quantity [get, set]
 Quantity exchanged in a trade. More...
 
string? ExchangeCode [get, set]
 Exchange code this tick came from Exchanges More...
 
string? Exchange [get, set]
 Exchange name this tick came from Exchanges More...
 
string SaleCondition = string.Empty [get, set]
 Sale condition for the tick. More...
 
uint ParsedSaleCondition [get, set]
 For performance parsed sale condition for the tick. More...
 
bool Suspicious [get, set]
 Bool whether this is a suspicious tick More...
 
decimal BidPrice [get, set]
 Bid Price for Tick More...
 
decimal AskPrice [get, set]
 Asking price for the Tick quote. More...
 
decimal LastPrice [get]
 Alias for "Value" - the last sale for this asset. More...
 
decimal BidSize [get, set]
 Size of bid quote. More...
 
decimal AskSize [get, set]
 Size of ask quote. 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from QuantConnect.Data.BaseData
static IEnumerable< BaseDataDeserializeMessage (string serialized)
 Deserialize the message from the data server More...
 
- 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< ResolutionAllResolutions
 A list of all Resolution More...
 
static readonly List< ResolutionDailyResolution = new List<Resolution> { Resolution.Daily }
 A list of Resolution.Daily More...
 
static readonly List< ResolutionMinuteResolution = new List<Resolution> { Resolution.Minute }
 A list of Resolution.Minute More...
 
static readonly List< ResolutionHighResolution = new List<Resolution> { Resolution.Minute, Resolution.Second, Resolution.Tick }
 A list of high Resolution, including minute, second, and tick. More...
 
static readonly List< ResolutionOptionResolutions = new List<Resolution> { Resolution.Daily, Resolution.Hour, Resolution.Minute }
 A list of resolutions support by Options More...
 

Detailed Description

Tick class is the base representation for tick data. It is grouped into a Ticks object which implements IDictionary and passed into an OnData event handler.

Definition at line 34 of file Tick.cs.

Constructor & Destructor Documentation

◆ Tick() [1/13]

QuantConnect.Data.Market.Tick.Tick ( )

Initialize tick class with a default constructor.

Definition at line 182 of file Tick.cs.

Here is the caller graph for this function:

◆ Tick() [2/13]

QuantConnect.Data.Market.Tick.Tick ( Tick  original)

Cloner constructor for fill forward engine implementation. Clone the original tick into this new tick:

Parameters
originalOriginal tick we're cloning

Definition at line 201 of file Tick.cs.

◆ Tick() [3/13]

QuantConnect.Data.Market.Tick.Tick ( DateTime  time,
Symbol  symbol,
decimal  bid,
decimal  ask 
)

Constructor for a FOREX tick where there is no last sale price. The volume in FX is so high its rare to find FX trade data. To fake this the tick contains bid-ask prices and the last price is the midpoint.

Parameters
timeFull date and time
symbolUnderlying currency pair we're trading
bidFX tick bid value
askFX tick ask value

Definition at line 228 of file Tick.cs.

◆ Tick() [4/13]

QuantConnect.Data.Market.Tick.Tick ( DateTime  time,
Symbol  symbol,
decimal  openInterest 
)

Initializes a new instance of the Tick class to TickType.OpenInterest.

Parameters
timeThe time at which the open interest tick occurred.
symbolThe symbol associated with the open interest tick.
openInterestThe value of the open interest for the specified symbol.

Definition at line 245 of file Tick.cs.

◆ Tick() [5/13]

QuantConnect.Data.Market.Tick.Tick ( DateTime  time,
Symbol  symbol,
decimal  last,
decimal  bid,
decimal  ask 
)

Initializer for a last-trade equity tick with bid or ask prices.

Parameters
timeFull date and time
symbolUnderlying equity security symbol
bidBid value
askAsk value
lastLast trade price

Definition at line 262 of file Tick.cs.

◆ Tick() [6/13]

QuantConnect.Data.Market.Tick.Tick ( DateTime  time,
Symbol  symbol,
string  saleCondition,
string  exchange,
decimal  quantity,
decimal  price 
)

Trade tick type constructor

Parameters
timeFull date and time
symbolUnderlying equity security symbol
saleConditionThe ticks sale condition
exchangeThe ticks exchange
quantityThe quantity traded
priceThe price of the trade

Definition at line 282 of file Tick.cs.

◆ Tick() [7/13]

QuantConnect.Data.Market.Tick.Tick ( DateTime  time,
Symbol  symbol,
string  saleCondition,
Exchange  exchange,
decimal  quantity,
decimal  price 
)

Trade tick type constructor

Parameters
timeFull date and time
symbolUnderlying equity security symbol
saleConditionThe ticks sale condition
exchangeThe ticks exchange
quantityThe quantity traded
priceThe price of the trade

Definition at line 304 of file Tick.cs.

◆ Tick() [8/13]

QuantConnect.Data.Market.Tick.Tick ( DateTime  time,
Symbol  symbol,
string  saleCondition,
string  exchange,
decimal  bidSize,
decimal  bidPrice,
decimal  askSize,
decimal  askPrice 
)

Quote tick type constructor

Parameters
timeFull date and time
symbolUnderlying equity security symbol
saleConditionThe ticks sale condition
exchangeThe ticks exchange
bidSizeThe bid size
bidPriceThe bid price
askSizeThe ask size
askPriceThe ask price

Definition at line 322 of file Tick.cs.

◆ Tick() [9/13]

QuantConnect.Data.Market.Tick.Tick ( DateTime  time,
Symbol  symbol,
string  saleCondition,
Exchange  exchange,
decimal  bidSize,
decimal  bidPrice,
decimal  askSize,
decimal  askPrice 
)

Quote tick type constructor

Parameters
timeFull date and time
symbolUnderlying equity security symbol
saleConditionThe ticks sale condition
exchangeThe ticks exchange
bidSizeThe bid size
bidPriceThe bid price
askSizeThe ask size
askPriceThe ask price

Definition at line 348 of file Tick.cs.

◆ Tick() [10/13]

QuantConnect.Data.Market.Tick.Tick ( Symbol  symbol,
string  line 
)

Constructor for QuantConnect FXCM Data source:

Parameters
symbolSymbol for underlying asset
lineCSV line of data from FXCM

Definition at line 360 of file Tick.cs.

◆ Tick() [11/13]

QuantConnect.Data.Market.Tick.Tick ( Symbol  symbol,
string  line,
DateTime  baseDate 
)

Constructor for QuantConnect tick data

Parameters
symbolSymbol for underlying asset
lineCSV line of data from QC tick csv
baseDateThe base date of the tick

Definition at line 378 of file Tick.cs.

◆ Tick() [12/13]

QuantConnect.Data.Market.Tick.Tick ( SubscriptionDataConfig  config,
StreamReader  reader,
DateTime  date 
)

Parse a tick data line from quantconnect zip source files.

Parameters
readerThe source stream reader
dateBase date for the tick (ticks date is stored as int milliseconds since midnight)
configSubscription configuration object

Definition at line 398 of file Tick.cs.

Here is the call graph for this function:

◆ Tick() [13/13]

QuantConnect.Data.Market.Tick.Tick ( SubscriptionDataConfig  config,
string  line,
DateTime  date 
)

Parse a tick data line from quantconnect zip source files.

Parameters
lineCSV source line of the compressed source
dateBase date for the tick (ticks date is stored as int milliseconds since midnight)
configSubscription configuration object

Definition at line 538 of file Tick.cs.

Here is the call graph for this function:

Member Function Documentation

◆ Reader() [1/2]

override BaseData QuantConnect.Data.Market.Tick.Reader ( SubscriptionDataConfig  config,
string  line,
DateTime  date,
bool  isLiveMode 
)
virtual

Tick implementation of reader method: read a line of data from the source and convert it to a tick object.

Parameters
configSubscription configuration object for algorithm
lineLine from the datafeed source
dateDate of this reader request
isLiveModetrue if we're in live mode, false for backtesting mode
Returns
New Initialized tick

Reimplemented from QuantConnect.Data.BaseData.

Definition at line 695 of file Tick.cs.

Here is the call graph for this function:

◆ Reader() [2/2]

override BaseData QuantConnect.Data.Market.Tick.Reader ( SubscriptionDataConfig  config,
StreamReader  stream,
DateTime  date,
bool  isLiveMode 
)
virtual

Tick implementation of reader method: read a line of data from the source and convert it to a tick object.

Parameters
configSubscription configuration object for algorithm
streamThe source stream reader
dateDate of this reader request
isLiveModetrue if we're in live mode, false for backtesting mode
Returns
New Initialized tick

Reimplemented from QuantConnect.Data.BaseData.

Definition at line 714 of file Tick.cs.

Here is the call graph for this function:

◆ GetSource()

override SubscriptionDataSource QuantConnect.Data.Market.Tick.GetSource ( SubscriptionDataConfig  config,
DateTime  date,
bool  isLiveMode 
)
virtual

Get source for tick data feed - not used with QuantConnect data sources implementation.

Parameters
configConfiguration object
dateDate of this source request if source spread across multiple files
isLiveModetrue if we're in live mode, false for backtesting mode
Returns
String source location of the file to be opened with a stream

Reimplemented from QuantConnect.Data.BaseData.

Definition at line 733 of file Tick.cs.

Here is the call graph for this function:

◆ Update()

override void QuantConnect.Data.Market.Tick.Update ( decimal  lastTrade,
decimal  bidPrice,
decimal  askPrice,
decimal  volume,
decimal  bidSize,
decimal  askSize 
)
virtual

Update the tick price information - not used.

Parameters
lastTradeThis trade price
bidPriceCurrent bid price
askPriceCurrent asking price
volumeVolume of this trade
bidSizeThe size of the current bid, if available
askSizeThe size of the current ask, if available

Reimplemented from QuantConnect.Data.BaseData.

Definition at line 759 of file Tick.cs.

◆ IsValid()

bool QuantConnect.Data.Market.Tick.IsValid ( )

Check if tick contains valid data (either a trade, or a bid or ask)

Definition at line 773 of file Tick.cs.

◆ Clone()

override BaseData QuantConnect.Data.Market.Tick.Clone ( )
virtual

Clone implementation for tick class:

Returns
New tick object clone of the current class values.

Reimplemented from QuantConnect.Data.BaseData.

Definition at line 786 of file Tick.cs.

Here is the call graph for this function:

◆ ToString()

override string QuantConnect.Data.Market.Tick.ToString ( )

Formats a string with the symbol and value.

Returns
string - a string formatted as SPY: 167.753

Definition at line 795 of file Tick.cs.

◆ SetValue()

void QuantConnect.Data.Market.Tick.SetValue ( )

Sets the tick Value based on ask and bid price

Definition at line 816 of file Tick.cs.

Here is the caller graph for this function:

Property Documentation

◆ TickType

TickType QuantConnect.Data.Market.Tick.TickType = TickType.Trade
getset

Type of the Tick: Trade or Quote.

Definition at line 45 of file Tick.cs.

◆ Quantity

decimal QuantConnect.Data.Market.Tick.Quantity
getset

Quantity exchanged in a trade.

Definition at line 51 of file Tick.cs.

◆ ExchangeCode

string? QuantConnect.Data.Market.Tick.ExchangeCode
getset

Exchange code this tick came from Exchanges

Definition at line 58 of file Tick.cs.

◆ Exchange

string? QuantConnect.Data.Market.Tick.Exchange
getset

Exchange name this tick came from Exchanges

Definition at line 80 of file Tick.cs.

◆ SaleCondition

string QuantConnect.Data.Market.Tick.SaleCondition = string.Empty
getset

Sale condition for the tick.

Definition at line 101 of file Tick.cs.

◆ ParsedSaleCondition

uint QuantConnect.Data.Market.Tick.ParsedSaleCondition
getset

For performance parsed sale condition for the tick.

Definition at line 109 of file Tick.cs.

◆ Suspicious

bool QuantConnect.Data.Market.Tick.Suspicious
getset

Bool whether this is a suspicious tick

Definition at line 133 of file Tick.cs.

◆ BidPrice

decimal QuantConnect.Data.Market.Tick.BidPrice
getset

Bid Price for Tick

Definition at line 139 of file Tick.cs.

◆ AskPrice

decimal QuantConnect.Data.Market.Tick.AskPrice
getset

Asking price for the Tick quote.

Definition at line 145 of file Tick.cs.

◆ LastPrice

decimal QuantConnect.Data.Market.Tick.LastPrice
get

Alias for "Value" - the last sale for this asset.

Definition at line 151 of file Tick.cs.

◆ BidSize

decimal QuantConnect.Data.Market.Tick.BidSize
getset

Size of bid quote.

Definition at line 162 of file Tick.cs.

◆ AskSize

decimal QuantConnect.Data.Market.Tick.AskSize
getset

Size of ask quote.

Definition at line 168 of file Tick.cs.


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