You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
buffer_platform/openspec/changes/trading-day-redefinition/design.md

625 B

设计文档

实现方案

交易日重计算函数 recalculate_trade_date

输入:原始交易日 (YYYY-MM-DD) + 交易时间 (HH:MM:SS) 输出:重新计算后的交易日

逻辑:

  1. 解析交易时间,判断是否在 21:00 之后
  2. 如果在 21:00 之后(夜盘):
    • 如果原始交易日是周五,则交易日 = 下周一
    • 否则交易日 = 原始交易日 + 1 天
  3. 如果在 15:00 之前且不在夜盘时段,保持原交易日
  4. 其他情况保持原交易日

应用位置

save_to_db 中处理每条记录时,调用 recalculate_trade_date 重新计算交易日。