Commit Graph

222 Commits

Author SHA1 Message Date
Bu5hm4nn
853c80d3a2 feat(event-comparison): use initial portfolio value instead of underlying units
- Changed UI input from 'Underlying units' to 'Initial portfolio value ($)'
- Underlying units are now calculated as initial_value / entry_spot
- Updated default value to workspace gold_value instead of gold_ounces * entry_spot
- Result summary now shows both 'Initial value' and 'Underlying units'
- This allows users to specify how much they invest on day 1, and the system
  automatically calculates the maximum purchasable shares/contracts
2026-03-29 16:12:33 +02:00
Bu5hm4nn
7f347fa2a6 fix(tests): fix BacktestSettingsRepository.load() and workspace seeding tests
- BacktestSettingsRepository.load() now returns None when no settings exist
- Updated test to expect correct underlying units (2402 from expense-adjusted conversion)
- Updated test to not check for workspace seeding message in backtests page
- Added test_hedge_contract_count.py and test_backtest_settings.py to CI test suite
- Build job now depends on lint and test passing
2026-03-29 15:34:49 +02:00
Bu5hm4nn
561c31ffa4 chore: ignore .workspaces directories 2026-03-29 15:03:23 +02:00
Bu5hm4nn
2873a36082 fix(ci): remove needs array from build job to debug forgejo parsing 2026-03-29 14:59:08 +02:00
Bu5hm4nn
c96c66c844 fix(ci): set APP_ENV=test and clean up workflow YAML
- Set APP_ENV=test in test job to use Turnstile test keys
- Remove empty lines between steps in build job
- Add explicit 'Checkout' step name for clarity
2026-03-29 14:55:14 +02:00
Bu5hm4nn
aa0f96093c docs: add pre-merge checklist to AGENTS.md
- Run pytest locally before pushing
- Run /review for code quality and QA validation
- Verify CI passes on Forgejo
- Address review comments before merging
2026-03-29 14:48:39 +02:00
Bu5hm4nn
2e2a832b31 fix(tests): use GLD launch date in decay test
Use date(2004, 11, 18) instead of date(2004, 1, 1) since GLD didn't
exist before November 18, 2004. The validation now correctly raises
ValueError for pre-launch dates.
2026-03-29 14:47:36 +02:00
Bu5hm4nn
092d710eeb fix(ci): add DATABENTO_API_KEY to deploy environment
- Add DATABENTO_API_KEY secret to deploy job environment
- Add DATABENTO_API_KEY to .env file creation in deploy script
- Add databento to test and type-check job dependencies
2026-03-29 12:11:12 +02:00
Bu5hm4nn
786953c403 docs: add verified Forgejo CI debugging guide to AGENTS.md
Verified:
- Web UI URL for viewing workflow runs
- SSH command to access runner logs
- Common failure patterns and fixes
2026-03-29 12:10:52 +02:00
Bu5hm4nn
9fed45ef9f fix(ci): add databento to CI dependencies for test and type-check
The test job runs tests that import DatabentoHistoricalPriceSource,
and type-check analyzes app/services/backtesting/databento_source.py.
Both need the databento package installed.
2026-03-29 12:05:22 +02:00
Bu5hm4nn
850be70fea fix(ci): add DATABENTO_API_KEY to deploy environment
- Add DATABENTO_API_KEY secret to deploy job environment
- Add DATABENTO_API_KEY to .env file creation in deploy script
- Matches DATABENTO_API_KEY in .env.example
2026-03-29 12:03:26 +02:00
Bu5hm4nn
b54bf9d228 docs: mark CONV-001 and DATA-DB-003 as done 2026-03-29 12:00:50 +02:00
Bu5hm4nn
dc4ee1f261 feat(CONV-001): add GLD launch date validation, feat(DATA-DB-003): add cache CLI
CONV-001:
- Add GLD_LAUNCH_DATE constant (November 18, 2004)
- Validate reference_date in gld_ounces_per_share()
- Raise ValueError for dates before GLD launch
- Update docstring with valid date range
- Add comprehensive test coverage for edge cases

DATA-DB-003:
- Create scripts/cache_cli.py with three commands:
  - vault-dash cache stats: Show cache statistics
  - vault-dash cache list: List cached entries
  - vault-dash cache clear: Clear all cache files
- Add Makefile targets: cache-stats, cache-list, cache-clear
- Integrate with DatabentoHistoricalPriceSource methods
2026-03-29 12:00:30 +02:00
Bu5hm4nn
ace6d67482 docs: mark DATA-DB-004 as done, update roadmap 2026-03-29 11:12:20 +02:00
Bu5hm4nn
9a3b835c95 feat(DATA-DB-004): add Databento settings UI and independent scenario config
- Updated backtests page with Data Source card
  - Data source selector (databento/yfinance/synthetic)
  - Dataset dropdown (XNAS.BASIC, GLBX.MDP3)
  - Resolution dropdown (ohlcv-1d, ohlcv-1h)
  - Cost estimate display (placeholder for now)

- Added Scenario Configuration card
  - Underlying symbol selector (GLD/GC/XAU)
  - Start/end date inputs
  - Start price input (0 = auto-derive)
  - Underlying units, loan amount, margin call LTV

- BacktestPageService updates:
  - get_historical_prices() with data_source parameter
  - get_cost_estimate() for Databento cost estimation
  - get_cache_stats() for cache status display
  - Support for injected custom provider identity
  - DataSourceInfo for provider metadata

- BacktestSettingsRepository integration:
  - Load/save settings per workspace
  - Default values from BacktestSettings.create_default()

- Test update: TLT validation message changed to reflect
  new multi-symbol support (GLD, GC, XAU)
2026-03-29 11:12:11 +02:00
Bu5hm4nn
52a0ed2d96 docs: mark DATA-DB-001 and DATA-DB-002 as done 2026-03-29 10:46:51 +02:00
Bu5hm4nn
43067bb275 feat(DATA-DB-002): add BacktestSettings model and repository
- BacktestSettings dataclass with all configuration fields
- BacktestSettingsRepository for persistence per workspace
- Settings independent of portfolio configuration
- Full validation for dates, symbols, LTV, etc.
- 16 comprehensive tests

Fields:
- settings_id, name: identification
- data_source: databento|yfinance|synthetic
- dataset, schema: Databento configuration
- start_date, end_date: date range
- underlying_symbol, start_price, underlying_units: position config
- loan_amount, margin_call_ltv: LTV analysis
- template_slugs: strategies to test
- cache_key, data_cost_usd: caching metadata
- provider_ref: provider configuration
2026-03-29 10:46:25 +02:00
Bu5hm4nn
f4c3cee91d docs: move DATA-DB-001 to in-progress, update roadmap 2026-03-29 09:58:11 +02:00
Bu5hm4nn
bf13ab5b46 feat(DATA-DB-001): add Databento historical price source for backtesting
- Add DatabentoHistoricalPriceSource implementing HistoricalPriceSource protocol
- Smart caching with Parquet storage and metadata tracking
- Auto symbol-to-dataset resolution (GLD→XNAS.BASIC, GC=F→GLBX.MDP3)
- Cache management with age threshold invalidation
- Cost estimation via metadata.get_cost()
- Add databento>=0.30.0 to requirements.txt
- Add DATABENTO_API_KEY to .env.example
- Full test coverage with 16 tests
2026-03-29 09:58:02 +02:00
Bu5hm4nn
c02159481d docs: add Databento integration plan and roadmap items 2026-03-29 09:52:06 +02:00
Bu5hm4nn
8079ca58e7 docs: mark PORTFOLIO-002 and PORTFOLIO-003 done, update roadmap 2026-03-28 23:54:05 +01:00
Bu5hm4nn
bb06fa7e80 feat(PORTFOLIO-003): add premium and spread for physical gold positions 2026-03-28 23:53:46 +01:00
Bu5hm4nn
0e972e9dd6 feat(PORTFOLIO-002): add position storage costs 2026-03-28 23:48:41 +01:00
Bu5hm4nn
e148d55cda docs: mark DISPLAY-001 and DISPLAY-002 done, update roadmap 2026-03-28 21:59:52 +01:00
Bu5hm4nn
63a8482753 feat(DISPLAY-002): GLD mode shows real share prices 2026-03-28 21:59:15 +01:00
Bu5hm4nn
dac0463d55 feat(DISPLAY-002): GLD mode shows real share prices 2026-03-28 21:45:00 +01:00
Bu5hm4nn
20f5086507 feat(DISPLAY-001): add underlying mode switching 2026-03-28 21:44:32 +01:00
Bu5hm4nn
24c74cacbd docs: mark PORTFOLIO-001 done, update roadmap 2026-03-28 21:30:02 +01:00
Bu5hm4nn
1a39956757 feat(PORTFOLIO-001): add position-level portfolio entries 2026-03-28 21:29:30 +01:00
Bu5hm4nn
447f4bbd0d docs: add PORTFOLIO and DISPLAY roadmap items for multi-position mode switching 2026-03-28 20:59:29 +01:00
Bu5hm4nn
fd51f1e204 docs: mark DATA-004 done, update roadmap 2026-03-28 16:40:59 +01:00
Bu5hm4nn
3b98ebae69 feat(DATA-004): add underlying instrument selector 2026-03-28 16:40:18 +01:00
Bu5hm4nn
cdd091a468 docs: mark PRICING-002 and PRICING-003 done, update roadmap 2026-03-28 09:18:53 +01:00
Bu5hm4nn
3bf3774191 Merge branch 'feature/PRICING-002-basis-display' 2026-03-28 09:18:29 +01:00
Bu5hm4nn
de789f591e Merge branch 'feature/PRICING-003-hedge-correction' 2026-03-28 09:18:29 +01:00
Bu5hm4nn
9d06313480 feat(PRICING-002): add GLD/GC=F basis display on overview 2026-03-28 09:18:26 +01:00
Bu5hm4nn
966cee7963 feat(PRICING-003): use true GLD backing for hedge contract count 2026-03-28 09:18:26 +01:00
Bu5hm4nn
b30cfd7470 docs: mark PRICING-001 done, update roadmap 2026-03-28 09:05:28 +01:00
Bu5hm4nn
894d88f72f feat(PRICING-001): add GLD expense ratio decay correction 2026-03-28 09:04:35 +01:00
Bu5hm4nn
ff251b5ace docs: add GLD pricing and underlying selector roadmap items 2026-03-28 08:53:02 +01:00
Bu5hm4nn
e70e677612 Add GLD vs gold futures basis research for dashboard implementation 2026-03-28 08:48:49 +01:00
Bu5hm4nn
4620234967 feat(EXEC-001): add hedge strategy builder 2026-03-27 22:33:20 +01:00
Bu5hm4nn
554a41a060 refactor(BT-001C): share historical fixture provider 2026-03-27 21:41:50 +01:00
Bu5hm4nn
477514f838 feat(BT-002): add historical snapshot provider 2026-03-27 18:31:28 +01:00
Bu5hm4nn
1a6760bee3 feat(PORT-003): add historical ltv charts 2026-03-27 16:39:33 +01:00
Bu5hm4nn
b3418eed2e docs(BT-003B): record completed drilldown validation 2026-03-27 11:12:18 +01:00
Bu5hm4nn
3c9ff201e1 feat(BT-003B): add event comparison drilldown 2026-03-26 22:05:31 +01:00
Bu5hm4nn
bdf56ecebe fix(CORE-001D): close boundary review gaps 2026-03-26 17:34:09 +01:00
Bu5hm4nn
94f3c1ef83 feat(CORE-001D): close remaining boundary cleanup slices 2026-03-26 17:27:44 +01:00
Bu5hm4nn
99d22302ee fix(CORE-001D3B): validate alert history entry types 2026-03-26 15:19:42 +01:00