protected virtual void OnTickUpdated(TickEventArgs tickDetails)
 {
     if (TickUpdated != null)
     {
         TickUpdated(this, tickDetails);
     }
 }
Beispiel #2
0
        private static void OnTickUpdated(object source, TickEventArgs args)
        {
            Console.WriteLine(args.Close);

            tickQueue.Enqueue(args.Close);

            if (tickQueue.Count >= 10)
            {
                Console.WriteLine("We hit sample size");


                Thread runThread = new Thread(() =>
                {
                    foreach (var data in tickList)
                    {
                        Console.WriteLine("Sample set, do some work: " + data);
                    }
                });

                runThread.Start();
                if (runThread.ThreadState == ThreadState.Stopped)
                {
                    tickList.RemoveRange(0, 10);
                }
            }
        }
        }   //Publish tick data

        public TickEventArgs TickDetials(string date, string open, string high, string low, string close, string volume)
        {
            tickData = new TickEventArgs()
            {
                Timestamp = DateTime.Parse(date),
                Open      = Double.Parse(open),
                High      = Double.Parse(high),
                Low       = Double.Parse(low),
                Close     = Double.Parse(close),
                Volume    = Convert.ToInt32(volume)
            };

            return(tickData);
        }