← ClaudeAtlas

portfolio-currency-translationlisted

Use whenever code values a multi-market stock/asset portfolio in one home currency, converts foreign holdings or dividends, computes multi-currency P&L or returns, or debugs why portfolio values jump on weekends or don't match a broker statement. Triggers on "portfolio value in USD", "consolidate multi-currency holdings", "convert NYSE/LSE/TSE positions", "why did my portfolio jump on Monday", "local vs currency return", or any code that multiplies a foreign share price by an FX rate to produce a home-currency total.
nusantara-ventures/exchangerate-skills · ★ 0 · AI & Automation · score 70
Install: claude install-skill nusantara-ventures/exchangerate-skills
# Portfolio currency translation A portfolio holding NYSE, LSE, and TSE positions needs one number: total value in the home currency. The naive approach — `shares × local_price × today's_fx_rate` for each lot, summed — is wrong in at least three ways: it mixes timestamps across markets, it rounds too early, and it silently hides how much of the change was the stock moving versus the currency moving. This skill covers the translation problem end-to-end. Engine: exchangerate.dev (`https://api.exchangerate.dev`, keyless). ## 1. Why naive conversion is wrong The naive loop — for each lot, `shares × local_price × today's_fx_rate`, summed — stacks three separate bugs: - **Timestamp mismatch.** A TSE stock's close is from ~08:00 UTC, an LSE stock's from ~16:30 UTC. Fetching one "today's" FX rate at request time (say 14:00 UTC) applies a single snapshot to prices fixed 6+ hours apart — the JPY leg converted at a rate from *after* Tokyo closed, the GBP leg from *before* London closed. See §2. - **Per-lot rounding.** Rounding each lot to home-currency minor units before summing compounds rounding error across dozens of positions — see §7. - **No return decomposition.** A JPY stock up 2% with JPY down 1% against USD nets to ~+1% in USD, but "the portfolio is up 1%" hides that the position outperformed while the currency dragged — see §4. ## 2. Pick ONE valuation convention and document it There is no single "correct" close — Tokyo close, London close, and the ECB ~16:00 CET fix ar