fx: baseline the spot check at the written fallback pin, not a stale 1.16
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/push/woodpecker Pipeline failed
The sweep compared the ECB rate to a hardcoded 1.16 and emailed info@ with "-5.39%" plus advice to "re-convert" — obsolete since fx_sync.py converts at boot. The steady breach also froze the alert marker, so a later, real move could never mail. - Default baseline 1.0975 (the gateway's FX_FALLBACK_USD pin, ECB 2026-11-26); runtime value set via FX_POLICY_EUR_USD. - Email now says live billing is unaffected by conversion and points at the stale artifacts (config fallback, ops pricing tables, fx_state.json).
This commit is contained in:
1 parent
a3bfc56b77
commit
9ab8156da2
1 file changed
+13
-8
+13
-8
@@ -10405,7 +10405,7 @@ async def derive_member_sources() -> dict:
|
||||
return {"checked": len(stale), "flipped": flipped}
|
||||
|
||||
|
||||
FX_POLICY_EUR_USD = float(os.environ.get("FX_POLICY_EUR_USD", "1.16") or 1.16)
|
||||
FX_POLICY_EUR_USD = float(os.environ.get("FX_POLICY_EUR_USD", "1.0975") or 1.0975)
|
||||
FX_ALERT_PCT = float(os.environ.get("FX_ALERT_PCT", "2.0") or 2.0)
|
||||
|
||||
|
||||
@@ -10418,7 +10418,7 @@ def _fx_verdict(rate: float, policy: float = FX_POLICY_EUR_USD,
|
||||
|
||||
|
||||
async def fx_spot_check(send: bool = True) -> dict:
|
||||
"""Daily spot check of EUR/USD against the pricing FX (1.16). Alerts, never reprices.
|
||||
"""Daily spot check of the ECB EUR/USD rate against the written fallback pin.
|
||||
|
||||
Source: ECB daily reference rate. An alert is sent to info@ only when the drift
|
||||
first crosses FX_ALERT_PCT; staying over the line does not mail every day. When
|
||||
@@ -10452,12 +10452,17 @@ async def fx_spot_check(send: bool = True) -> dict:
|
||||
direction = "above" if verdict["drift_pct"] > 0 else "below"
|
||||
verdict["notified"] = bool(send_email(
|
||||
ADMIN_INVITER_EMAIL,
|
||||
f"EUR/USD {verdict['drift_pct']:+.1f}% {direction} the pricing FX",
|
||||
f"The ECB rate is {verdict['rate']} USD per EUR; our pricing policy is "
|
||||
f"{verdict['policy']}. Drift: {verdict['drift_pct']:+.1f}%.\n\n"
|
||||
"No prices were changed automatically. Decide whether to re-convert "
|
||||
"GreenPT/Regolo EUR list prices at the new rate (scripts/check_eur_fx.py "
|
||||
"in code/litellm guards the conversion).\n"))
|
||||
f"EUR/USD {verdict['drift_pct']:+.1f}% {direction} the fallback pin",
|
||||
f"The ECB rate is {verdict['rate']} USD per EUR; the written fallback "
|
||||
f"pin is {verdict['policy']}. Drift: {verdict['drift_pct']:+.1f}%.\n\n"
|
||||
"Live billing is not affected: the gateway re-converts GreenPT/Regolo "
|
||||
"EUR list prices at the ECB daily rate on every boot (fx_sync.py). "
|
||||
"Drift means the COMMITTED figures are stale — regenerate the USD "
|
||||
"fallback in code/litellm/config.yaml (scripts/check_eur_fx.py guards "
|
||||
"it), refresh the USD columns in ops-docs/provider-pricing/, keep "
|
||||
"FX_FALLBACK_USD and this portal's FX_POLICY_EUR_USD in step, and "
|
||||
"confirm /app/data/fx_state.json in the gateway carries a fresh feed "
|
||||
"date.\n"))
|
||||
|
||||
conn = get_db()
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user