public override void GetQuotesEx(string ticker, ref QuotationArray quotes) { if (firstGetQuotesExCall) { periodicity = quotes.Periodicity; firstGetQuotesExCall = false; } try { var tickerData = tickers.RegisterTicker(ticker); if (tickerData.QuoteDataStatus == QuoteDataStatus.Offline) { tickerData.MarkTickerForGetQuotes(periodicity); return; } if (tickerData.QuoteDataStatus != QuoteDataStatus.Online) { return; } lock (tickerData) { quotes.Merge(tickerData.Quotes); } } catch (Exception ex) { LogAndMessage.LogAndQueue(MessageType.Error, "Failed to subscribe to quote update: " + ex); } }
public void GetQuotesEx(string ticker, ref QuotationArray quotes) { // save database periodicity at the very first call if (!firstGetQuotesExCall) { periodicity = quotes.Periodicity; firstGetQuotesExCall = true; } try { TickerData tickerData = tickers.GetTickerData(ticker); // if ticker is not yet known (first time to use in charts and no RT window use) if (tickerData == null) { tickerData = tickers.RegisterTicker(ticker); } if (tickerData.QuoteDataStatus == QuoteDataStatus.Offline) { // mark it for periodic Quotation data update tickerData.MarkTickerForGetQuotes(periodicity); // we do not want to run data refresh on AB's thread... // we also want async processing of historical data download... if (connected) { EnqueueTickerForRefresh(ticker); } } lock (tickerData) { // merge downloaded data to AB's quotation array quotes.Merge(tickerData.Quotes); // save last download time tickerData.LastDownloaded = tickerData.LastProcessed; } } catch (Exception ex) { LogAndMessage.LogAndAdd(MessageType.Error, "Failed to subscribe to quote update: " + ex); } }