Class Future
- Namespace
- Balsam
- Assembly
- Balsam.Backtester.dll
A class for parsing future symbols.
public class Future : IComparable<Future>
- Inheritance
-
Future
- Implements
- Inherited Members
- Extension Methods
Constructors
Future(string, DateTime)
Instantiates a new Future object using the specified root symbol and delivery date.
public Future(string rootSymbol, DateTime deliveryDate)
Parameters
Future(string, int)
Instantiates a new Future object using the specified root symbol and delivery code.
public Future(string rootSymbol, int deliveryCode)
Parameters
Properties
DeliveryDate
Gets the delivery date.
public DateTime DeliveryDate { get; }
Property Value
DigitsInYear
Gets/sets the number of digits of the delivery year to show in the symbol.
public int DigitsInYear { get; set; }
Property Value
Padding
Gets/sets the number of characters in a symbol. If the length of the root symbol is smaller than this number, it will be padded with spaces.
public int Padding { get; set; }
Property Value
Root
Gets the root symbol.
public string Root { get; }
Property Value
Suffix
Gets/sets a suffix to append to the end.
public string Suffix { get; set; }
Property Value
Methods
CompareTo(Future)
Compares the value of this instance to the specified Future.
public int CompareTo(Future other)
Parameters
other
Future
Returns
DeliveryCode(DateTime, int)
Returns a delivery code (e.g. H5) using the specified delivery date and digits in year.
public static string DeliveryCode(DateTime deliveryDate, int digitsInYear)
Parameters
Returns
Equals(Future)
Returns true if the specified future equals this one.
public bool Equals(Future future)
Parameters
future
Future
Returns
Equals(object)
Returns true if the specified object equals this one;
public override bool Equals(object obj)
Parameters
obj
object
Returns
GetDeliveryCode()
Returns the delivery code portion of the symbol (e.g. Z1, Z11, or Z2011 depending on DigitsInYear property).
public string GetDeliveryCode()
Returns
GetHashCode()
Returns a hash code for this future calculated on root symbol and delivery date.
public override int GetHashCode()
Returns
GetSymbol(bool)
Returns the concatenated symbol.
public string GetSymbol(bool includeSuffix = true)
Parameters
includeSuffix
bool
Returns
MonthCode(char)
Converts a single letter month code to its integer equivalent.
public static int MonthCode(char monthCode)
Parameters
monthCode
char
Returns
MonthCode(int)
Coverts an integer month to the month code letter.
public static string MonthCode(int month)
Parameters
month
int
Returns
MonthCode(string)
Converts a single letter month code to its integer equivalent.
public static int MonthCode(string monthCode)
Parameters
monthCode
string
Returns
Parse(string)
Parses the specified string returning a new Future object.
public static Future Parse(string symbol)
Parameters
symbol
string
Returns
Parse(string, DateTime)
Parses the specified string using the asOfDate as a hint for single digit year symbols.
public static Future Parse(string symbol, DateTime asOfDate)
Parameters
Returns
ToString()
Returns a string representation of this futures symbol.
public override string ToString()
Returns
TryParse(string, out Future)
Parses the specified symbol into a Future object and returns a value indicating success.
public static bool TryParse(string symbol, out Future future)
Parameters
Returns
TryParse(string, DateTime, out Future)
Parses the specified symbol into a Future object and returns a value indicating success.
public static bool TryParse(string symbol, DateTime asOfDate, out Future future)
Parameters
Returns
Operators
operator ==(Future, Future)
Returns true if the two futures object have value equality.
public static bool operator ==(Future left, Future right)
Parameters
Returns
operator ==(Future, string)
Returns true if the parsed symbol string equals the specified future.
public static bool operator ==(Future future, string symbol)
Parameters
Returns
operator !=(Future, Future)
Returns true if the specified Futures objects do not have value equality.
public static bool operator !=(Future left, Future right)
Parameters
Returns
operator !=(Future, string)
Returns true if the parsed symbol string does not equal the specified future.
public static bool operator !=(Future future, string symbol)