Example #1
0
        private void OnQuotesReceivedEventHandler(object sender, QuotesEventArgs args)
        {
            Log.Verbose("Quotes: {@quotes}", args.Quotes);

            MarketDataRepository.ApplyQuotes(args.Quotes);

            var symbolsIds = new HashSet <int>();

            foreach (var quote in args.Quotes)
            {
                if (!symbolsIds.Contains(quote.SymbolId))
                {
                    symbolsIds.Add(quote.SymbolId);
                }
            }

            foreach (var symbolId in symbolsIds)
            {
                var symbol = Account.Symbols.FirstOrDefault(s => s.Id == symbolId);
                if (symbol != null)
                {
                    QuotesUpdated?.Invoke(this, new MarketDataEventArgs(symbol));
                }
            }
        }
 protected void RiseQuotesUpdatedEvent(EventArgs args)
 {
     QuotesUpdated?.Invoke(this, args);
 }