From ac4d1107d9a0a5780c80736942420ce9e1110ea0 Mon Sep 17 00:00:00 2001 From: Jack Simonson Date: Mon, 18 May 2020 09:46:59 -0700 Subject: [PATCH 1/2] Updated AlphaStreamsSlippageModel --- .../Slippage/AlphaStreamsSlippageModel.cs | 20 ++------------- .../Orders/Slippage/SlippageModelsTests.cs | 25 +------------------ 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/Common/Orders/Slippage/AlphaStreamsSlippageModel.cs b/Common/Orders/Slippage/AlphaStreamsSlippageModel.cs index 2058a9f8dcf5..df9219989da8 100644 --- a/Common/Orders/Slippage/AlphaStreamsSlippageModel.cs +++ b/Common/Orders/Slippage/AlphaStreamsSlippageModel.cs @@ -23,16 +23,7 @@ namespace QuantConnect.Orders.Slippage /// public class AlphaStreamsSlippageModel : ISlippageModel { - private const decimal _slippagePercent = 0.0001m; - - /// - /// Unfortunate dictionary of ETFs and their spread on 10/10 so that we can better approximate - /// slippage for the competition - /// - private readonly IDictionary _spreads = new Dictionary - { - {"PPLT", 0.13m}, {"DGAZ", 0.135m}, {"EDV", 0.085m}, {"SOXL", 0.1m} - }; + private const decimal _slippagePercent = 0; /// /// Initializes a new instance of the class @@ -49,14 +40,7 @@ public decimal GetSlippageApproximation(Security asset, Order order) return 0; } - decimal slippageValue; - - if (!_spreads.TryGetValue(asset.Symbol.Value, out slippageValue)) - { - return _slippagePercent * asset.GetLastData()?.Value ?? 0; - } - - return slippageValue; + return _slippagePercent * asset.GetLastData()?.Value ?? 0; } } } \ No newline at end of file diff --git a/Tests/Common/Orders/Slippage/SlippageModelsTests.cs b/Tests/Common/Orders/Slippage/SlippageModelsTests.cs index 0ad292e60b78..d882d72d4b78 100644 --- a/Tests/Common/Orders/Slippage/SlippageModelsTests.cs +++ b/Tests/Common/Orders/Slippage/SlippageModelsTests.cs @@ -142,7 +142,7 @@ public void VolumeShareSlippageModel_ForexTest() [Test] public void AlphaStreamsSlippageModel_EquityTest() { - decimal slippagePercent = 0.0001m; + decimal slippagePercent = 0; var model = new AlphaStreamsSlippageModel(); @@ -151,29 +151,6 @@ public void AlphaStreamsSlippageModel_EquityTest() Assert.AreEqual(expected, actual); } - [Test] - public void AlphaStreamsSlippageModel_HardCodedEquityTest() - { - Symbol symbol = Symbol.Create("DGAZ", SecurityType.Equity, Market.USA); - Equity equity = new Equity( - symbol, - SecurityExchangeHours.AlwaysOpen(TimeZones.NewYork), - new Cash(Currencies.USD, 0, 1m), - SymbolProperties.GetDefault(Currencies.USD), - ErrorCurrencyConverter.Instance, - RegisteredSecurityDataTypesProvider.Null, - new SecurityCache() - ); - - equity.SetMarketPrice(new TradeBar(DateTime.Now, Symbols.SPY, 100m, 100m, 100m, 100m, 1)); - Order equityBuyOrder = new MarketOrder(symbol, 1, DateTime.Now); - - var model = new AlphaStreamsSlippageModel(); - - var actual = model.GetSlippageApproximation(equity, equityBuyOrder); - Assert.AreEqual(0.135m, actual); - } - [Test] public void AlphaStreamsSlippageModel_ForexTest() { From 9f53e65472a3e961a766a1019592b89996e19ebe Mon Sep 17 00:00:00 2001 From: Jack Simonson Date: Mon, 18 May 2020 15:50:12 -0700 Subject: [PATCH 2/2] Reinstate slippage --- Common/Orders/Slippage/AlphaStreamsSlippageModel.cs | 2 +- Tests/Common/Orders/Slippage/SlippageModelsTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Common/Orders/Slippage/AlphaStreamsSlippageModel.cs b/Common/Orders/Slippage/AlphaStreamsSlippageModel.cs index df9219989da8..5158247cee7e 100644 --- a/Common/Orders/Slippage/AlphaStreamsSlippageModel.cs +++ b/Common/Orders/Slippage/AlphaStreamsSlippageModel.cs @@ -23,7 +23,7 @@ namespace QuantConnect.Orders.Slippage /// public class AlphaStreamsSlippageModel : ISlippageModel { - private const decimal _slippagePercent = 0; + private const decimal _slippagePercent = 0.0001m; /// /// Initializes a new instance of the class diff --git a/Tests/Common/Orders/Slippage/SlippageModelsTests.cs b/Tests/Common/Orders/Slippage/SlippageModelsTests.cs index d882d72d4b78..6af4eedee085 100644 --- a/Tests/Common/Orders/Slippage/SlippageModelsTests.cs +++ b/Tests/Common/Orders/Slippage/SlippageModelsTests.cs @@ -142,7 +142,7 @@ public void VolumeShareSlippageModel_ForexTest() [Test] public void AlphaStreamsSlippageModel_EquityTest() { - decimal slippagePercent = 0; + decimal slippagePercent = 0.0001m; var model = new AlphaStreamsSlippageModel();