Repository navigation
Conversation
快照缺少 lastTrade.t / min.t / updated 时,mapQuote 原先用 Date.now() 填充 Quote.timestamp,随后 provenance.marketTime 又由它换算,导致获取 时间被误记为行情发生时间。现按仓库约定用 timestamp=0 表示行情时间未知, 且仅在 timestamp>0 时写入 marketTime;fetchedAt 仍照常记录获取时间。 价格字段映射不变。 新增 Massive 适配器单测,分别覆盖无行情时间与有效行情时间两条路径。 Closes ydflow#55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么
packages/shared/src/providers/massive/adapter.tsmapQuote:快照缺少lastTrade.t/min.t/updated时,Quote.timestamp不再用Date.now()填充,改为0(仓库约定timestamp <= 0表示行情时间未知)。fetchAndMap(market.quote 分支):provenance.marketTime仅在quote.timestamp > 0时写入,否则保持undefined;provenance.fetchedAt仍照常记录获取时间。packages/shared/src/providers/massive/massive.test.ts:新增when the snapshot has no market time两条单测,覆盖无行情时间与有效行情时间两条路径(RED→GREEN 已验证)。为什么要改
免费档快照有时会给出价格但缺少所有行情时间字段。原实现用
Date.now()/1000填充Quote.timestamp,随后provenance.marketTime又由它换算,导致「获取报价的时间」被误记为「行情发生时间」。改成timestamp=0表达未知后,下游market.quotemanifest 的stale: quote.timestamp <= 0判断也能正确生效。对应 Issue
Closes #55
验证报告
环境:Bun 1.3.13 / macOS。
已知限制 / 未完成项
无可见 UI 变化(纯数据字段映射),无需截图。未做实盘 API 验证,使用 mock fetch 的适配器单测覆盖;有效行情时间的既有秒/毫秒约定由原有测试与本 PR 新测试共同保证。