joellewis/finance_skills

currencies-and-fx

Analyze currency markets, exchange rate mechanics, and FX risk management for international portfolios.

Ver código fuente
Documento original del Skill

Contenido del repositorio de origen con títulos, ejemplos, código, tablas, enlaces e imágenes preservados.

Currencies and FX

Core Concepts

Spot Rate

The price of one currency in terms of another for immediate delivery (T+2 settlement). Quoting convention: EUR/USD = 1.10 means 1 euro costs 1.10 US dollars. Some pairs are quoted as the number of foreign currency units per dollar (USD/JPY = 150), while others are quoted as dollars per foreign unit (EUR/USD = 1.10, GBP/USD = 1.27).

Forward Rate

The agreed exchange rate for a future currency transaction, determined by the interest rate differential between the two currencies. Forward rates are not forecasts of future spot rates — they are arbitrage-determined prices that reflect the cost of carry.

Covered Interest Rate Parity (CIP)

An arbitrage condition that must hold (and empirically does, closely):

F/S = (1 + rd) / (1 + rf)

where F = forward rate, S = spot rate, rd = domestic interest rate, rf = foreign interest rate (for the same period). If CIP were violated, riskless arbitrage would be possible by borrowing in one currency, converting, investing, and locking in the return with a forward.

Uncovered Interest Rate Parity (UIP)

A theoretical (not arbitrage-enforced) condition:

E(St) / S0 = (1 + rd) / (1 + rf)

UIP predicts that the expected future spot rate adjusts to offset interest rate differentials. Empirically weak — high-interest-rate currencies tend to appreciate rather than depreciate as UIP predicts, which is why carry trades can be profitable.

Forward Premium/Discount

Forward Premium = (F - S) / S = (rd - rf) / (1 + r_f)

If the domestic interest rate exceeds the foreign rate, the forward rate is at a premium to spot (the foreign currency is more expensive forward). If the domestic rate is lower, the forward is at a discount.

Carry Trade

Borrow in a low-interest-rate currency and invest in a high-interest-rate currency, profiting from the interest rate differential. Profitable when UIP fails (i.e., the high-rate currency does not depreciate enough to offset the interest differential). Carry trades exhibit positive returns on average but with significant tail risk — sudden unwinds during risk-off episodes can cause severe losses (negative skewness, fat tails).

Cross Rate

Derive the exchange rate between two currencies using their rates against a common third currency:

EUR/GBP = (EUR/USD) / (GBP/USD)

For example, if EUR/USD = 1.10 and GBP/USD = 1.27, then EUR/GBP = 1.10 / 1.27 = 0.8661.

Currency Hedging

Use forward contracts to eliminate FX risk in international investments. A US investor with EUR assets can sell EUR forward to lock in the conversion rate. The hedging cost equals the interest rate differential between the two currencies (per CIP). When the domestic rate exceeds the foreign rate, hedging earns a positive return; when it is lower, hedging has a cost.

Real Exchange Rate

Adjusts the nominal exchange rate for relative price levels:

Real Rate = Nominal Rate × (Foreign Price Level / Domestic Price Level)

Changes in the real exchange rate reflect changes in competitiveness. If the real rate appreciates, domestic goods become more expensive relative to foreign goods.

Purchasing Power Parity (PPP)

The long-run anchor for exchange rates. PPP posits that exchange rates should adjust so that identical goods cost the same across countries. Empirically, PPP holds poorly in the short run but provides a reasonable guide to fair value over decades. Deviations from PPP can persist for years.

Currency Overlay

A systematic hedging program for international portfolios, managed separately from the underlying asset allocation. Overlay managers implement hedging ratios (e.g., hedge 50% of foreign exposure) and may make tactical adjustments based on valuation, carry, and momentum signals.

Key Formulas

FormulaExpressionUse Case
CIP Forward RateF = S × (1+rd)/(1+rf)Arbitrage-determined forward
UIP Expected SpotE(St) = S0 × (1+rd)/(1+rf)Theoretical future spot
Forward Premium(F-S)/S = (rd-rf)/(1+r_f)Forward vs spot differential
Cross RateA/B = (A/C) / (B/C)Derive from common currency
Real Exchange Rateq = e × (P*/P)Competitiveness measure
Hedging Cost≈ rd - rf (annualized)Cost to hedge FX exposure

Worked Examples

Example 1: Forward Rate Calculation

Given: USD/JPY spot = 150, US 1-year rate = 5%, Japan 1-year rate = 0.5% Calculate: 1-year forward rate Solution: F = S × (1 + rJPY) / (1 + rUSD) F = 150 × (1 + 0.005) / (1 + 0.05) F = 150 × 1.005 / 1.05 F = 150 × 0.95714 = 143.57

The forward rate is 143.57 JPY/USD. The yen is at a forward premium (fewer yen per dollar forward than spot) because Japanese rates are lower. A US investor hedging yen assets back to dollars would receive this favorable forward rate, effectively earning the interest rate differential.

Example 2: Hedging Cost for EUR Investor

Given: EUR/USD spot = 1.10, EUR 1-year rate = 3%, USD 1-year rate = 5% Calculate: Annual cost/benefit of hedging USD exposure back to EUR Solution: Forward rate: F = 1.10 × (1.03)/(1.05) = 1.10 × 0.98095 = 1.0790

A EUR investor hedging USD assets sells USD forward at 1.0790 EUR/USD. Hedging benefit = (S - F) / S = (1.10 - 1.079) / 1.10 = 1.91%

Because EUR rates (3%) are lower than USD rates (5%), the EUR investor earns a positive hedging return of approximately 2% (the interest rate differential). The hedged return on USD assets for a EUR investor is the USD return plus approximately 2% from the hedge.

Common Pitfalls

  • Currency quoting conventions — EUR/USD vs USD/JPY use opposite conventions; always clarify which currency is base and which is quote
  • Confusing nominal and real interest rate differentials — CIP uses nominal rates; real rate differentials affect real exchange rates differently
  • Carry trade crash risk — carry strategies exhibit negative skewness and fat tails; profits accumulate slowly but losses can be sudden and severe
  • CIP holds by arbitrage; UIP is a theory that often fails empirically — do not assume forward rates predict future spot rates

Cross-References

  • historical-risk (wealth-management plugin): return measurement in multi-currency portfolios
  • equities (wealth-management plugin): international equity investing and currency effects
  • fixed-income-sovereign (wealth-management plugin): international bond investing and rate differentials
  • asset-allocation (wealth-management plugin): currency hedging decisions in portfolio context

Running the Script

bash
uv run scripts/currencies_and_fx.py            # run the demo (uses PEP 723 inline deps)
uv run scripts/currencies_and_fx.py --verify   # check demo outputs against the worked examples (exit 1 on mismatch)
python3 scripts/currencies_and_fx.py            # alternative (stdlib only, no installs needed)

The demo prints the calculations covered above; its values match the worked examples in this skill. Run --help for a list of the classes and functions. For programmatic use, import the module rather than running it — the demo only executes under python currencies_and_fx.py.

del mismo repositorio

Más Skills

Todos los Skills
joellewis
Comunidad

investment-policy

Construct comprehensive Investment Policy Statements governing return objectives, risk tolerance, and portfolio constraints. Use when the user asks about building an IPS, setting return objectives, assessing risk tolerance, defining investment constraints, or establishing rebalancing and benchmark policies. Also trigger when users mention 'investment plan', 'policy portfolio', 'risk capacity vs willingness', 'spending rate for an endowment', 'foundation payout', 'manager selection criteria', or ask how to document their investment strategy.

instalaciones
1
GitHub Stars
184
Actualizado
18 jul
joellewis
Comunidad

account-maintenance

Process account maintenance requests across the account lifecycle. Use when changing a client address or contact info with identity verification, updating beneficiary designations after marriage, divorce, birth, or death, re-registering or re-titling an account to a trust or new entity, selecting tax lot methods or fixing cost basis records, applying legal or compliance holds or Reg T freezes, setting up systematic withdrawals or standing instructions, processing a death notification and estate account setup, handling a QDRO, power of attorney, or guardianship, closing accounts and managing escheatment, or designing data quality review programs.

instalaciones
1
GitHub Stars
179
Actualizado
18 jul
joellewis
Comunidad

account-transfers

Process and manage account transfers between and within financial institutions. Use when handling full or partial ACAT transfers between broker-dealers, troubleshooting ACAT rejection codes or FINRA Rule 11870 timelines, setting up non-ACAT transfers (Fund/SERV, DTC free delivery, physical certificates), processing internal journal entries, handling retirement rollovers or Roth conversions with proper tax reporting, transferring cost basis under IRC Section 6045A, moving decedent assets to beneficiaries with date-of-death step-up, or reconciling residual credits and fractional shares after transfer completion.

instalaciones
1
GitHub Stars
179
Actualizado
18 jul
joellewis
Comunidad

bet-sizing

Determine how much capital to allocate to individual positions within a portfolio. Use when the user asks about position sizing, the Kelly criterion, fractional Kelly, risk budgeting, or conviction weighting. Also trigger when users mention 'how much to put in one stock', 'maximum position size', 'how concentrated should my portfolio be', 'number of holdings', 'VaR budget per position', 'how big a bet', or ask about scaling position sizes with volatility.

instalaciones
1
GitHub Stars
179
Actualizado
18 jul