auto: sync 2026-06-01 23:46

This commit is contained in:
Capucine Gest
2026-06-01 23:46:41 +02:00
parent 8c479d377e
commit 5c6de88604
5 changed files with 499 additions and 5 deletions
+22
View File
@@ -5,6 +5,7 @@ import cpiOverridesRaw from "@/data/cpi_overrides.json";
import rateDecisionsRaw from "@/data/rate_decisions.json";
import { fetchFFThisWeek, fetchFFEvents } from "@/lib/forexfactory";
import type { FFEvent } from "@/lib/forexfactory";
import { fetchTECoreInflation } from "@/lib/tecpi";
const FRED_BASE = "https://api.stlouisfed.org/fred/series/observations";
const REVALIDATE = 86400; // cache 24h
@@ -1002,6 +1003,27 @@ export async function GET(req: NextRequest) {
}
}
// ── TE Core CPI (priorité maximale — données du jour, toutes devises) ────────
// Remplace les séries FRED erronées :
// GBP GBRCPIALLMINMEI = All Items (headline), pas core → écart ~1%
// JPY PCPI total (3.6%) ≠ core (1.4%) → erreur massive
// USD CPILFESL retard 1 mois → écart 0.2%
// AUD/NZD trimestriels → retard jusqu'à 3 mois
{
const teCpi = await fetchTECoreInflation();
const te = teCpi[currency];
if (te) {
const surprise = parseFloat((te.value - te.prev).toFixed(3));
indicators.cpiCore = {
value: te.value,
prev: te.prev,
surprise,
trend: surprise > 0 ? "up" : surprise < 0 ? "down" : "flat",
lastUpdated: te.refMonth,
};
}
}
// Stale-if-error
const hasAnyValue = Object.values(indicators).some((v) => v !== null);
if (!hasAnyValue && staleCache) {