Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 public void Filter(string filter)
 {
     InstrumentList.Clear();
     if (string.IsNullOrEmpty(filter))
     {
         AllInstrumentList.ForEach(v => InstrumentList.Add(v));
     }
     else
     {
         AllInstrumentList.ForEach(v =>
         {
             if (v.Ticker.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0 ||
                 v.Name.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0 ||
                 v.PYName.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0)
             {
                 InstrumentList.Add(v);
             }
         });
     }
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 public static IInstrument GetInstrument(string ticker)
 {
     return(AllInstrumentList.FirstOrDefault(v => v.Ticker == ticker));
 }