Skip to content

Commit 6b00a97

Browse files
Address review
1 parent 7cd1c18 commit 6b00a97

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

Algorithm.CSharp/CustomUniverseWithBenchmarkRegressionAlgorithm.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ public override void Initialize()
6060

6161
// internal daily resolution
6262
SetBenchmark("SPY");
63+
64+
Symbol symbol;
65+
if (!SymbolCache.TryGetSymbol("SPY", out symbol)
66+
|| !ReferenceEquals(_spy, symbol))
67+
{
68+
throw new Exception("We expected 'SPY' to be added to the Symbol cache," +
69+
" since the algorithm is also using it");
70+
}
6371
}
6472

6573
/// <summary>

Algorithm.Python/CustomBenchmarkAlgorithm.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,8 @@ def OnData(self, data):
4242
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.'''
4343
if not self.Portfolio.Invested:
4444
self.SetHoldings("SPY", 1)
45-
self.Debug("Purchased Stock")
45+
self.Debug("Purchased Stock")
46+
47+
tupleResult = SymbolCache.TryGetSymbol("AAPL", None)
48+
if tupleResult[0]:
49+
raise Exception("Benchmark Symbol is not expected to be added to the Symbol cache")

0 commit comments

Comments
 (0)