Skip to content

Commit 9651df9

Browse files
Updating the ScheduledEventBenchmark
- Renaming files from `Schedule...` to `Scheduled...` to match algorithm name. - Removed `ScheduledEvents` set every 5 seconds - Increased the every day `ScheduledEvents` from 200 to 600
1 parent 29622d1 commit 9651df9

4 files changed

Lines changed: 10 additions & 14 deletions

File tree

Algorithm.CSharp/Benchmarks/ScheduleEventsBenchmark.cs renamed to Algorithm.CSharp/Benchmarks/ScheduledEventsBenchmark.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
using System;
1817
using System.Linq;
1918
using QuantConnect.Data;
2019

@@ -27,13 +26,12 @@ public override void Initialize()
2726
SetStartDate(2011, 1, 1);
2827
SetEndDate(2018, 1, 1);
2928
SetCash(100000);
30-
AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute);
31-
foreach (int period in Enumerable.Range(0, 100))
29+
AddEquity("SPY");
30+
foreach (int period in Enumerable.Range(0, 300))
3231
{
3332
Schedule.On(DateRules.EveryDay("SPY"), TimeRules.AfterMarketOpen("SPY", period), Rebalance);
3433
Schedule.On(DateRules.EveryDay("SPY"), TimeRules.BeforeMarketClose("SPY", period), Rebalance);
3534
}
36-
Schedule.On(DateRules.EveryDay(), TimeRules.Every(TimeSpan.FromSeconds(5)), Rebalance);
3735
}
3836

3937
public override void OnData(Slice data) { }

Algorithm.CSharp/QuantConnect.Algorithm.CSharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@
259259
<Compile Include="OptionChainProviderAlgorithm.cs" />
260260
<Compile Include="ConstituentsQC500GeneratorAlgorithm.cs" />
261261
<Compile Include="CustomDataIndicatorExtensionsAlgorithm.cs" />
262-
<Compile Include="Benchmarks\ScheduleEventsBenchmark.cs" />
262+
<Compile Include="Benchmarks\ScheduledEventsBenchmark.cs" />
263263
<Compile Include="Benchmarks\HistoryRequestBenchmark.cs" />
264264
<Compile Include="Benchmarks\CoarseFineUniverseSelectionBenchmark.cs" />
265265
<Compile Include="Benchmarks\IndicatorRibbonBenchmark.cs" />

Algorithm.Python/Benchmarks/ScheduleEventsBenchmark.py renamed to Algorithm.Python/Benchmarks/ScheduledEventsBenchmark.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,15 @@ class ScheduledEventsBenchmark(QCAlgorithm):
2626

2727
def Initialize(self):
2828

29-
self.SetStartDate(2011, 1, 1)
30-
self.SetEndDate(2018, 1, 1)
31-
self.SetCash(100000)
32-
self.AddEquity("SPY", Resolution.Minute)
29+
self.SetStartDate(2011, 1, 1)
30+
self.SetEndDate(2018, 1, 1)
31+
self.SetCash(100000)
32+
self.AddEquity("SPY")
3333

34-
for i in range(100):
34+
for i in range(300):
3535
self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.AfterMarketOpen("SPY", i), self.Rebalance)
3636
self.Schedule.On(self.DateRules.EveryDay("SPY"), self.TimeRules.BeforeMarketClose("SPY", i), self.Rebalance)
3737

38-
self.Schedule.On(self.DateRules.EveryDay(), self.TimeRules.Every(timedelta(seconds=5)), self.Rebalance)
39-
4038
def OnData(self, data):
4139
pass
4240

Algorithm.Python/QuantConnect.Algorithm.Python.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
44
<PropertyGroup>
@@ -161,7 +161,7 @@
161161
<None Include="Benchmarks\HistoryRequestBenchmark.py" />
162162
<None Include="Benchmarks\CoarseFineUniverseSelectionBenchmark.py" />
163163
<None Include="Benchmarks\IndicatorRibbonBenchmark.py" />
164-
<None Include="Benchmarks\ScheduleEventsBenchmark.py" />
164+
<None Include="Benchmarks\ScheduledEventsBenchmark.py" />
165165
</ItemGroup>
166166
<ItemGroup>
167167
<ProjectReference Include="..\Algorithm\QuantConnect.Algorithm.csproj">

0 commit comments

Comments
 (0)