Skip to content

Fix MOO slippage reference price - #9763

Open
matvt-cell wants to merge 1 commit into
QuantConnect:masterfrom
matvt-cell:bug-9753-daily-moo-slippage
Open

Fix MOO slippage reference price#9763
matvt-cell wants to merge 1 commit into
QuantConnect:masterfrom
matvt-cell:bug-9753-daily-moo-slippage

Conversation

@matvt-cell

Copy link
Copy Markdown

Description

Fixes #9753.

Daily MarketOnOpen fills use the bar's Open as the execution price, but ConstantSlippageModel previously calculated percentage slippage from the latest data value. For a daily TradeBar, that value is the same-day Close, introducing look-ahead bias into the MOO fill price.

This change:

  • adds a backwards-compatible ISlippageModel overload that accepts an explicit reference price
  • updates ConstantSlippageModel to calculate percentage slippage from that reference price
  • updates EquityFillModel.MarketOnOpenFill to pass the selected pre-slippage execution price
  • preserves existing two-argument ISlippageModel implementations through the default interface implementation

Tests

Added a regression test covering both buy and sell daily MOO orders and verifying that changing only the fill-day Close does not change the fill price.

Verification:

  • regression test fails on the previous implementation and passes with the fix
  • EquityFillModelTests: 126 passed
  • SlippageModelsTests: 7 passed
  • backwards-compatibility test for legacy two-argument ISlippageModel implementations passes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daily MarketOnOpen fills with ConstantSlippageModel use same-day Close for slippage, causing look-ahead bias

2 participants