RelativeDailyVolume merges sparse sessions sharing a day-of-month

未关闭 适合新手
#10,199 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
85/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
csharp
领域
data

调研方向

阅读 Indicators/RelativeDailyVolume.cs 第 85–104 行附近的代码,找到使用 input.Time.Day 的会话变更比较逻辑。然后找到现有的 RelativeDailyVolume 测试,并添加一个回归用例:先准备好指标,再在日历日期不同但月份中的日期相同的情况下进行稀疏更新。后续更新导致会话切换且报告的比率为 0.5 时,即为完成。

由索引模型根据 Issue 内容生成。

描述

priority:p2

Problem

RelativeDailyVolume detects a session change by comparing only input.Time.Day. If sparse updates skip to the same day-of-month in a later month, it treats the new session as the old one, keeps the old volume in the numerator and fails to advance its historical state.

Source: Indicators/RelativeDailyVolume.cs, lines 85–104.

Reproduction

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

var symbol = new Symbol(SecurityIdentifier.GenerateEquity("SPY", Market.USA, false), "SPY");
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(new DateTime(2024, 1, 14, 9, 30, 0), 100));
rdv.Update(Bar(new DateTime(2024, 1, 15, 9, 30, 0), 100));
rdv.Update(Bar(new DateTime(2024, 2, 15, 9, 30, 0), 50));
Console.WriteLine($"{rdv.IsReady}: {rdv.Current.Value}");

Executed result: True: 1.5. Expected: True: 0.5.

The January 15 update makes the period-1 indicator ready. February 15 has the same .Day value, so January's volume 100 remains in _currentData; the ratio becomes (100 + 50) / 100 instead of 50 / 100.

Required result

Distinct calendar dates must trigger session rollover even when their day-of-month values match. Add a regression test with an already-ready indicator and sparse updates across a month-long gap. This does not ask to invent data for dates with no updates.

Priority is low: the demonstrated case needs a long gap in input, rather than ordinary consecutive-session updates.

主要语言
C#
星标
22.6k
派生
5.4k
平均合并
11 小时 39 分钟
30 天内合并 PR
104

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

QuantConnect/Lean 的其他 Issue

查看 QuantConnect/Lean 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。