Class Bar
Container class holding all fields of a single bar, most notably time stamps and price information. Bar objects are read-only in nature, therefore all values need to be provided during object construction.
Inheritance
Inherited Members
Namespace: TuringTrader.Simulator
Assembly: TuringTrader.Simulator.dll
Syntax
public class Bar
Constructors
| Improve this Doc View SourceBar(string, DateTime, double, double, double, double, long, bool, double, double, long, long, bool, DateTime, double, bool)
Create and initialize a bar object.
Declaration
public Bar(string ticker, DateTime time, double open, double high, double low, double close, long volume, bool hasOHLC, double bid, double ask, long bidVolume, long askVolume, bool hasBidAsk, DateTime optionExpiry, double optionStrike, bool optionIsPut)
Parameters
Type | Name | Description |
---|---|---|
string | ticker | ticker, most often same as symbol |
System.DateTime | time | Initializer for Time field |
double | open | Initializer for Open field |
double | high | Initializer for High field |
double | low | Initializer for Low field |
double | close | Initializer for Close field |
long | volume | Initializer for Volume field |
bool | hasOHLC | Initializer for HasOHLC field |
double | bid | Initializer for Bid field |
double | ask | Initializer for Ask field |
long | bidVolume | Initializer for BidVolume field |
long | askVolume | Initializer for AskVolume field |
bool | hasBidAsk | Initializer for HasBidAsk field |
System.DateTime | optionExpiry | Initializer for OptionExpiry field |
double | optionStrike | Initializer for OptionStrike field |
bool | optionIsPut | Initializer for OptionIsPut field |
Fields
| Improve this Doc View SourceAsk
Asking price.
Declaration
public readonly double Ask
Field Value
Type | Description |
---|---|
double |
AskVolume
Ask volume.
Declaration
public readonly long AskVolume
Field Value
Type | Description |
---|---|
long |
Bid
Bid price.
Declaration
public readonly double Bid
Field Value
Type | Description |
---|---|
double |
BidVolume
Bid volume.
Declaration
public readonly long BidVolume
Field Value
Type | Description |
---|---|
long |
Close
Close price.
Declaration
public readonly double Close
Field Value
Type | Description |
---|---|
double |
HasBidAsk
Flag indicating availability of Bid/ Ask pricing.
Declaration
public readonly bool HasBidAsk
Field Value
Type | Description |
---|---|
bool |
HasOHLC
Flag indicating availability of Open/ High/ Low/ Close pricing.
Declaration
public readonly bool HasOHLC
Field Value
Type | Description |
---|---|
bool |
High
High price.
Declaration
public readonly double High
Field Value
Type | Description |
---|---|
double |
IsOption
Flag indicating validity of option fields.
Declaration
public readonly bool IsOption
Field Value
Type | Description |
---|---|
bool |
Low
Low price.
Declaration
public readonly double Low
Field Value
Type | Description |
---|---|
double |
Open
Open price.
Declaration
public readonly double Open
Field Value
Type | Description |
---|---|
double |
OptionExpiry
Only valid for options: Option expiry date.
Declaration
public readonly DateTime OptionExpiry
Field Value
Type | Description |
---|---|
System.DateTime |
OptionIsPut
Only valid for options: true for puts, false for calls.
Declaration
public readonly bool OptionIsPut
Field Value
Type | Description |
---|---|
bool |
OptionStrike
Only valid for options: Option strike price.
Declaration
public readonly double OptionStrike
Field Value
Type | Description |
---|---|
double |
Symbol
Fully qualified instrument symbol. Examples are AAPL, or XSP080119C00152000.
Declaration
public readonly string Symbol
Field Value
Type | Description |
---|---|
string |
Time
Time stamp, with date and time
Declaration
public readonly DateTime Time
Field Value
Type | Description |
---|---|
System.DateTime |
Volume
Trading volume.
Declaration
public readonly long Volume
Field Value
Type | Description |
---|---|
long |
Methods
| Improve this Doc View SourceNewOHLC(string, DateTime, double, double, double, double, long)
Create new OHLC bar.
Declaration
public static Bar NewOHLC(string ticker, DateTime t, double o, double h, double l, double c, long v)
Parameters
Type | Name | Description |
---|---|---|
string | ticker | |
System.DateTime | t | |
double | o | |
double | h | |
double | l | |
double | c | |
long | v |
Returns
Type | Description |
---|---|
Bar |
NewValue(string, DateTime, double)
Create new OHLC bar, with the same value copied to the open, high, low, and close fields. This method is typically used by algorithms that act as data sources.
Declaration
public static Bar NewValue(string ticker, DateTime t, double v)
Parameters
Type | Name | Description |
---|---|---|
string | ticker | ticker symbol |
System.DateTime | t | time stamp |
double | v | value |
Returns
Type | Description |
---|---|
Bar | OHLC bar |