Skip to content

Commit

Permalink
Fix history manager configuration assertion (#8361)
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Molinero authored Oct 7, 2024
1 parent 3304814 commit 16c893d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 0 additions & 3 deletions Engine/HistoricalData/BrokerageHistoryProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ public override IEnumerable<Slice> GetHistory(IEnumerable<HistoryRequest> reques
continue;
}
var subscription = CreateSubscription(request, history);

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

subscriptions.Add(subscription);
}

Expand Down
13 changes: 12 additions & 1 deletion Engine/HistoricalData/HistoryProviderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using QuantConnect.Configuration;
using QuantConnect.Data;
using QuantConnect.Interfaces;
using QuantConnect.Lean.Engine.DataFeeds;
using QuantConnect.Lean.Engine.DataFeeds.Enumerators;
using QuantConnect.Logging;
using QuantConnect.Util;
Expand All @@ -33,6 +34,7 @@ namespace QuantConnect.Lean.Engine.HistoricalData
/// </summary>
public class HistoryProviderManager : HistoryProviderBase
{
private IDataPermissionManager _dataPermissionManager;
private IBrokerage _brokerage;
private bool _initialized;

Expand Down Expand Up @@ -75,6 +77,7 @@ public override void Initialize(HistoryProviderInitializeParameters parameters)
dataProvidersList.AddRange(Config.Get("history-provider", "SubscriptionDataReaderHistoryProvider").DeserializeList());
}

_dataPermissionManager = parameters.DataPermissionManager;
foreach (var historyProviderName in dataProvidersList)
{
IHistoryProvider historyProvider;
Expand Down Expand Up @@ -129,7 +132,15 @@ public override void Initialize(HistoryProviderInitializeParameters parameters)
public override IEnumerable<Slice> GetHistory(IEnumerable<HistoryRequest> requests, DateTimeZone sliceTimeZone)
{
List<IEnumerator<Slice>> historyEnumerators = new(_historyProviders.Count);
var historyRequets = requests.ToList();

var historyRequets = new List<HistoryRequest>();
foreach (var request in requests)
{
var config = request.ToSubscriptionDataConfig();
_dataPermissionManager?.AssertConfiguration(config, request.StartTimeLocal, request.EndTimeLocal);
historyRequets.Add(request);
}

foreach (var historyProvider in _historyProviders)
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public override IEnumerable<Slice> GetHistory(IEnumerable<HistoryRequest> reques
private Subscription CreateSubscription(HistoryRequest request)
{
var config = request.ToSubscriptionDataConfig();
DataPermissionManager.AssertConfiguration(config, request.StartTimeLocal, request.EndTimeLocal);

// this security is internal only we do not need to worry about a few of it's properties
// TODO: we don't need fee/fill/BPM/etc either. Even better we should refactor & remove the need for the security
Expand Down

0 comments on commit 16c893d

Please sign in to comment.