feat(PRICING-001): add GLD expense ratio decay correction

This commit is contained in:
Bu5hm4nn
2026-03-28 09:04:35 +01:00
parent ff251b5ace
commit 894d88f72f
7 changed files with 208 additions and 26 deletions

View File

@@ -50,6 +50,11 @@ def test_asset_quantity_from_floats_matches_workspace_backtest_conversion() -> N
def test_asset_quantity_from_workspace_config_uses_instrument_weight_conversion_for_gld() -> None:
"""GLD shares are calculated using expense-adjusted backing (~0.0916 oz/share in 2026)."""
from datetime import date
from app.domain.instruments import gld_ounces_per_share
config = PortfolioConfig(
gold_ounces=220.0,
entry_price=4400.0,
@@ -60,7 +65,12 @@ def test_asset_quantity_from_workspace_config_uses_instrument_weight_conversion_
quantity = asset_quantity_from_workspace_config(config, entry_spot=100.0, symbol="GLD")
assert quantity == 2200.0
# 220 oz / 0.091576... oz/share ≈ 2402.37 shares (NOT 2200 with old 0.1 ratio)
current_backing = float(gld_ounces_per_share(date.today()))
expected_shares = 220.0 / current_backing
assert abs(quantity - expected_shares) < 0.0001
# Verify it's more than the old 2200 shares
assert quantity > 2200.0
def test_materialize_backtest_portfolio_state_uses_typed_asset_boundary() -> None: