AM settlement timestamp is skipped for Wednesday VIX and legacy Saturday SPX expirations

Đang mở
#10,117 0 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á

Issue này chưa được đánh giá.

Mô tả

priority:P1
Observed behavior

OptionSymbol.GetSettlementDateTime skips its AM-settlement adjustment for recognized AM-settled contracts when the nominal date is not in the generic third-Friday window, or when it resolves to a different trading date.

Reproduced on master (7939b7878) with the bundled database:

Root / nominal expiry IndexOptionSymbol.IsAMSettled OptionSymbol.IsStandard Returned settlement (America/Chicago)
VIX / 2016-02-17 true false 2016-02-17 15:15
SPX / 2014-06-21 true true 2014-06-20 15:15

Both remain afternoon values rather than the AM settlement time described by the helper's own contract. For the legacy Saturday SPX contract, GetLastDayOfTrading correctly resolves Friday 2014-06-20, but the settlement branch then rejects that date because it differs from the nominal Saturday expiry.

Minimal reproduction:

foreach (var c in new[] {
    ("VIX", new DateTime(2016, 2, 17)),
    ("SPX", new DateTime(2014, 6, 21)) })
{
    var underlying = Symbol.Create(c.Item1, SecurityType.Index, Market.USA);
    var option = Symbol.CreateOption(underlying, c.Item1, Market.USA,
        OptionStyle.European, OptionRight.Call, 200m, c.Item2);
    Console.WriteLine($"{option}: AM={IndexOptionSymbol.IsAMSettled(option)}, standard={OptionSymbol.IsStandard(option)}, settlement={OptionSymbol.GetSettlementDateTime(option):yyyy-MM-dd HH:mm}");
}
Cause and required result

The AM branch in Common/Securities/Option/OptionSymbol.cs requires both IsStandard(symbol) and expiryTime.Date == symbol.ID.Date.Date in addition to the explicit AM-settlement classification. A Wednesday VIX expiry fails the former; the legacy Saturday SPX expiry fails the latter. OptionIndicatorBase.Expiry consequently overstates the remaining time for the Greeks/IV indicators.

Use the contract's AM-settlement classification and appropriate settlement date without requiring every such contract to have a third-Friday nominal expiry. Include Wednesday VIX and pre-2015 Saturday SPX cases alongside the existing SPX tests.

This concerns the timestamp used by indicators, not the exercise-price issue in #7728. It predates #10114, whose change leaves the AM branch untouched.

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.