Exemplo n.º 1
0
        private void DoLoop()
        {
            for (; m_continue;)
            {
                if (null == m_func)
                {
                    Thread.Sleep(256);
                    continue;
                }

                byte* ptr = m_func(m_handle, 256);
                if (null == ptr)
                {
                    continue;
                }
                var func = Tick;
                if (null == func)
                {
                    continue;
                }
                Quote quote = new Quote(ptr);
                if ((quote.Bids.Length > 0) || (quote.Asks.Length > 0))
                {
                    TickEventArgs e = new TickEventArgs(quote);
                    func(this, e);
                }
            }

            m_func(m_handle, 0);
        }
Exemplo n.º 2
0
 internal void Add(Quote quote)
 {
     lock (m_synchronizer)
     {
         long now = EnvironmentEx.GetTickCountEx();
         QuoteEx entry = new QuoteEx(now, quote);
         m_first.Add(entry);
     }
 }
Exemplo n.º 3
0
        internal void Set(Quote[] quotes)
        {
            m_quotes.Clear();

            Quote last = quotes.Last();
            m_time = 0;

            foreach (var element in quotes)
            {
                long time = (long)(element.CreatingTime - last.CreatingTime).TotalMilliseconds;
                long delta = (m_time - time);
                if (delta <= m_intervalInMs)
                {
                    QuoteEx quote = new QuoteEx(time, element);
                    m_quotes.Enqueue(quote);
                }
            }
        }
Exemplo n.º 4
0
 internal QuoteEx(long time, Quote quote)
     : this()
 {
     m_time = time;
     m_quote = quote;
 }
Exemplo n.º 5
0
 internal QuoteEx(Quote quote)
     : this()
 {
     m_time = EnvironmentEx.GetTickCountEx();
     m_quote = quote;
 }
 internal TickEventArgs(Quote quote)
 {
     this.Tick = quote;
 }