Skip to content

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

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

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

Metadata

Metadata

Assignees

Labels

claimedClaimed by a contributor and currently in progress

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions