Files
quantconnect--lean/Algorithm
Martin-Molinero 62d63010ab
Python Virtual Environments / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Convert daily resolution market orders to MarketOnClose/MarketOnOpen (#9534)
* Convert daily resolution market orders to MarketOnClose/MarketOnOpen

A market order placed intraday (e.g. through a scheduled event) on an
asset subscribed only at daily resolution has no fresh intraday price to
fill against, so it was filling at the stale previous daily close. This
is common when mixing daily resolution assets with minute resolution
assets or intraday scheduled events.

QCAlgorithm.MarketOrder now converts these orders so they fill at a real
daily open/close instead of the stale previous close:
 - market closed (any resolution): MarketOnOpen, as before
 - market open, daily-only subscription: MarketOnClose (today's close),
   or MarketOnOpen (next open) when already within the MarketOnClose
   submission buffer near the close

Assets with intraday data are left untouched, and the conversion is only
applied in backtesting; in live trading an open-market market order fills
at the real current price.

Adds DailyResolutionMarketOrderConversionRegressionAlgorithm covering the
MarketOnClose and MarketOnOpen conversion paths plus a minute resolution
asset that is correctly left as a regular market order.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Minor fix

* Reword conversion warning: "current market price" instead of "real current price"

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Update regression stats affected by daily market order conversion

Daily-resolution market orders placed intraday are now converted to
MarketOnClose/MarketOnOpen so they fill at a real daily open/close
instead of the stale previous close. This shifts the affected fills:

 - IndexOptionCall{ITM,OTM}ExpiryDaily: the SPX option entry, placed one
   minute after the open, now fills at the daily close. Same economics,
   one extra data point and a new order list hash.
 - AllShortableSymbols (C# + Python): an intraday order's type changed
   from Market to a converted order; identical End Equity, new hash.
 - ResolutionSwitchingAlgorithm sampling test: the RemoveSecurity
   liquidation (fired at 15:50) previously filled at the stale previous
   close; it now converts, shifting the equity/performance samples.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Revert expected data point count change

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 13:08:57 -03:00
..