Class Instrument
- Namespace
- Balsam
- Assembly
- Balsam.Backtester.dll
Encapsulates relevant information about a particular trading vehicle.
public class Instrument : IInstrument, ICloneable
- Inheritance
-
Instrument
- Implements
- Inherited Members
- Extension Methods
Constructors
Instrument()
Initializes a new empty instrument.
public Instrument()
Instrument(string, InstrumentType, double, double)
Initializes a new instrument using the specified values.
public Instrument(string symbol, InstrumentType instrumentType, double pointValue, double tickSize)
Parameters
symbol
stringinstrumentType
InstrumentTypepointValue
doubletickSize
double
Properties
AltIdentifier
Gets/sets an alternate identifer (CUSIP, Sedol, etc.).
public string AltIdentifier { get; set; }
Property Value
Commission
Gets/sets the default commission per contract/share for this instrument.
public double Commission { get; set; }
Property Value
ConversionFactor
Gets/sets a coefficient that can be used to adjust prices to the instrument's proper quoting convention. This is a convenience property only that could be used by a bar server. It is not used or saved by the backtesting engine.
public double ConversionFactor { get; set; }
Property Value
Currency
Gets/sets the local currency of the instrument.
public string Currency { get; set; }
Property Value
DecimalsToDisplay
Gets/sets the number of decimals to display.
public int DecimalsToDisplay { get; set; }
Property Value
Default
Gets a generic equity instrument with point value of 1.
public static Instrument Default { get; }
Property Value
Exchange
Gets/sets the exchange on which the instrument is traded.
public string Exchange { get; set; }
Property Value
Group
Gets/sets the instrument's industry group.
public string Group { get; set; }
Property Value
InitialMargin
Gets/sets the initial margin requirement in local currency.
public double InitialMargin { get; set; }
Property Value
InstrumentType
Gets/sets the type of instrument (equity, future, etc.).
public InstrumentType InstrumentType { get; set; }
Property Value
LimitMove
Gets/sets the distance in points for a limit move.
public double LimitMove { get; set; }
Property Value
MaintenanceMargin
Gets/sets the maintenance margin requirement in local currency.
public double MaintenanceMargin { get; set; }
Property Value
Months
Gets/sets valid contract months.
public string Months { get; set; }
Property Value
Name
Gets/sets the instrument name or description.
public string Name { get; set; }
Property Value
PointValue
Gets/sets the value of a 1.0 move in local currency.
public double PointValue { get; set; }
Property Value
Sector
Gets/sets the instrument's sector.
public string Sector { get; set; }
Property Value
Slippage
Gets/sets the default slippage in points (decimal form) for this instrument.
public double Slippage { get; set; }
Property Value
Symbol
Gets/sets the ticker symbol. This will typically act as the key when an instrument is added to a dictionary.
public string Symbol { get; set; }
Property Value
Tag
Gets/sets a convenience property for the user to store any arbitrary object.
public object Tag { get; set; }
Property Value
TickSize
Gets/sets the decimal equivalent of one tick.
public double TickSize { get; set; }
Property Value
TickValue
Gets the value of a one tick move in local currency.
public double TickValue { get; }
Property Value
Methods
Clone()
Create a clone of this instrument.
public Instrument Clone()
Returns
Equals(Instrument)
Returns true if the specified instrument is identical to the current one.
public bool Equals(Instrument instrument)
Parameters
instrument
Instrument
Returns
Equals(object)
Returns true if the specified object is identical to the current instrument.
public override bool Equals(object obj)
Parameters
obj
object
Returns
GetHashCode()
Returns a hash code for this instrument.
public override int GetHashCode()
Returns
IsTick(double, double)
Returns true if the specified price is an even tick within the specified tolerance.
public bool IsTick(double price, double tolerance = 1E-10)
Parameters
Returns
RoundTickDown(double, double)
Rounds down to the nearest tick if the price is outside the specified tolerance.
public double RoundTickDown(double price, double tolerance = 1E-10)
Parameters
Returns
RoundTickNearest(double)
Rounds the specified price to the nearest tick.
public double RoundTickNearest(double price)
Parameters
price
double
Returns
RoundTickUp(double, double)
Rounds up to the nearest tick if the price is outside the specified tolerance.
public double RoundTickUp(double price, double tolerance = 1E-10)
Parameters
Returns
ToString()
Returns a string representation of this instrument.
public override string ToString()
Returns
Operators
operator ==(Instrument, Instrument)
Returns true if the specified instruments are equal (either reference equality or all properties are the same).
public static bool operator ==(Instrument left, Instrument right)
Parameters
left
Instrumentright
Instrument
Returns
operator !=(Instrument, Instrument)
Returns true if the specified instruments are not equal.
public static bool operator !=(Instrument left, Instrument right)
Parameters
left
Instrumentright
Instrument