Skip to content

Commit

Permalink
Merge pull request QuantConnect#4429 from simonsonjack/update-AlphaSt…
Browse files Browse the repository at this point in the history
…reamsSlippageModel

Updated AlphaStreamsSlippageModel
  • Loading branch information
Martin-Molinero authored May 20, 2020
2 parents 3ca41c4 + 9f53e65 commit 770f8b5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 40 deletions.
18 changes: 1 addition & 17 deletions Common/Orders/Slippage/AlphaStreamsSlippageModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ public class AlphaStreamsSlippageModel : ISlippageModel
{
private const decimal _slippagePercent = 0.0001m;

/// <summary>
/// Unfortunate dictionary of ETFs and their spread on 10/10 so that we can better approximate
/// slippage for the competition
/// </summary>
private readonly IDictionary<string, decimal> _spreads = new Dictionary<string, decimal>
{
{"PPLT", 0.13m}, {"DGAZ", 0.135m}, {"EDV", 0.085m}, {"SOXL", 0.1m}
};

/// <summary>
/// Initializes a new instance of the <see cref="AlphaStreamsSlippageModel"/> class
/// </summary>
Expand All @@ -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;
}
}
}
23 changes: 0 additions & 23 deletions Tests/Common/Orders/Slippage/SlippageModelsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down

0 comments on commit 770f8b5

Please sign in to comment.