Skip to content

Commit

Permalink
Rename RegressionTestException for TestException
Browse files Browse the repository at this point in the history
  • Loading branch information
Marinovsky committed Jun 13, 2024
1 parent 57b8870 commit e4f068f
Show file tree
Hide file tree
Showing 396 changed files with 1,507 additions and 1,507 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public override void OnEndOfAlgorithm()
||
Portfolio.TotalHoldingsValue < Portfolio.TotalPortfolioValue * 0.01m)
{
throw new RegressionTestException($"Unexpected Total Holdings Value: {Portfolio.TotalHoldingsValue}");
throw new TestException($"Unexpected Total Holdings Value: {Portfolio.TotalHoldingsValue}");
}
}

Expand Down
2 changes: 1 addition & 1 deletion Algorithm.CSharp/AddAlphaModelAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void OnInsightsGeneratedVerifier(IAlgorithm algorithm,
|| insightsCollection.Insights.Count(insight => insight.Symbol == _spy) != 1
|| insightsCollection.Insights.Count(insight => insight.Symbol == _ibm) != 1)
{
throw new RegressionTestException("Unexpected insights were emitted");
throw new TestException("Unexpected insights were emitted");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public override void OnData(Slice slice)
}
else
{
throw new RegressionTestException("Expect a single call to OnData where we removed the option and underlying");
throw new TestException("Expect a single call to OnData where we removed the option and underlying");
}
}
}
Expand All @@ -68,7 +68,7 @@ public override void OnEndOfAlgorithm()
{
if (!_hasRemoved)
{
throw new RegressionTestException("Expect a single call to OnData where we removed the option and underlying");
throw new TestException("Expect a single call to OnData where we removed the option and underlying");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public override void OnData(Slice slice)
{
if (_hasRemoved)
{
throw new RegressionTestException("Expect a single call to OnData where we removed the option and underlying");
throw new TestException("Expect a single call to OnData where we removed the option and underlying");
}

_hasRemoved = true;
Expand All @@ -65,7 +65,7 @@ public override void OnEndOfAlgorithm()
{
if (!_hasRemoved)
{
throw new RegressionTestException("We did not remove the option contract!");
throw new TestException("We did not remove the option contract!");
}
}

Expand Down
4 changes: 2 additions & 2 deletions Algorithm.CSharp/AddBetaIndicatorRegressionAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public override void Initialize()

if (!_beta.IsReady)
{
throw new RegressionTestException("_beta indicator was expected to be ready");
throw new TestException("_beta indicator was expected to be ready");
}
}

Expand All @@ -63,7 +63,7 @@ public override void OnData(Slice data)

if (_beta.Current.Value < 0m || _beta.Current.Value > 2.80m)
{
throw new RegressionTestException($"_beta value was expected to be between 0 and 2.80 but was {_beta.Current.Value}");
throw new TestException($"_beta value was expected to be between 0 and 2.80 but was {_beta.Current.Value}");
}

Log($"Beta between IBM and SPY is: {_beta.Current.Value}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ public override void OnData(Slice data)
{
if (_ended)
{
throw new RegressionTestException($"Algorithm should of ended!");
throw new TestException($"Algorithm should of ended!");
}
if (data.Keys.Count > 2)
{
throw new RegressionTestException($"Getting data for more than 2 symbols! {string.Join(",", data.Keys.Select(symbol => symbol))}");
throw new TestException($"Getting data for more than 2 symbols! {string.Join(",", data.Keys.Select(symbol => symbol))}");
}
if (UniverseManager.Count != 3)
{
throw new RegressionTestException($"Expecting 3 universes (chain, continuous and user defined) but have {UniverseManager.Count}");
throw new TestException($"Expecting 3 universes (chain, continuous and user defined) but have {UniverseManager.Count}");
}

if (!Portfolio.Invested)
Expand Down Expand Up @@ -99,7 +99,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes)
if (changes.AddedSecurities.Any(security => security.Symbol != _continuousContract.Symbol && security.Symbol != _futureContract.Symbol)
|| changes.RemovedSecurities.Any(security => security.Symbol != _continuousContract.Symbol && security.Symbol != _futureContract.Symbol))
{
throw new RegressionTestException($"We got an unexpected security changes {changes}");
throw new TestException($"We got an unexpected security changes {changes}");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public override void OnEndOfAlgorithm()

if (!_onDataReached)
{
throw new RegressionTestException("OnData() was never called.");
throw new TestException("OnData() was never called.");
}
if (_symbolsReceived.Count != _expectedSymbolsReceived.Count)
{
Expand All @@ -132,7 +132,7 @@ public override void OnEndOfAlgorithm()

if (missingSymbols.Count > 0)
{
throw new RegressionTestException($"Symbols: \"{string.Join(", ", missingSymbols)}\" were not found in OnData");
throw new TestException($"Symbols: \"{string.Join(", ", missingSymbols)}\" were not found in OnData");
}

foreach (var expectedSymbol in _expectedSymbolsReceived)
Expand All @@ -146,7 +146,7 @@ public override void OnEndOfAlgorithm()

if (nonDupeDataCount < 1000)
{
throw new RegressionTestException($"Received too few data points. Expected >=1000, found {nonDupeDataCount} for {expectedSymbol}");
throw new TestException($"Received too few data points. Expected >=1000, found {nonDupeDataCount} for {expectedSymbol}");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,16 @@ public override void OnData(Slice data)
|| marginModel.MaintenanceIntradayMarginRequirement == 0
|| marginModel.MaintenanceOvernightMarginRequirement == 0)
{
throw new RegressionTestException("Unexpected margin requirements");
throw new TestException("Unexpected margin requirements");
}

if (marginModel.GetInitialMarginRequirement(optionContract, 1) == 0)
{
throw new RegressionTestException("Unexpected Initial Margin requirement");
throw new TestException("Unexpected Initial Margin requirement");
}
if (marginModel.GetMaintenanceMargin(optionContract) != 0)
{
throw new RegressionTestException("Unexpected Maintenance Margin requirement");
throw new TestException("Unexpected Maintenance Margin requirement");
}

MarketOrder(option, 1);
Expand All @@ -149,7 +149,7 @@ public override void OnData(Slice data)

if (marginModel.GetMaintenanceMargin(optionContract) == 0)
{
throw new RegressionTestException("Unexpected Maintenance Margin requirement");
throw new TestException("Unexpected Maintenance Margin requirement");
}
}
if (!futureInvested && data.ContainsKey(future))
Expand All @@ -170,7 +170,7 @@ public override void OnEndOfAlgorithm()
}
if (!_onDataReached)
{
throw new RegressionTestException("OnData() was never called.");
throw new TestException("OnData() was never called.");
}
if (_symbolsReceived.Count != _expectedSymbolsReceived.Count)
{
Expand All @@ -188,7 +188,7 @@ public override void OnEndOfAlgorithm()

if (missingSymbols.Count > 0)
{
throw new RegressionTestException($"Symbols: \"{string.Join(", ", missingSymbols)}\" were not found in OnData");
throw new TestException($"Symbols: \"{string.Join(", ", missingSymbols)}\" were not found in OnData");
}

foreach (var expectedSymbol in _expectedSymbolsReceived)
Expand All @@ -202,7 +202,7 @@ public override void OnEndOfAlgorithm()

if (nonDupeDataCount < 1000)
{
throw new RegressionTestException($"Received too few data points. Expected >=1000, found {nonDupeDataCount} for {expectedSymbol}");
throw new TestException($"Received too few data points. Expected >=1000, found {nonDupeDataCount} for {expectedSymbol}");
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions Algorithm.CSharp/AddOptionContractExpiresRegressionAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ public override void OnData(Slice data)

if (!config.Any())
{
throw new RegressionTestException($"Was expecting configurations for {symbol}");
throw new TestException($"Was expecting configurations for {symbol}");
}
if (config.Any(dataConfig => dataConfig.DataNormalizationMode != DataNormalizationMode.Raw))
{
throw new RegressionTestException($"Was expecting DataNormalizationMode.Raw configurations for {symbol}");
throw new TestException($"Was expecting DataNormalizationMode.Raw configurations for {symbol}");
}
}
}
Expand All @@ -81,14 +81,14 @@ public override void OnData(Slice data)
{
if (SubscriptionManager.SubscriptionDataConfigService.GetSubscriptionDataConfigs(_option).Any())
{
throw new RegressionTestException($"Unexpected configurations for {_option} after it has been delisted");
throw new TestException($"Unexpected configurations for {_option} after it has been delisted");
}

if (Securities[_twx].Invested)
{
if (!SubscriptionManager.SubscriptionDataConfigService.GetSubscriptionDataConfigs(_twx).Any())
{
throw new RegressionTestException($"Was expecting configurations for {_twx}");
throw new TestException($"Was expecting configurations for {_twx}");
}

// first we liquidate the option exercised position
Expand All @@ -99,7 +99,7 @@ public override void OnData(Slice data)
{
if (SubscriptionManager.SubscriptionDataConfigService.GetSubscriptionDataConfigs(_twx).Any())
{
throw new RegressionTestException($"Unexpected configurations for {_twx} after it has been liquidated");
throw new TestException($"Unexpected configurations for {_twx} after it has been liquidated");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public override void OnData(Slice data)
// assert underlying still there after the universe selection removed it, still used by the manually added option contract
if (!configs.Any())
{
throw new RegressionTestException($"Was expecting configurations for {_twx}" +
throw new TestException($"Was expecting configurations for {_twx}" +
$" even after it has been deselected from coarse universe because we still have the option contract.");
}
}
Expand All @@ -83,7 +83,7 @@ public override void OnData(Slice data)
var configs = SubscriptionManager.SubscriptionDataConfigService.GetSubscriptionDataConfigs(symbol);
if (configs.Any())
{
throw new RegressionTestException($"Unexpected configuration for {symbol} after it has been deselected from coarse universe and option contract is removed.");
throw new TestException($"Unexpected configuration for {symbol} after it has been deselected from coarse universe and option contract is removed.");
}
}
}
Expand All @@ -94,11 +94,11 @@ public override void OnSecuritiesChanged(SecurityChanges changes)
{
if (_securityChanges.RemovedSecurities.Intersect(changes.RemovedSecurities).Any())
{
throw new RegressionTestException($"SecurityChanges.RemovedSecurities intersect {changes.RemovedSecurities}. We expect no duplicate!");
throw new TestException($"SecurityChanges.RemovedSecurities intersect {changes.RemovedSecurities}. We expect no duplicate!");
}
if (_securityChanges.AddedSecurities.Intersect(changes.AddedSecurities).Any())
{
throw new RegressionTestException($"SecurityChanges.AddedSecurities intersect {changes.RemovedSecurities}. We expect no duplicate!");
throw new TestException($"SecurityChanges.AddedSecurities intersect {changes.RemovedSecurities}. We expect no duplicate!");
}
// keep track of all removed and added securities
_securityChanges += changes;
Expand All @@ -123,11 +123,11 @@ public override void OnSecuritiesChanged(SecurityChanges changes)

if (!config.Any())
{
throw new RegressionTestException($"Was expecting configurations for {symbol}");
throw new TestException($"Was expecting configurations for {symbol}");
}
if (config.Any(dataConfig => dataConfig.DataNormalizationMode != DataNormalizationMode.Raw))
{
throw new RegressionTestException($"Was expecting DataNormalizationMode.Raw configurations for {symbol}");
throw new TestException($"Was expecting DataNormalizationMode.Raw configurations for {symbol}");
}
}

Expand All @@ -143,16 +143,16 @@ public override void OnEndOfAlgorithm()
{
if (SubscriptionManager.Subscriptions.Any(dataConfig => dataConfig.Symbol == _twx || dataConfig.Symbol.Underlying == _twx))
{
throw new RegressionTestException($"Was NOT expecting any configurations for {_twx} or it's options, since we removed the contract");
throw new TestException($"Was NOT expecting any configurations for {_twx} or it's options, since we removed the contract");
}

if (SubscriptionManager.Subscriptions.All(dataConfig => dataConfig.Symbol != _aapl))
{
throw new RegressionTestException($"Was expecting configurations for {_aapl}");
throw new TestException($"Was expecting configurations for {_aapl}");
}
if (SubscriptionManager.Subscriptions.All(dataConfig => dataConfig.Symbol.Underlying != _aapl))
{
throw new RegressionTestException($"Was expecting options configurations for {_aapl}");
throw new TestException($"Was expecting options configurations for {_aapl}");
}
}

Expand Down
6 changes: 3 additions & 3 deletions Algorithm.CSharp/AddOptionContractTwiceRegressionAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public override void OnData(Slice slice)
{
if (!_reAdded && slice.ContainsKey(_contract) && slice.ContainsKey(_contract.Underlying))
{
throw new RegressionTestException("Getting data for removed option and underlying!");
throw new TestException("Getting data for removed option and underlying!");
}

if (!Portfolio.Invested && _reAdded)
Expand Down Expand Up @@ -95,11 +95,11 @@ public override void OnEndOfAlgorithm()
{
if (!_hasRemoved)
{
throw new RegressionTestException("We did not remove the option contract!");
throw new TestException("We did not remove the option contract!");
}
if (!_reAdded)
{
throw new RegressionTestException("We did not re add the option contract!");
throw new TestException("We did not re add the option contract!");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public override void OnSecuritiesChanged(SecurityChanges changes)

if (!allOptionsWereChangedOnMarketOpen)
{
throw new RegressionTestException("Expected options filter to be run only on market open");
throw new TestException("Expected options filter to be run only on market open");
}
}

Expand Down
Loading

0 comments on commit e4f068f

Please sign in to comment.