Search Framework:
BarData
Namespace: WealthLab.Core
Parent: Object

The BarData class represents a single bar of market data, including open, high, low, close, volume, bid, ask, symbol, timestamp, and source information.

Constructors
BarData
public BarData()
public BarData(DateTime dt)
public BarData(BarHistory bars, bool resetTimestamp = false)
public BarData(BarHistory bars, int idx)
public BarData(DateTime dt, double open, double high, double low, double close, double volume)

The parameterless constructor creates a new BarData instance without initializing its values. The DateTime constructor assigns DateTime, initializes the OHLC values to Double.NaN, and initializes Volume to zero. The BarHistory constructor copies the most recent bar from the supplied BarHistory and also assigns its Symbol. If resetTimestamp is true and the BarHistory uses a minute scale, the timestamp is moved back by the bar interval and then forward 30 seconds. The BarHistory/index overload copies the bar at idx and assigns the BarHistory's Symbol. The final overload initializes the DateTime, OHLC, and Volume values directly from the supplied arguments.



Members
Ask
public double Ask

The current ask price associated with the bar. The default value is Double.NaN.


Bid
public double Bid

The current bid price associated with the bar. The default value is Double.NaN.


Close
public double Close

The bar's closing price.


DataSource
public string DataSource

Contains the name of the data source associated with this BarData instance. The default value is an empty string.


DateTime
public DateTime DateTime

The bar's date and time.


High
public double High

The bar's high price.


Low
public double Low

The bar's low price.


Open
public double Open

The bar's opening price.


Symbol
public string Symbol

The symbol represented by the BarData instance.


Volume
public double Volume

The bar's volume.



Persistence
Parse
public static BarData Parse(string s)

Creates and returns a BarData instance from the persisted string in s. The method restores Symbol, DateTime, Open, High, Low, Close, and Volume.


Persist
public string Persist()

Returns a string containing the persisted BarData values. The persisted data includes Symbol, DateTime, Open, High, Low, Close, and Volume. Bid, Ask, and DataSource are not persisted.