public static InstrInfo GenerateRandomInstrument(InstrInfo.EType type) { InstrInfo randomInstr = new InstrInfo(); randomInstr.type = type; randomInstr.sym = highCapSymbols[numGenerator.Next(0, highCapSymbols.Length - 1)]; if (type == InstrInfo.EType.OPTION) { int maturityYear = numGenerator.Next(2018, 2020); int maturityMonth = numGenerator.Next(1, 13); int maturityDay = numGenerator.Next(1, 29); randomInstr.maturity = maturityYear * 10000 + maturityMonth * 100 + maturityDay; randomInstr.strike = numGenerator.Next(10, 101); randomInstr.callput = maturityYear % 2 == 0 ? InstrInfo.ECallPut.CALL : InstrInfo.ECallPut.PUT; } return(randomInstr); }
public void Initialize(InstrInfo[] instr) { _instruments = instr; _instrumentType = instr.Length > 1 ? InstrInfo.EType.OPTION : instr[0].type; SetupComboBoxes(); }