Exemplo n.º 1
0
        public SymbolEvent startWatch(string Symbol)
        {
            // this is a bit tenuous in that the caller has to get attached to the event before
            //   asynchronous data is returned -- how often will/does this happen?
            //   particularily if we are watching for a 'Not Found' message.

            SymbolEvent se = null;

            if (!htWatchSymbols.ContainsKey(Symbol))
            {
                se = new SymbolEvent();
                htWatchSymbols.Add(Symbol, se);
            }
            else
            {
                se = htWatchSymbols[Symbol] as SymbolEvent;
            }

            se.Count++;

            if (1 == se.Count)
            {
//        Console.WriteLine("StartWatch {0}", sSymbol);
                bs5009.Send("w" + Symbol + "\n");
            }
            return(se);
        }
Exemplo n.º 2
0
        private void SymbolSpecificFundamentalMessage(object o, FundamentalMessageEventArgs args)
        {
            string Symbol = args.Message.Symbol;

            if (htWatchSymbols.ContainsKey(Symbol))
            {
                SymbolEvent se = htWatchSymbols[Symbol] as SymbolEvent;
                se.EmitFundamentalMessage(args);
            }
        }
Exemplo n.º 3
0
 private void SymbolSpecificNewsMessage(object o, NewsMessageEventArgs args)
 {
     foreach (string Symbol in args.Message.Symbols)
     {
         if (htWatchSymbols.ContainsKey(Symbol))
         {
             SymbolEvent se = htWatchSymbols[Symbol] as SymbolEvent;
             se.EmitNewsMessage(args);
         }
     }
 }
Exemplo n.º 4
0
        public SymbolEvent stopWatch(string Symbol)
        {
            SymbolEvent se = null;

            if (htWatchSymbols.ContainsKey(Symbol))
            {
                se = htWatchSymbols[Symbol] as SymbolEvent;
                if (0 < se.Count)
                {
                    se.Count--;
                }
                if (0 == se.Count)
                {
//          Console.WriteLine("StopWatch {0}", sSymbol);
                    bs5009.Send("r" + Symbol + "\n");
                }
            }
            return(se);
        }