Skip to content

[Finance Data] Reconcile conflicting values across financial data providers #26

Open

Description

@helsome

Background

接入多个金融数据源后,同一标的、同一字段并不一定返回相同结果。常见原因包括更新时间不同、复权口径不同、财务字段定义不同、币种转换、provider 修订、交易所时区和 corporate action 处理差异。

最危险的做法是“取第一个成功结果”或“静默平均”。Folio 需要显式识别、记录并处理 provider disagreement。

Related: #22 #24 #25

Requirements

Comparison model

对可比较的 Financial Facts 支持:

  • field/metric-level equality/tolerance rules;
  • timestamp/period alignment;
  • currency/unit normalization 后再比较;
  • adjustment semantics 对齐;
  • absolute/relative discrepancy threshold。

Reconciliation policy

至少支持:

  • provider priority for specific fields/capabilities;
  • exact/within-tolerance agreement;
  • material conflict;
  • incomparable due to semantics/period mismatch;
  • insufficient sources。

发生 material conflict 时:

  • 不能静默平均或随机选一个值;
  • 保留所有候选 value + provider + as_of + semantics;
  • 返回 machine-readable conflict state;
  • Agent synthesis 必须知道该事实存在冲突;
  • 用户需要能够查看冲突来源。

Auditability

reconciliation result 需要记录规则版本、候选来源和最终选择原因,供 #13/#14/#15 评测与追踪。

Acceptance Criteria

  • 同一 canonical instrument/metric 可以收集至少两个 provider 的候选值。
  • 比较前会校验 period/currency/unit/adjustment 语义。
  • within-tolerance 与 material conflict 能被结构化区分。
  • material conflict 不会被静默覆盖或平均。
  • Agent/report 可以显式表达“数据源存在分歧”。
  • UI/evidence 能查看各 provider 候选值及时间口径。
  • reconciliation policy 可测试、可版本化,不散落在 prompt 中。
  • PR 至少提供 3 个真实或可复现的 provider disagreement case,并展示系统如何判定和呈现。

Non-goals

  • 不要求自动判断所有供应商谁绝对正确。
  • LLM 可以解释冲突,但不能由 LLM 自由决定底层 canonical value 而不留下规则/证据。

Activity

  1. y465995202-wq commented on Sep 11, 2026

    @y465995202-wq

    我我我

  2. 13pgpg commented on Sep 11, 2026

    @13pgpg
    Contributor

    我

  3. 13pgpg commented on Sep 11, 2026

    @13pgpg
    Contributor

    /claim

  4. added
    claimed
    on Sep 11, 2026
  5. github-actions commented on Sep 11, 2026

    @github-actions

    @13pgpg 已认领该 Issue,并已自动设为 Assignee。提交 PR 时请在描述中写 Closes #26。

  6. as992949791 commented on Sep 11, 2026

    @as992949791

    /claim

  7. github-actions commented on Sep 11, 2026

    @github-actions

    @as992949791 这个 Issue 已经由 @13pgpg 认领。

  8. github-actions commented on Sep 22, 2026

    @github-actions

    @13pgpg 这个 Issue 已认领超过 7 天,目前没有发现关联的 open PR,也没有看到最近 7 天的进度更新。

    如果仍在推进,请在 3 天内 留一条简短进度说明(包括正在等待的前置依赖也可以);如果已经有 PR,请贴出链接。若 3 天内没有回应,认领会自动释放,方便其他贡献者接手。

  9. github-actions commented on Sep 26, 2026

    @github-actions

    @13pgpg 在提醒后 3 天内没有进度回应,且仍未发现关联的 open PR;本次认领已自动释放。Issue 保持开放,可以重新认领。

  10. removed
    claimed
    on Sep 26, 2026
  11. yu1128-L commented on Oct 3, 2026

    @yu1128-L
    Contributor

    /claim

  12. added
    claimed
    on Oct 3, 2026
  13. github-actions commented on Oct 3, 2026

    @github-actions

    @yu1128-L 已认领该 Issue,并已自动设为 Assignee。提交 PR 时请在描述中写 Closes #26。

  14. github-actions commented on Oct 11, 2026

    @github-actions

    @yu1128-L 这个 Issue 已认领超过 7 天,目前没有发现关联的 open PR,也没有看到最近 7 天的进度更新。

    如果仍在推进,请在 3 天内 留一条简短进度说明(包括正在等待的前置依赖也可以);如果已经有 PR,请贴出链接。若 3 天内没有回应,认领会自动释放,方便其他贡献者接手。

  15. 13pgpg commented on Oct 12, 2026

    @13pgpg
    Contributor

    进度更新:我已把 #26 的验收项实现并提交在两个可分别审核的 PR 中,供当前认领者和维护者协调:

    #314 的可复现测试覆盖报价冲突、延迟报价不可比较、财报字段冲突、币种不一致、字段容差、显式优先级和汇率换算。相关测试 97 pass;两 PR 本地临时合并无冲突,关键测试 43 pass,五个工作区类型检查全部通过。没有真实 Longbridge/Massive 账户的线上交叉核验;Massive 财报未返回报表币种时会明确标为“不可比较”,不会猜测交易币种。

    我不会改动当前 Assignee。若与正在进行的实现有重叠,请告诉我需要调整的范围或合并顺序。

  16. github-actions commented on Oct 15, 2026

    @github-actions

    @yu1128-L 在提醒后 3 天内没有进度回应,且仍未发现关联的 open PR;本次认领已自动释放。Issue 保持开放,可以重新认领。

  17. removed
    claimed
    on Oct 15, 2026
  18. 13pgpg commented on Oct 15, 2026

    @13pgpg
    Contributor

    认领

    #314 和 #315 已提交并关联本 Issue。我会继续跟进维护者审核、必要修改和合并顺序。

  19. added
    claimed
    on Oct 15, 2026
  20. github-actions commented on Oct 15, 2026

    @github-actions

    @13pgpg 已认领该 Issue,并已自动设为 Assignee。提交 PR 时请在描述中写 Closes #26。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

claimed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions