public static string ConstructStrategyAlias(string ticker1, string ticker2, string ticker3, int direction) { InstumentSpecs InstrumentSpecs1 = Instrument.GetSpecs(ticker1); InstumentSpecs InstrumentSpecs2 = Instrument.GetSpecs(ticker2); InstumentSpecs InstrumentSpecs3 = Instrument.GetSpecs(ticker3); string StrategyAlias; if (direction > 0) { StrategyAlias = InstrumentSpecs1.TickerHead + InstrumentSpecs1.TickerMonthString + InstrumentSpecs1.TickerYear.ToString() + InstrumentSpecs2.TickerMonthString + InstrumentSpecs2.TickerYear.ToString() + InstrumentSpecs2.TickerMonthString + InstrumentSpecs2.TickerYear.ToString() + InstrumentSpecs3.TickerMonthString + InstrumentSpecs3.TickerYear.ToString(); } else { StrategyAlias = InstrumentSpecs1.TickerHead + InstrumentSpecs2.TickerMonthString + InstrumentSpecs2.TickerYear.ToString() + InstrumentSpecs3.TickerMonthString + InstrumentSpecs3.TickerYear.ToString() + InstrumentSpecs1.TickerMonthString + InstrumentSpecs1.TickerYear.ToString() + InstrumentSpecs2.TickerMonthString + InstrumentSpecs2.TickerYear.ToString(); } return(StrategyAlias); }
public static InstumentSpecs GetSpecs(string ticker) { InstumentSpecs SpecsOutput = new InstumentSpecs(); SpecsOutput.TickerHead = ticker.Substring(0, ticker.Length - 5); SpecsOutput.TickerYear = int.Parse(ticker.Substring(ticker.Length - 4, 4)); SpecsOutput.TickerMonthString = ticker.Substring(ticker.Length - 5, 1); SpecsOutput.TickerMonthNum = ConvertMonthFromStringToNumber(SpecsOutput.TickerMonthString); SpecsOutput.ContINDX = 100 * SpecsOutput.TickerYear + SpecsOutput.TickerMonthNum; Console.WriteLine(SpecsOutput.TickerYear); Console.WriteLine(SpecsOutput.TickerHead); Console.WriteLine(SpecsOutput.TickerMonthString); Console.WriteLine(SpecsOutput.TickerMonthNum); Console.WriteLine(SpecsOutput.ContINDX); return(SpecsOutput); }
public static InstumentSpecs GetSpecs(string ticker) { InstumentSpecs SpecsOutput = new InstumentSpecs(); SpecsOutput.TickerHead = ticker.Substring(0, ticker.Length-5); SpecsOutput.TickerYear = int.Parse(ticker.Substring(ticker.Length - 4, 4)); SpecsOutput.TickerMonthString = ticker.Substring(ticker.Length - 5, 1); SpecsOutput.TickerMonthNum = ConvertMonthFromStringToNumber(SpecsOutput.TickerMonthString); SpecsOutput.ContINDX = 100 * SpecsOutput.TickerYear + SpecsOutput.TickerMonthNum; Console.WriteLine(SpecsOutput.TickerYear); Console.WriteLine(SpecsOutput.TickerHead); Console.WriteLine(SpecsOutput.TickerMonthString); Console.WriteLine(SpecsOutput.TickerMonthNum); Console.WriteLine(SpecsOutput.ContINDX); return SpecsOutput; }