public static List <IInstrument> GetInstrumentBySector(string name, DistributeAnalyseType secType = DistributeAnalyseType.Industory) { if (secType == DistributeAnalyseType.Industory) { return(AllInstrumentList.Where(v => v.Industory == name).ToList()); } if (secType == DistributeAnalyseType.Region) { return(AllInstrumentList.Where(v => v.Region == name).ToList()); } if (secType == DistributeAnalyseType.Instrument) { return(AllInstrumentList.Where(v => v.Name == name || v.Ticker == name).ToList()); } return(null); }
public static string GetInstrumentSectorName(string ticker, DistributeAnalyseType secType = DistributeAnalyseType.Industory) { var inst = AllInstrumentList.FirstOrDefault(i => i.Ticker == ticker); if (inst != null) { if (secType == DistributeAnalyseType.Industory) { return(inst.Industory); } if (secType == DistributeAnalyseType.Region) { return(inst.Region); } if (secType == DistributeAnalyseType.Instrument) { return(inst.Name); } } return(null); }