RelativeDailyVolume returns zero after the final historical time slot

Đang mở Phù hợp với người mới
#10,198 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á

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
data, testing

Hướng nghiên cứu

Đọc Indicators/RelativeDailyVolume.cs quanh các dòng 111–138 và theo dõi cách chỉ báo chọn khối lượng tích lũy trong lịch sử cho thời điểm được yêu cầu. Tìm các bài kiểm thử RelativeDailyVolume hiện có và thêm một trường hợp trong đó thời điểm hiện tại nằm sau khung thời gian cuối cùng trong dữ liệu lịch sử; xác minh kết quả sử dụng khối lượng tích lũy mới nhất hiện có và giữ nguyên cách xử lý khoảng trống bên trong được đề cập trong #9629.

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

Mô tả

priority:p2

Problem

When the current time-of-day is later than every historical time slot, RelativeDailyVolume leaves its fallback denominator at zero and returns zero despite having a nonzero historical cumulative volume.

Source: Indicators/RelativeDailyVolume.cs, lines 111–138.

This is a boundary case distinct from #9629: the existing break fixes selection between historical slots, but no loop iteration assigns a denominator after the final slot. A historical early close followed by a longer trading session can reach this path.

Reproduction

using System;
using QuantConnect;
using QuantConnect.Data.Market;
using QuantConnect.Indicators;

var symbol = new Symbol(SecurityIdentifier.GenerateEquity("SPY", Market.USA, false), "SPY");
var start = new DateTime(2024, 1, 2, 9, 30, 0);
TradeBar Bar(DateTime time, decimal volume) =>
    new TradeBar(time, symbol, 9, 10, 9, 10, volume, TimeSpan.FromMinutes(1));
var rdv = new RelativeDailyVolume(1);
rdv.Update(Bar(start, 100));
rdv.Update(Bar(start.AddMinutes(1), 100));
rdv.Update(Bar(start.AddDays(1).AddMinutes(2), 50));
Console.WriteLine($"{rdv.IsReady}: {rdv.Current.Value}");

Executed result: True: 0. Expected: True: 0.25.

The completed historical day has cumulative volumes 100 at 09:30 and 200 at 09:31. At 09:32, the latest historical cumulative volume is still 200, so the ratio is 50 / 200 = 0.25. No historical key is greater than 09:32, and the fallback never assigns that value.

Required result

Use the most recent available historical cumulative volume when the requested time is after the final historical slot. Add a regression test for this boundary without changing the interior-gap behavior covered by #9629.

Priority is low pending evidence of broader impact; this is limited to unmatched times beyond the historical range.

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.