Fee models get the order, not the fill, so fees based on trade value use an estimate

Đang mở
#10,140 2 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

Chưa có ai nhận issue này.

Đá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
22/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, python
Lĩnh vực
backend

Hướng nghiên cứu

Start with OrderFeeParameters and the fee model call in BacktestingBrokerage, where fill.OrderFee is set after the fill but the fee model still receives the original order. The fix changes the fee-model interface across all fee models, including Python and brokerage plugins, so it needs design agreement first. Done means fee models see the fill's price and quantity while pre-trade buying power checks still use the order, with the reproduction case charging $1.00.

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

Mô tả

Expected Behavior

A fee model that charges on trade value, such as InteractiveBrokersFeeModel's 1% maximum per order, charges a fill on that fill's price and quantity.

Actual Behavior

OrderFeeParameters only carries the Security and the Order. BacktestingBrokerage sets fill.OrderFee after the fill, but it passes the fee model the original order and not the fill. So fee models estimate the trade value from the order's prices or the security's current price.

Once #10129 is merged, US equity orders under $100 pay 1% of trade value, so the estimate shows in the fee. For example, take a one-share buy stop at $100 when the next minute bar is 90/110/90/90 (open/high/low/close). It fills at $100 and should cost $1.00, but it's charged $0.90.

Potential Solution

Pass the fill (price and quantity) to the fee model when charging a fill, for example as an optional fill on OrderFeeParameters. Pre-trade fee estimates, such as buying power checks, keep using the order. This affects every fee model, including Python models and models in the brokerage plugins.

Reproducing the Problem

With #10129: EquityFillModel fills the stop above at $100, and InteractiveBrokersFeeModel charges $0.90.

System Information

master, .NET 10.

Ngôn ngữ chính
C#
Star
22.6k
Fork
5.4k
Merge trung bình
11 giờ 39 phút
Pull request đã merge (30 ngày)
104

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.