47 Brokerage =
Config.
Get(
"data-downloader-brokerage"),
60 liveNodeConfiguration.
BrokerageData = brokerageFactory.BrokerageData;
62 catch (InvalidOperationException error)
64 throw new InvalidOperationException($
"{nameof(BrokerageDataDownloader)}.An error occurred while resolving brokerage data for a live job. Brokerage: {liveNodeConfiguration.Brokerage}.", error);
69 _brokerage.
Message += (
object _, Brokerages.BrokerageMessageEvent e) =>
71 if (e.Type == Brokerages.BrokerageMessageType.Error)
73 Logging.Log.Error(e.Message);
77 Logging.Log.Trace(e.Message);
91 var symbol = dataDownloaderGetParameters.
Symbol;
92 var resolution = dataDownloaderGetParameters.
Resolution;
93 var startUtc = dataDownloaderGetParameters.
StartUtc;
94 var endUtc = dataDownloaderGetParameters.
EndUtc;
95 var tickType = dataDownloaderGetParameters.
TickType;
98 var exchangeHours = _marketHoursDatabase.GetExchangeHours(symbol.ID.Market, symbol, symbol.SecurityType);
99 var dataTimeZone = _marketHoursDatabase.GetDataTimeZone(symbol.ID.Market, symbol, symbol.SecurityType);
101 var symbols =
new List<Symbol> { symbol };
102 if (symbol.IsCanonical())
104 symbols = GetChainSymbols(symbol,
true).ToList();
110 var request =
new Data.HistoryRequest(startUtc, endUtc, dataType, symbol, resolution, exchangeHours: exchangeHours, dataTimeZone: dataTimeZone, resolution,
117 Logging.Log.Trace($
"{nameof(BrokerageDataDownloader)}.{nameof(Get)}: Ignoring history request for unsupported symbol {symbol}");
122 .Where(history => history !=
null)
123 .SelectMany(history => history);
131 private IEnumerable<Symbol> GetChainSymbols(
Symbol symbol,
bool includeExpired)
135 return universeProvider.LookupSymbols(symbol, includeExpired);
139 throw new InvalidOperationException($
"{nameof(BrokerageDataDownloader)}.{nameof(GetChainSymbols)}: The current brokerage does not support fetching canonical symbols. Please ensure your brokerage instance supports this feature.");