Commit graph

66 commits

Author SHA1 Message Date
7fb674f467 enrich enrich command, remove AlphaVantage
This (huge) commit pulls out AlphaVantage in favor of utilizing
Wikidata and SEC EDGAR data sources (both free). It uses some
built-in heuristics to fill in gaps, and it is not 100% (never
will be), but should get close enough to allow hand-editing of
metadata.srf afterwords without too much labor
2026-05-30 10:40:34 -07:00
52afd75696 update srf/wire edgar and wikidata into service 2026-05-29 12:23:43 -07:00
4a5a3612e3 tweak tests 2026-05-23 11:25:39 -07:00
26e8399178 do not allow matured/closed options to clamp open positions 2026-05-23 10:03:43 -07:00
a3cfc4e4d2 portfolio loading fixes + full lint pass 2026-05-23 09:51:55 -07:00
4b5063e974 initial wells fargo parsing implementation 2026-05-21 16:14:38 -07:00
c925a1a07c fix tui command line args and make benchmarks configurable 2026-05-21 12:40:18 -07:00
1311948fa1 rectify price return calculations with Tiingo data 2026-05-20 11:47:57 -07:00
858cc6fad5 avoid output under test 2026-05-19 13:44:37 -07:00
6c32e94ab4 use adjClose for charting 2026-05-19 13:43:52 -07:00
42a4297177 add backtest and convergence to tui 2026-05-17 10:37:19 -07:00
ddf32e36da initial projections back test 2026-05-16 19:20:54 -07:00
1f71b1c6f3 add trailing returns for the week 2026-05-16 13:40:25 -07:00
80a00009d8 land date refactor (similar to money) 2026-05-12 21:40:32 -07:00
3615c4caf8 initial implementation of pre-retirement projections/accumulation phase 2026-05-12 16:37:28 -07:00
2616209614 add ability to use imported history data 2026-05-12 10:52:43 -07:00
53b807d12e upgrade to zig 0.16.0
IO-as-an-interface refactor across the codebase. The big shifts:
- std.io → std.Io, std.fs → std.Io.Dir/File, std.process.Child → spawn/run.
- Juicy Main: pub fn main(init: std.process.Init) gives gpa, io, arena,
  environ_map up front. main.zig + the build/ scripts use it directly.
- Threading io through everywhere that touches the outside world (HTTP,
  files, stderr, sleep, terminal detection). Functions taking `io` now
  announce side effects at the call site — the smell is the feature.
- date math takes `as_of: Date`, not `today: Date`. Caller resolves
  `--as-of` flag vs wall-clock at the boundary; the function operates
  on whatever date it's given. Every "today" parameter renamed and
  the as_of: ?Date + today: Date pattern collapsed.
- now_s: i64 (or before_s/after_s pairs) for sub-second metadata
  fields like snapshot captured_at, audit cadence, formatAge/fmtTimeAgo.
  Also pure and testable.
- legitimate Timestamp.now callers (cache TTL math, FetchResult
  timestamps, rate limiter, per-frame TUI "now" captures) gain
  `// wall-clock required: ...` comments justifying the read.

Test discovery: replaced the local refAllDeclsRecursive with bare
std.testing.refAllDecls(@This()). Sema-pulling main.zig's top-level
decls reaches every test file transitively through the import graph;
no explicit _ = @import(...) lines needed.

Cleanup along the way:
- Dropped DataService.allocator()/io() accessor methods; renamed the
  fields to drop the base_ prefix. Callers use self.allocator and
  self.io directly.
- Dropped now-vestigial io parameters from buildSnapshot,
  analyzePortfolio, compareSchwabSummary, compareAccounts,
  buildPortfolioData, divs.display, quote.display, parsePortfolioOpts,
  aggregateLiveStocks, renderEarningsLines, capitalGainsIndicator,
  aggregateDripLots, printLotRow, portfolio.display, printSnapNote.
- Dropped the unused contributions.computeAttribution date-form
  wrapper (only computeAttributionSpec is called).
- formatAge/fmtTimeAgo take (before_s, after_s) instead of io and
  reading the clock internally.
- parseProjectionsConfig uses an internal stack-buffer
  FixedBufferAllocator instead of an allocator parameter.
- ThreadSafeAllocator wrappers in cache concurrency tests dropped
  (0.16's DebugAllocator is thread-safe by default).
- analyzePortfolio bug surfaced by the rename: snapshot.zig was
  passing wall-clock today instead of as_of, mis-valuing cash/CDs
  for historical backfills.

83 new unit tests added due to removal of IO, bringing coverage from 58%
-> 64%
2026-05-09 22:40:33 -07:00
24dd862abc nag when data is stale 2026-05-08 14:47:31 -07:00
91bdd1d648 move ** -> @splat 2026-05-08 12:36:12 -07:00
77ec6945a0 add age-based horizon to projections 2026-05-08 11:40:33 -07:00
ea1a88442a output ratio suggestions to reconcile Schwab direct indexing accounts 2026-05-04 15:14:37 -07:00
17225326de clean up contributions command 2026-05-02 11:02:06 -07:00
b241feeaf0 incorporate life events (e.g. social security) into projections 2026-04-30 10:10:44 -07:00
33d5d7cbb4 initial commit projections TUI tab 2026-04-28 10:30:13 -07:00
a8d78ee3c6 add CLI command for projections 2026-04-27 17:36:37 -07:00
e6bd38d4c3 fixes for analysis processing 2026-04-27 16:49:27 -07:00
8c9579d4e5 master audit command to do all the things 2026-04-25 14:58:37 -07:00
23ead4c65f just defer 2026-04-25 13:13:16 -07:00
94494c60ee ai: merge multiple positions with price_ratio fields 2026-04-25 11:15:41 -07:00
9af99ef8c8 history view refactor 2026-04-23 16:02:34 -07:00
bc7605d0c6 filter non-stock totals by open-as-of 2026-04-23 07:24:49 -07:00
fc0b2d9334 centralize calculation of effective price and market value 2026-04-23 05:45:39 -07:00
efb05801cb fix portfolio account totals/honor as_of date 2026-04-23 02:43:04 -07:00
f99b9b041c use candles for pricing/implement --as-of parameter 2026-04-22 22:04:45 -07:00
ee979eb794 initial commit for new portfolio history (UI will change) 2026-04-22 12:40:54 -07:00
eb97480820 add valuation netWorth 2026-04-21 13:07:24 -07:00
323af8a351 clean up performance.zig 2026-04-21 12:34:10 -07:00
a1aec7be6a add audit command (fidelity only for now) 2026-04-09 17:33:02 -07:00
5b8c163291 merge adj_close and div reinvestment strategies to compensate for data inconsistency 2026-03-29 10:53:24 -07:00
167c960685 disable twelvedata candles due to inconsistent dividend handling 2026-03-24 18:17:19 -07:00
248e98d683 morningstar apparently snaps backward 2026-03-24 05:23:35 -07:00
239fd61ac8 use adj_close returns in most cases (accounting for splits and dividends 2026-03-24 05:14:30 -07:00
9353ebc347 synthesize money market data if candles do not cover dividend data 2026-03-21 13:24:14 -07:00
f02093928c cache chart and use sliding windows on bollinger bands 2026-03-20 09:23:41 -07:00
5acce9d0bf refactor risk module/better sharpe ratios/adjust valuation for covered calls 2026-03-17 09:45:30 -07:00
b50091bd82 centralize annualized return calc 2026-03-12 09:58:00 -07:00
71ec785e49 make price ratio non-null 2026-03-11 15:34:47 -07:00
31d18e28bd allow setting price ratio 2026-03-11 15:09:56 -07:00
b4024ea03d adjust 1 year return threshold to allow for landing the snap on weekends/holidays 2026-03-11 12:00:03 -07:00
868fcd98d3 move isCusipLike / deal with default risk rate 2026-03-10 15:53:51 -07:00