Skip to content

Commit

Permalink
Remove unrequired, unused universe DQH call (#7914)
Browse files Browse the repository at this point in the history
- Remove unrequired, unused DQH subscription call to universe
  subscription
  • Loading branch information
Martin-Molinero authored Apr 15, 2024
1 parent dc1748f commit 2ff13ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
6 changes: 0 additions & 6 deletions Engine/DataFeeds/LiveTradingDataFeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,12 +410,6 @@ private Subscription CreateUniverseSubscription(SubscriptionRequest request)
var subscriptionDataEnumerator = new SubscriptionDataEnumerator(request.Configuration, request.Security.Exchange.Hours, tzOffsetProvider, enumerator, request.IsUniverseSubscription);
subscription = new Subscription(request, subscriptionDataEnumerator, tzOffsetProvider);

// send the subscription for the new symbol through to the data queuehandler
if (_channelProvider.ShouldStreamSubscription(subscription.Configuration))
{
Subscribe(request.Configuration, (sender, args) => subscription?.OnNewDataAvailable(), (_) => false);
}

return subscription;
}

Expand Down
22 changes: 11 additions & 11 deletions Tests/Engine/DataFeeds/LiveTradingDataFeedTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1178,8 +1178,8 @@ public void AddsSubscription_NewUserUniverse()
{
Assert.IsTrue(ts.Slice.Keys.Contains(Symbols.SPY));
}
// SPY benchmark and the UserDefinedUniverse
Assert.AreEqual(2, _dataQueueHandler.Subscriptions.Count);
// SPY benchmark
Assert.AreEqual(1, _dataQueueHandler.Subscriptions.Count);

_algorithm.AddSecurities(forex: new List<string> { "EURUSD" });
emittedData = true;
Expand All @@ -1192,8 +1192,8 @@ public void AddsSubscription_NewUserUniverse()
}
else
{
// SPY benchmark and the UserDefinedUniverse Equity/Forex, EURUSD
if (_dataQueueHandler.Subscriptions.Count == 4) // there could be some slices with no data
// SPY benchmark and EURUSD
if (_dataQueueHandler.Subscriptions.Count == 2) // there could be some slices with no data
{
Assert.IsTrue(_dataQueueHandler.Subscriptions.Contains(Symbols.SPY));
if (ts.Data.Count > 0)
Expand Down Expand Up @@ -1244,8 +1244,8 @@ public void AddsNewUniverse()
securityChanges += ts.SecurityChanges.Count;
if (!firstTime)
{
// benchmark SPY, EURUSD and the UserDefinedUniverse
Assert.AreEqual(3, _dataQueueHandler.Subscriptions.Count);
// benchmark SPY, EURUSD
Assert.AreEqual(2, _dataQueueHandler.Subscriptions.Count);
_algorithm.AddUniverse("TestUniverse", time => new List<string> { "AAPL", "SPY" });
firstTime = true;
}
Expand All @@ -1255,7 +1255,7 @@ public void AddsNewUniverse()
{
Assert.AreEqual(1, _dataQueueHandler.Subscriptions.Count(x => x.Value.Contains("TESTUNIVERSE")));
}
else if (_dataQueueHandler.Subscriptions.Count == 4)
else if (_dataQueueHandler.Subscriptions.Count == 3)
{
// Coarse universe isn't added to the data queue handler
Assert.AreNotEqual(1, _dataQueueHandler.Subscriptions.Count(x => x.Value.Contains("TESTUNIVERSE")));
Expand Down Expand Up @@ -1310,8 +1310,8 @@ public void AddsSubscription_SameUserUniverse()
{
Assert.IsTrue(ts.Slice.Keys.Contains(Symbols.SPY));
}
// SPY benchmark and the UserDefinedUniverse
Assert.AreEqual(2, _dataQueueHandler.Subscriptions.Count);
// SPY benchmark
Assert.AreEqual(1, _dataQueueHandler.Subscriptions.Count);

_algorithm.AddSecurities(equities: new List<string> { "AAPL" });
emittedData = true;
Expand All @@ -1322,8 +1322,8 @@ public void AddsSubscription_SameUserUniverse()
}
else
{
// SPY benchmark and the UserDefinedUniverse Equity, AAPL
if (_dataQueueHandler.Subscriptions.Count == 3) // there could be some slices with no data
// SPY benchmark and AAPL
if (_dataQueueHandler.Subscriptions.Count == 2) // there could be some slices with no data
{
Assert.IsTrue(_dataQueueHandler.Subscriptions.Contains(Symbols.SPY));
if (ts.Data.Count > 0)
Expand Down

0 comments on commit 2ff13ea

Please sign in to comment.