public void AddRawInstrument(RawInstrument ri, InstrumentShared ins) { this.instrumentList.Add(ins); string leadingMonth = " "; if (ri.symbol.IndexOf("-") > 0) { string[] tStr = ri.symbol.Split('-'); if (tStr.Length > 1) { leadingMonth = tStr[0]; } } else if (this.instType == "DF" || this.instType == "CF") { if (ri.symbol.IndexOf(" ") > 0) { string[] tStr = ri.symbol.Split(' '); if (tStr.Length > 1) { leadingMonth = tStr[0] + " " + tStr[1].Substring(0, 2); } } } if (leadingMonth != "") { if (splitList.ContainsKey(leadingMonth) == false) { SplitInstrument spIns = new SplitInstrument(); spIns.expirationDate = ins.expiry; spIns.name = leadingMonth + "..."; spIns.instrumentList = new List <InstrumentShared>(); spIns.instrumentList.Add(ins); this.splitList.Add(leadingMonth, spIns); } else { SplitInstrument spIns = splitList[leadingMonth]; spIns.instrumentList.Add(ins); } } }
public void AddRawInstrument(RawInstrument ri, InstrumentShared ins) { this.instrumentList.Add(ins); string leadingMonth = " "; if (ri.symbol.IndexOf("-") > 0) { string[] tStr = ri.symbol.Split('-'); if (tStr.Length > 1) { leadingMonth = tStr[0]; } } else if (this.instType == "DF" || this.instType == "CF") { if (ri.symbol.IndexOf(" ") > 0) { string[] tStr = ri.symbol.Split(' '); if (tStr.Length > 1) { leadingMonth = tStr[0] + " " + tStr[1].Substring(0, 2); } } } if (leadingMonth != "") { if (splitList.ContainsKey(leadingMonth) == false) { SplitInstrument spIns = new SplitInstrument(); spIns.expirationDate = ins.expiry; spIns.name = leadingMonth + "..."; spIns.instrumentList = new List<InstrumentShared>(); spIns.instrumentList.Add(ins); this.splitList.Add(leadingMonth, spIns); } else { SplitInstrument spIns = splitList[leadingMonth]; spIns.instrumentList.Add(ins); } } }