feat(DISPLAY-002): GLD mode shows real share prices

This commit is contained in:
Bu5hm4nn
2026-03-28 21:45:00 +01:00
parent 24c74cacbd
commit dac0463d55
8 changed files with 800 additions and 40 deletions

View File

@@ -116,6 +116,9 @@ class PortfolioConfig:
# Underlying instrument selection
underlying: str = "GLD"
# Display mode: how to show positions (GLD shares vs physical gold)
display_mode: str = "XAU" # "GLD" for share view, "XAU" for physical gold view
# Alert settings
volatility_spike: float = 0.25
spot_drawdown: float = 7.5
@@ -311,6 +314,7 @@ class PortfolioConfig:
"fallback_source": self.fallback_source,
"refresh_interval": self.refresh_interval,
"underlying": self.underlying,
"display_mode": self.display_mode,
"volatility_spike": self.volatility_spike,
"spot_drawdown": self.spot_drawdown,
"email_alerts": self.email_alerts,
@@ -394,6 +398,7 @@ class PortfolioRepository:
"fallback_source",
"refresh_interval",
"underlying", # optional with default "GLD"
"display_mode", # optional with default "XAU"
"volatility_spike",
"spot_drawdown",
"email_alerts",
@@ -491,7 +496,7 @@ class PortfolioRepository:
# Fields that must be present in persisted payloads
# (underlying is optional with default "GLD")
# (positions is optional - legacy configs won't have it)
_REQUIRED_FIELDS = (_PERSISTED_FIELDS - {"underlying"}) - {"positions"}
_REQUIRED_FIELDS = (_PERSISTED_FIELDS - {"underlying", "display_mode"}) - {"positions"}
@classmethod
def _validate_portfolio_fields(cls, payload: dict[str, Any]) -> None: