Class Bar
- Namespace
- Balsam
- Assembly
- Balsam.Backtester.dll
Encapsulates data for a single bar.
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class Bar : Observation, IEnumerable<double>, IEnumerable
- Inheritance
-
Bar
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
Bar()
Protected constructor to support some serialization formats.
protected Bar()
Bar(DateTime, double)
Initializes a new close-only bar.
public Bar(DateTime date, double close)
Parameters
Bar(DateTime, double, double, double, double, double)
Initializes a new bar.
public Bar(DateTime date, double open, double high, double low, double close, double volume)
Parameters
Bar(DateTime, double, double, double, double, double, double)
Initializes a new bar.
public Bar(DateTime date, double open, double high, double low, double close, double volume, double openInterest)
Parameters
Bar(DateTime, double, double, double, double, double, double, double)
Initializes a new bar.
public Bar(DateTime date, double open, double high, double low, double close, double volume, double openInterest, double unadjustedClose)
Parameters
date
DateTimeopen
doublehigh
doublelow
doubleclose
doublevolume
doubleopenInterest
doubleunadjustedClose
double
Bar(DateTime, params double[])
Initializes a new bar using the specified date and values
public Bar(DateTime date, params double[] values)
Parameters
Properties
Close
Gets the closing price of the bar.
public double Close { get; }
Property Value
High
Gets the high price of the bar.
public double High { get; }
Property Value
Low
Gets the low price of the bar.
public double Low { get; }
Property Value
Midpoint
Gets the midpoint between the high and low of the bar (rounded to 10 decimal places).
public double Midpoint { get; }
Property Value
Open
Gets the opening price of the bar.
public double Open { get; }
Property Value
OpenInterest
Gets the open interest of the bar.
public double OpenInterest { get; }
Property Value
Range
Gets the range (high - low) rounded to 10 decimal places.
public double Range { get; }
Property Value
UnadjustedClose
Gets the unadjusted closing price of the bar.
public double UnadjustedClose { get; }
Property Value
Volume
Gets the volume of the bar.
public double Volume { get; }
Property Value
Methods
Equals(Bar)
Returns true if two bars are identical.
public bool Equals(Bar bar)
Parameters
bar
Bar
Returns
Equals(object)
Evaluates whether the specified object is identical to the current bar.
public override bool Equals(object obj)
Parameters
obj
object
Returns
GetHashCode()
Serves as a hash function for the bar.
public override int GetHashCode()
Returns
ToString()
Returns a string representation of the bar.
public override string ToString()
Returns
Operators
operator ==(Bar, Bar)
Returns true if the specified bars are equal.
public static bool operator ==(Bar left, Bar right)
Parameters
Returns
operator !=(Bar, Bar)
Returns true if the specified bars are not equal.
public static bool operator !=(Bar left, Bar right)