feat(engine+skill): 多幣別現金桶 — 台美各帳戶各自錨點,per-currency 各算再 fx 聚合 (refs #171)#178
Merged
Conversation
) 問題:單一 TR_CASH 只表一種幣,台美各帳戶現金無法各自錨定 → 混市場帳戶 現金比重/入金判讀算不準(台股 session #173 挖出的遺留)。 cash_position 重構成 per-currency:每個幣別各自錨點(錨點+其後該幣別現金流) 或 csv_sum,用 fx 聚合成 USD total。#177 的 _anchor_to_aggregate(單一 anchor 換算)是此設計的特例,併入退役。 - TR_CASH 支援 list(台美多帳戶各一錨點,向後相容單 dict) - 輸出保持 {balance,weight,source,reliable,recent_net_deposit} 契約 + by_currency 明細 - reliable:全幣別有錨點=true / 部分=partial / 全無=csv_sum - honesty_ledger cash_reliability 對 partial 揭露 unanchored_currencies(只講缺的帳戶、別把已可信的那半講不準) - SKILL Step 0 TR_CASH list 格式 + card-spec partial 講法 + EVALS B17 同步 驗證:run_all 十套綠(離線+network);tw_mixed 雙錨點聚合(TWD 250k + USD 4k → 11788 USD reliable + by_currency);單幣 mock 向後相容(noisy_broker 單 USD 錨點 balance=22284 anchored,數字不變)。 stacked on #177(台股,claude/silly-sutherland-974463);#177 merge 後 retarget main。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
705edce to
58a50fa
Compare
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.
問題(台股 session #173 挖出的遺留)
單一
TR_CASH只表一種幣 → 台美各帳戶現金無法各自錨定。#177 的混市場帳戶只給 TWD 錨點時,USD 現金靠 csv_sum 盲算 → 現金比重/入金判讀算不準。這是 owner 選定的下一步。設計
cash_position重構成 per-currency:每個幣別各自錨點(錨點+其後該幣別現金流)或 csv_sum,用 fx 聚合成 USD total。#177 的_anchor_to_aggregate(單一 anchor 換算)是此設計的特例,併入退役——單→多的一般化。TR_CASH支援 list(台美多帳戶各一錨點),向後相容單 dict{balance,weight,source,reliable,recent_net_deposit}契約 +by_currency明細reliable:全幣別有錨點=true / 部分=partial / 全無=csv_sumhonesty_ledger.cash_reliability對 partial 揭露unanchored_currencies(只講缺錨點的帳戶,別把已可信的那半也講不準)驗收
balance=11788 USD、reliable=true、by_currency={TWD,USD}(network smoke 實跑)source=partial、by_currency.USD.reliable=false、honesty 揭露 USD 缺balance=22284 anchored,數字不變run_all十套綠(離線+network);契約測試by_currencykey 同步檔案
engine/trade_recap.py_cash_balance_one_ccy+ cash_position per-currency 重構 + honesty partialSKILL.mdStep 0TR_CASHlist 格式 + card.cashby_currency欄位card-spec.md/EVALS.mdB17tests/遺留
#171 B 路線剩餘:TWR/Modified Dietz/IRR/cash drag(現金基建這下齊了)。
🤖 Generated with Claude Code