Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle history provider returning null #7804

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Engine/HistoricalData/BrokerageHistoryProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,22 @@ public override IEnumerable<Slice> GetHistory(IEnumerable<HistoryRequest> reques
foreach (var request in requests)
{
var history = _brokerage.GetHistory(request);
if (history == null)
{
// doesn't support this history request, that's okay
continue;
}
var subscription = CreateSubscription(request, history);

_dataPermissionManager.AssertConfiguration(subscription.Configuration, request.StartTimeLocal, request.EndTimeLocal);

subscriptions.Add(subscription);
}

if (subscriptions.Count == 0)
{
return null;
}
return CreateSliceEnumerableFromSubscriptions(subscriptions, sliceTimeZone);
}
}
Expand Down
10 changes: 10 additions & 0 deletions Engine/HistoricalData/HistoryProviderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ public override void Initialize(HistoryProviderInitializeParameters parameters)
dataQueueHandler = Composer.Instance.GetExportedValueByTypeName<IDataQueueHandler>(brokerageName);
// initialize it
dataQueueHandler.SetJob((Packets.LiveNodePacket)parameters.Job);
Log.Trace($"HistoryProviderManager.Initialize(): Created and wrapped '{brokerageName}' as '{typeof(BrokerageHistoryProvider).Name}'");
}
else
{
Log.Trace($"HistoryProviderManager.Initialize(): Wrapping '{brokerageName}' instance as '{typeof(BrokerageHistoryProvider).Name}'");
}

// wrap it
Expand Down Expand Up @@ -130,6 +135,11 @@ public override IEnumerable<Slice> GetHistory(IEnumerable<HistoryRequest> reques
try
{
var history = historyProvider.GetHistory(historyRequets, sliceTimeZone);
if (history == null)
{
// doesn't support this history request, that's okay
continue;
}
historyEnumerators.Add(history.GetEnumerator());
}
catch (Exception e)
Expand Down
Loading