Example #1
0
 private async void PipelineStartup_QuotesRealTimeStarted(object sender, Quote_EventArgs e)
 {
     await dispatcher.InvokeAsync(() =>
     {
         SymbolsList.Add(e.Quote_VM.ReqId, e.Quote_VM);
     });
 }
Example #2
0
        //private async Task TickTimer()
        //{
        //    try
        //    {
        //        foreach (var q in QuotesList)
        //        {
        //            await Task.Delay(1);
        //            var rand = new Random((int)DateTime.UtcNow.Ticks);
        //            double val = rand.NextDouble();
        //            processReceivedRT.Post(new Tuple<int, Bar>(q.ReqId, new Bar(DateTime.Now.ToString("HH:mm:ss"),
        //                q.Latest, q.HighValue, q.LowValue, q.Latest * (1 + (0.5 - val)), 0, 0, 0)));
        //        }
        //    }
        //    catch (Exception) {}
        //}

        private async void PipelineStartup_QuoteRemoved(object sender, Quote_EventArgs e)
        {
            await dispatcher.InvokeAsync(() =>
            {
                QuotesList.Remove(e.Quote_VM);
                SymbolsList.Remove(e.Quote_VM.ReqId);
            });
        }
Example #3
0
        private async void PipelineStartup_AddQuote(object sender, Quote_EventArgs e)
        {
            await dispatcher.InvokeAsync(() =>
            {
                Quote_ViewModel qVM = QuotesList.FirstOrDefault(s => s.Symbol == e.Quote_VM.Symbol);

                if (qVM != null)
                {
                    // We have to remove the already existing quote with the same symbol:
                    QuotesList.Remove(qVM);
                    if (SymbolsList.ContainsKey(qVM.ReqId))
                    {
                        SymbolsList.Remove(qVM.ReqId);
                    }
                }
                QuotesList.Add(e.Quote_VM);
            });
        }