// Generic Constructor, not used in derived class public ListedSTFutOption(double CoP, double underlying, double strike, Date ValuationDate, Date ExpiryDate, double sigma, double daysPerYear, string label, double minTick, double minTickValue, double contractSize, string currency, double dayBasis) : base(CoP, underlying, strike, ExpiryDate.SerialValue - ValuationDate.SerialValue, sigma, daysPerYear) { myContractSpec = new ListedContSpec(label, minTick, minTickValue, contractSize, currency, dayBasis); OptExpiryDate = ExpiryDate; }
// Constructor using ContractLabelFromDB public ListedSTFutOption(double CoP, double underlying, double strike, Date ValuationDate, Date ExpiryDate, double sigma, double daysPerYear, string ContractLabelFromDB) : base(CoP, underlying, strike, ExpiryDate.SerialValue - ValuationDate.SerialValue, sigma, daysPerYear) { myContractSpec = Singleton <ListedContDB> .Instance.GetContrSpec(ContractLabelFromDB); OptExpiryDate = ExpiryDate; }
// class ListedContSpec public static void Example_3() { // I create a customized ListedContSpec ListedContSpec myListedContSpec = new ListedContSpec("Custom", 0.01, 10, 100000, "EUR", 360); Console.WriteLine("customized ListedContSpec:"); // ListedContSpec properties Console.WriteLine("{0}\t{1}", "myListedContSpec.GetLabel", myListedContSpec.GetLabel); Console.WriteLine("{0}\t{1}", "myListedContSpec.GetMinTick", myListedContSpec.GetMinTick); Console.WriteLine("{0}\t{1}", "myListedContSpec.GetMinTickValue", myListedContSpec.GetMinTickValue); Console.WriteLine("{0}\t{1}", "myListedContSpec.GetContractSize", myListedContSpec.GetContractSize); Console.WriteLine("{0}\t{1}", "myListedContSpec.GetCurrency", myListedContSpec.GetCurrency); Console.WriteLine("{0}\t{1}", "myListedContSpec.GetDayBasis", myListedContSpec.GetDayBasis); }
// Constructor: can only use "ContractLabelFromDB" value that are already in ListedContDB public ListedSTFut(double price, int Month, int Year, string ContractLabelFromDB) : base(price, Month, Year) { ContractSpec = Singleton <ListedContDB> .Instance.GetContrSpec(ContractLabelFromDB); }
// Constuctor: can create a custom Listed Short Term Future. "customLabel" can be as you like. public ListedSTFut(double price, int Month, int Year, string customLabel, double minTick, double minTickValue, double contractSize, string currency, double dayBasis) : base(price, Month, Year) { ContractSpec = new ListedContSpec(customLabel, minTick, minTickValue, contractSize, currency, dayBasis); }