MarketOnClose fills are not capped by volume: an order larger than the closing volume fills in full at the close

Đang mở
#9,972 6 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@kavindon2007 đang làm issue này rồi.

Từ ngày 28/10/2026.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
43/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
backend, fintech-quant

Hướng nghiên cứu

Start by reading EquityFillModel.MarketOnCloseFill and the HourlyDelistingLiquidationAtMarketCloseRegressionAlgorithm example from #9932. Compare the fill quantity with the available closing tick or bar volume, including the case where the last bar is stale; inspect BacktestingBrokerage.HandleDelistingNotification for the midnight fallback. Done means the issue's volume behavior is addressed or documented consistently, while preserving any intended opt-in behavior.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Expected Behavior

A backtest MarketOnClose order for more shares than traded around the close should not be assumed to fill in full at the closing price, or there should be an opt-in way to cap it. For example, a fill model could limit the fill to a share of the closing auction or last bar volume, and leave the rest unfilled or partially filled.

Actual Behavior

EquityFillModel.MarketOnCloseFill fills the whole order quantity once the local time reaches the next market close. It uses the official close tick, or the last trade bar close, and applies the slippage model only to the price. Nothing caps the quantity by volume, and the last known bar can be stale.

Example from the local data: the GDVD hourly regression (HourlyDelistingLiquidationAtMarketCloseRegressionAlgorithm, from #9932) holds 1555 shares through the 2021-01-20 delisting. The last bar before the close is 2021-01-19 15:00 with a volume of 100, and there are no bars on 2021-01-20. The MarketOnClose liquidation still fills all 1555 shares at 2021-01-20 16:00, at 31.905.

This applies to every MarketOnClose order, not just delisting liquidations. On master the delisting fallback (BacktestingBrokerage.HandleDelistingNotification) also fills the full holding at midnight.

Potential Solution
  • An opt-in volume limit for MarketOnClose (and MarketOnOpen) fills in EquityFillModel, based on the volume of the closing bar or tick. It could be a parameter or a separate fill model, so existing results don't change.
  • Or document that close and open auction fills are not volume constrained, and that price impact is modeled only through the slippage model, e.g. VolumeShareSlippageModel.
Checklist
  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
Ngôn ngữ chính
C#
Star
22.5k
Fork
5.4k
Merge trung bình
22 giờ 6 phút
Pull request đã merge (30 ngày)
81

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của QuantConnect/Lean

Tất cả issue của QuantConnect/Lean

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.