Example #1
0
        public void subscribePrice(ExpertBase expert)
        {
            string pair = expert.Pair;
            if (!mapExperts.ContainsKey(pair))
                mapExperts.Add(pair, new List<ExpertBase>());

            mapExperts[pair].Add(expert);  // replacement
            expert.Factory = this;
        }
Example #2
0
 public void removeExpert(ExpertBase expert)
 {
     if (mapExperts.ContainsKey(expert.Pair))
     {
         List<ExpertBase> leb = mapExperts[expert.Pair];
         if (leb.Contains(expert))
         {
             leb.Remove(expert);
         }
         // rather than remove, complicating copy before iteration
         // leave leb empty, doesn't hurt
         // shutdown based on map, anyway
         //if (leb.Count == 0)
         //{
         //    mapExperts.Remove(expert.Pair);
         //}
     }
     if (map.ContainsKey(expert))
     {
         map.Remove(expert);
     }
     if (map.Count == 0)
         shutdown(); // this factory // How do you get here?!
 }
Example #3
0
 // subscribe for callbacks to an expert
 public void subscribe(ExpertBase expert)
 {
     if (!map.ContainsKey(expert))
     {
         map.Add(expert, new Dictionary<string, object>());
     }
     Dictionary<string, object> smap = map[expert];
     smap["timeframe"] = expert.Timeframe;
     smap["pair"] = expert.Pair;
     expert.Factory = this;
 }