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

@@ -62,7 +62,11 @@ def test_cost_benefit_chart_shows_positive_downside_benefit_when_puts_are_in_the
def test_hedge_quote_resolution_converts_gld_share_price_to_ozt_spot() -> None:
"""Hedge page should convert GLD share quotes to USD/ozt for display."""
"""Hedge page should convert GLD share quotes to USD/ozt using expense-adjusted backing."""
from datetime import date
from app.domain.instruments import gld_ounces_per_share
config = PortfolioConfig(entry_price=4400.0, gold_ounces=220.0, entry_basis_mode="weight", loan_amount=145000.0)
share_quote = {
"symbol": "GLD",
@@ -74,7 +78,10 @@ def test_hedge_quote_resolution_converts_gld_share_price_to_ozt_spot() -> None:
spot, source, updated_at = resolve_portfolio_spot_from_quote(config, share_quote)
assert spot == 4041.9
# With expense-adjusted backing (~0.0916 oz/share), spot = 404.19 / 0.091576... ≈ 4413.71
current_backing = float(gld_ounces_per_share(date.today()))
expected_spot = 404.19 / current_backing
assert abs(spot - expected_spot) < 0.01
assert source == "yfinance"