47 Brokerage =
Config.
Get(
"data-downloader-brokerage"),
59 liveNodeConfiguration.
BrokerageData = brokerageFactory.BrokerageData;
61 catch (InvalidOperationException error)
63 throw new InvalidOperationException($
"{nameof(BrokerageDataDownloader)}.An error occurred while resolving brokerage data for a live job. Brokerage: {liveNodeConfiguration.Brokerage}.", error);
68 _brokerage.
Message += (
object _, Brokerages.BrokerageMessageEvent e) =>
70 if (e.Type == Brokerages.BrokerageMessageType.Error)
72 Logging.Log.Error(e.Message);
76 Logging.Log.Trace(e.Message);
90 var symbol = dataDownloaderGetParameters.
Symbol;
91 var resolution = dataDownloaderGetParameters.
Resolution;
92 var startUtc = dataDownloaderGetParameters.
StartUtc;
93 var endUtc = dataDownloaderGetParameters.
EndUtc;
94 var tickType = dataDownloaderGetParameters.
TickType;
97 var exchangeHours = _marketHoursDatabase.GetExchangeHours(symbol.ID.Market, symbol, symbol.SecurityType);
98 var dataTimeZone = _marketHoursDatabase.GetDataTimeZone(symbol.ID.Market, symbol, symbol.SecurityType);
100 var symbols =
new List<Symbol> { symbol };
101 if (symbol.IsCanonical())
103 symbols = GetChainSymbols(symbol,
true).ToList();
109 var request =
new Data.HistoryRequest(startUtc, endUtc, dataType, symbol, resolution, exchangeHours: exchangeHours, dataTimeZone: dataTimeZone, resolution,
116 Logging.Log.Trace($
"{nameof(BrokerageDataDownloader)}.{nameof(Get)}: Ignoring history request for unsupported symbol {symbol}");
121 .Where(history => history !=
null)
122 .SelectMany(history => history);
130 private IEnumerable<Symbol> GetChainSymbols(
Symbol symbol,
bool includeExpired)
134 return universeProvider.LookupSymbols(symbol, includeExpired);
138 throw new InvalidOperationException($
"{nameof(BrokerageDataDownloader)}.{nameof(GetChainSymbols)}: The current brokerage does not support fetching canonical symbols. Please ensure your brokerage instance supports this feature.");