public static TT_Instrument GetInstrument(string instr_id) { if (!privInstance.instruments.ContainsKey(instr_id)) { TT_Instrument req = RequestInstrument(instr_id); if (req != null) { privInstance.instruments.Add(req.id, req); } } TT_Instrument instr = privInstance.instruments[instr_id]; return(instr); }
private static TT_Instrument RequestInstrument(string instr_id) { var result = RestManager.GetRequest("pds", "instrument/" + instr_id); InstrumentResponse response = JsonConvert.DeserializeObject <InstrumentResponse>(result.Content); if (response.instrument != null) { return(response.instrument[0]); } else { TT_Instrument instr = new TT_Instrument(); instr.id = instr_id; instr.alias = "Permission Denied"; instr.productSymbol = "Permission Denied"; instr.productTypeId = 34; instr.optionCodeId = 2; return(instr); } }