- Fix return type annotation for get_default_premium_for_product
- Add type narrowing for Weight|Money union using _as_money helper
- Add isinstance checks before float() calls for object types
- Add type guard for Decimal.exponent comparison
- Use _unit_typed and _currency_typed properties for type narrowing
- Cast option_type to OptionType Literal after validation
- Fix provider type hierarchy in backtesting services
- Add types-requests to dev dependencies
- Remove '|| true' from CI type-check job
All 36 mypy errors resolved across 15 files.
- Remove '|| true' from CI type-check job to enforce strict checking
- Begin type narrowing pattern in units.py with _typed property accessors
- Document all 42 type errors across 15 files in roadmap backlog
- Priority: medium, estimated 4-6 hours to complete
Type errors fall into categories:
- Union types not narrowed after __post_init__ coercion
- float() on object types
- Duplicate method definitions
- Provider interface type mismatches
1. Fix Friday logic edge case comment
- Clarified get_default_backtest_dates() docstring
- Removed confusing 'at least a week old' comment
- Explicitly documented Friday behavior
2. Reorder validation checks in validate_date_range_for_symbol()
- Now checks start > end first (most fundamental)
- Then checks end > today (future dates)
- Finally checks symbol-specific bounds
- Users get most actionable error first
3. Add server-side numeric bounds validation
- New validate_numeric_inputs() function
- Validates units > 0, loan >= 0, 0 < LTV < 1
- Called in run_backtest() before service call
4. Add boundary tests
- Test start_date exactly at SYMBOL_MIN_DATES boundary
- Test same-day date range (start == end)
- Test end_date exactly today
- Test end_date tomorrow (future)
- Test validation order returns most actionable error
- Test near-zero and large values for units calculation
- Test LTV at boundaries (0, 1, 0.01, 0.99)
5. Add tests for validate_numeric_inputs
- Valid inputs, zero/negative values
- LTV boundary conditions
- Changed default date range from 5 days (Jan 2024) to 2 years (2022-2023)
- Added SYMBOL_MIN_DATES constant documenting data availability per symbol
- GLD minimum date: 2004-11-18 (ETF launch)
- GC futures minimum date: 1974-01-01
- XAU index minimum date: 1970-01-01
- Added UI hint showing GLD data availability from ETF launch
- Users can now run backtests across the full historical range
- 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
- 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
- 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