zfin/TODO.md

59 lines
2.7 KiB
Markdown

# Future Work
## Covered call portfolio valuation
Portfolio value should account for sold call options. Shares covered by
in-the-money calls should be valued at the strike price, not the market price.
Example: 500 shares of AMZN at $225, with 3 sold calls at $220 strike.
300 shares should be valued at $220 (covered), 200 shares at $225 (uncovered).
## Institutional share class price ratios
Vanguard target date funds (e.g. 2035/VTTHX, 2040) held through Fidelity are
institutional share classes with prices that differ from the publicly traded
fund by a fixed ratio. The price can only be sourced from Fidelity directly,
but performance data (1/3/5/10yr returns) should be identical to the public
symbol.
Investigate: can we store a static price ratio in metadata (e.g. if Fidelity
says $100 and Morningstar says $20, ratio = 5) and multiply TwelveData quote
data by that ratio? Would this hold consistently over time, or does the ratio
drift?
## Market-aware cache TTL for daily candles
Daily candle TTL is currently 24 hours, but candle data only becomes meaningful
after the market close. Investigate keying the cache freshness to ~4:30 PM
Eastern (or whenever TwelveData actually publishes the daily candle) rather
than a rolling 24-hour window. This would avoid unnecessary refetches during
the trading day and ensure a fetch shortly after close gets fresh data.
## Yahoo Finance as primary quote source
Consider adding Yahoo Finance as the primary provider for real-time quotes,
with a silent fallback to TwelveData. Yahoo is free and has no API key
requirement, but the unofficial API is brittle and can break without notice.
TwelveData would serve as the reliable backup when Yahoo is unavailable.
## Human review of analytics modules
AI review complete; human review still needed for:
- `src/analytics/performance.zig` — Morningstar-style trailing returns
- `src/analytics/risk.zig` — Sharpe, volatility, max drawdown, portfolio summary
- `src/analytics/indicators.zig` — SMA, Bollinger Bands, RSI
- `src/models/classification.zig` — Sector/geo/asset-class metadata parsing
Known issues from AI review:
- `risk.zig` uses population variance (divides by n) instead of sample
variance (n-1). Negligible with 252+ data points but technically wrong.
## Risk-free rate maintenance
`risk.zig` `default_risk_free_rate` is currently 4.5% (T-bill proxy as of
early 2026). This is now a parameter to `computeRisk` with the default
exported as a public constant. Callers currently pass the default.
**Action needed:** When the Fed moves rates significantly, update
`default_risk_free_rate` in `src/analytics/risk.zig`. Eventually consider
making this a config value (env var or .env) so it doesn't require a rebuild.