Table of Contents

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

rootSymbol string
deliveryDate DateTime

Future(string, int)

Instantiates a new Future object using the specified root symbol and delivery code.

public Future(string rootSymbol, int deliveryCode)

Parameters

rootSymbol string
deliveryCode int

Year and month integer (e.g. 201612 for Dec 2016)

Properties

DeliveryDate

Gets the delivery date.

public DateTime DeliveryDate { get; }

Property Value

DateTime

DigitsInYear

Gets/sets the number of digits of the delivery year to show in the symbol.

public int DigitsInYear { get; set; }

Property Value

int

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

int

Root

Gets the root symbol.

public string Root { get; }

Property Value

string

Suffix

Gets/sets a suffix to append to the end.

public string Suffix { get; set; }

Property Value

string

Methods

CompareTo(Future)

Compares the value of this instance to the specified Future.

public int CompareTo(Future other)

Parameters

other Future

Returns

int

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

deliveryDate DateTime
digitsInYear int

Returns

string

Equals(Future)

Returns true if the specified future equals this one.

public bool Equals(Future future)

Parameters

future Future

Returns

bool

Equals(object)

Returns true if the specified object equals this one;

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetDeliveryCode()

Returns the delivery code portion of the symbol (e.g. Z1, Z11, or Z2011 depending on DigitsInYear property).

public string GetDeliveryCode()

Returns

string

GetHashCode()

Returns a hash code for this future calculated on root symbol and delivery date.

public override int GetHashCode()

Returns

int

GetSymbol(bool)

Returns the concatenated symbol.

public string GetSymbol(bool includeSuffix = true)

Parameters

includeSuffix bool

Returns

string

MonthCode(char)

Converts a single letter month code to its integer equivalent.

public static int MonthCode(char monthCode)

Parameters

monthCode char

Returns

int

MonthCode(int)

Coverts an integer month to the month code letter.

public static string MonthCode(int month)

Parameters

month int

Returns

string

MonthCode(string)

Converts a single letter month code to its integer equivalent.

public static int MonthCode(string monthCode)

Parameters

monthCode string

Returns

int

Parse(string)

Parses the specified string returning a new Future object.

public static Future Parse(string symbol)

Parameters

symbol string

Returns

Future

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

symbol string
asOfDate DateTime

Returns

Future

ToString()

Returns a string representation of this futures symbol.

public override string ToString()

Returns

string

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

symbol string
future Future

Returns

bool

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

symbol string
asOfDate DateTime
future Future

Returns

bool

Operators

operator ==(Future, Future)

Returns true if the two futures object have value equality.

public static bool operator ==(Future left, Future right)

Parameters

left Future
right Future

Returns

bool

operator ==(Future, string)

Returns true if the parsed symbol string equals the specified future.

public static bool operator ==(Future future, string symbol)

Parameters

future Future
symbol string

Returns

bool

operator !=(Future, Future)

Returns true if the specified Futures objects do not have value equality.

public static bool operator !=(Future left, Future right)

Parameters

left Future
right Future

Returns

bool

operator !=(Future, string)

Returns true if the parsed symbol string does not equal the specified future.

public static bool operator !=(Future future, string symbol)

Parameters

future Future
symbol string

Returns

bool