Skip to content

Commit

Permalink
Update secondsTimeStep value (#8528)
Browse files Browse the repository at this point in the history
  • Loading branch information
JosueNina authored Jan 14, 2025
1 parent 265fd8b commit 5accfd6
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions Tests/Engine/DataFeeds/LiveTradingDataFeedTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void EmitsStreamedDailyData(bool strictEndTimes)

var dqh = new TestDataQueueHandler
{
DataPerSymbol = new Dictionary<Symbol, List<BaseData>>
DataPerSymbol = new Dictionary<Symbol, List<BaseData>>
{
{
symbol, new List<BaseData> { new TradeBar(_algorithm.StartDate, symbol, 1, 5, 1, 3, 100, Time.OneDay) }
Expand Down Expand Up @@ -271,7 +271,8 @@ public void LiveChainSelection(SecurityType securityType, Resolution resolution,

// allow time for the exchange to pick up the selection point
Thread.Sleep(50);
ConsumeBridge(feed, TimeSpan.FromSeconds(5), true, ts => {
ConsumeBridge(feed, TimeSpan.FromSeconds(5), true, ts =>
{
if (selectionHappened == 2)
{
// we got what we wanted shortcut unit test
Expand Down Expand Up @@ -436,7 +437,7 @@ IEnumerable<Symbol> Filter(IEnumerable<Fundamental> fundamentals)
var dataPoint = fundamentals.Take(1);
selectionDataTime.Add(dataPoint.First().EndTime);
return dataPoint.Select(x => x.Symbol);
};
}

_algorithm.UniverseSettings.Resolution = Resolution.Daily;
var universe = _algorithm.AddUniverse(Filter);
Expand Down Expand Up @@ -493,7 +494,7 @@ IEnumerable<Symbol> CoarseFilter(IEnumerable<CoarseFundamental> coarse)
selectionTime = _algorithm.UtcTime;
selectedSymbols = coarse.Select(x => x.Symbol).ToList();
return selectedSymbols;
};
}

_algorithm.UniverseSettings.Resolution = Resolution.Daily;
var universe = _algorithm.AddUniverse(CoarseFilter);
Expand Down Expand Up @@ -930,7 +931,7 @@ public void FutureLiveHoldingsFutureMapping()
}
},
endDate: _startDate.AddDays(10),
secondsTimeStep: 60 * 60 * 24);
secondsTimeStep: 60 * 60 * 8);

Assert.IsTrue(assertedHoldings);
Assert.AreEqual(4, securityChanges);
Expand Down Expand Up @@ -1006,7 +1007,7 @@ public void WarmupFutureSelection(bool useWarmupResolution)
var countLive = 0;
ConsumeBridge(feed, TimeSpan.FromSeconds(5), true, ts =>
{
if(ts.UniverseData?.Count > 0)
if (ts.UniverseData?.Count > 0)
{
Assert.IsNotEmpty(ts.UniverseData.Select(x => x.Value.FilteredContracts));
if (_algorithm.IsWarmingUp)
Expand Down Expand Up @@ -1946,7 +1947,7 @@ public void DelistedEventEmitted()
{
foreach (var delisting in ts.Slice.Delistings)
{
if(delisting.Key != Symbols.SPY_C_192_Feb19_2016)
if (delisting.Key != Symbols.SPY_C_192_Feb19_2016)
{
throw new RegressionTestException($"Unexpected delisting for symbol {delisting.Key}");
}
Expand Down Expand Up @@ -2071,7 +2072,7 @@ public void CustomUniverseFineFundamentalDataGetsPipedCorrectly()
}, secondsTimeStep: 60 * 60,
alwaysInvoke: true,
sendUniverseData: true,
endDate:_startDate.AddDays(10));
endDate: _startDate.AddDays(10));

Assert.IsNotNull(securityChanges);
Assert.IsTrue(securityChanges.AddedSecurities.Single().Symbol.Value == "AAPL");
Expand Down Expand Up @@ -2212,7 +2213,7 @@ public void FineCoarseFundamentalDataGetsPipedCorrectly(int numberOfUniverses)
// we got what we wanted shortcut unit test
_manualTimeProvider.SetCurrentTimeUtc(Time.EndOfTime);
}
}, sendUniverseData: true, alwaysInvoke: true, secondsTimeStep: 3600, endDate: _startDate.AddDays(10));
}, sendUniverseData: true, alwaysInvoke: true, secondsTimeStep: 1200, endDate: _startDate.AddDays(10));

Assert.IsTrue(receivedFundamentalsData);
for (var i = 0; i < numberOfUniverses; i++)
Expand Down Expand Up @@ -2313,7 +2314,7 @@ public void ConstituentsUniverse()
_manualTimeProvider.SetCurrentTimeUtc(Time.EndOfTime);
}
}
}, secondsTimeStep: 60 * 60 * 3, // 3 hour time step
}, secondsTimeStep: 60 * 60,
alwaysInvoke: true,
endDate: endDate);

Expand All @@ -2330,7 +2331,8 @@ public void ThrowingDataQueueHandlerRuntimeError()

_algorithm.AddEquity("SPY");
_algorithm.OnEndOfTimeStep();
ConsumeBridge(feed, TimeSpan.FromSeconds(2), ts => {
ConsumeBridge(feed, TimeSpan.FromSeconds(2), ts =>
{
if (_algorithm.Status == AlgorithmStatus.RuntimeError)
{
_manualTimeProvider.SetCurrentTimeUtc(Time.EndOfTime);
Expand Down Expand Up @@ -2604,7 +2606,7 @@ public void LiveSplitHandling(bool warmup)
{
Assert.AreEqual(warmup, _algorithm.IsWarmingUp);

if(split.Type == SplitType.SplitOccurred)
if (split.Type == SplitType.SplitOccurred)
{
emittedSplit = true;
// we got what we wanted shortcut unit test
Expand Down Expand Up @@ -4114,7 +4116,7 @@ internal class TestableLiveTradingDataFeed : LiveTradingDataFeed
public TestableLiveTradingDataFeed(IAlgorithmSettings settings, IDataQueueHandler dataQueueHandler = null)
{
DataQueueHandler = dataQueueHandler;
TestDataQueueHandlerManager = new (new[] { DataQueueHandler }, settings);
TestDataQueueHandlerManager = new(new[] { DataQueueHandler }, settings);
}

protected override BaseDataExchange GetBaseDataExchange()
Expand Down

0 comments on commit 5accfd6

Please sign in to comment.