mirror of
https://github.com/caty21/forex-dashboard.git
synced 2026-08-18 06:58:06 +00:00
fix: OIS indisponible sur toutes les cards + transparence sur l'instrument utilisé
Le fetch /api/rate-probabilities n'avait aucun fallback cache côté client (contrairement aux autres widgets) et pouvait planter en bloc si InvestingLive timeoutait (fetch sans AbortController) - une seule panne coupait les 8 devises d'un coup au lieu de dégrader devise par devise. - route.ts : try/catch pour toujours renvoyer un JSON valide - page.tsx : fallback localStorage si le fetch échoue - investinglive.ts : timeout 8s sur les fetches vers investinglive.com - fetch-rate-data.mjs / rateprobability.ts : le pipeline écrit maintenant la source réelle utilisée par devise (Rate Monitor USD, futures Euribor/SONIA pour EUR/GBP, InvestingLive pour les 5 autres) et la carte l'affiche - CurrencyCard.tsx : SourcesPopup corrigé (CME FedWatch retiré, plus de fausse mention "Rate Monitor" pour les devises qui n'en ont pas) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
55eca6e2f0
commit
3a384eb820
@@ -72,6 +72,7 @@ export interface CBRatePath {
|
||||
prevMeetings?: RateProbMeeting[]; // réunions semaine précédente (snapshot RP)
|
||||
prevWeekDate?: string; // date du snapshot semaine précédente
|
||||
history?: Array<{ date: string; meetings: RateProbMeeting[] }>; // snapshots hebdo accumulés
|
||||
instrumentSource?: string; // instrument réellement utilisé pour produire ces données (ground truth, écrit par le pipeline de fetch)
|
||||
}
|
||||
|
||||
export type RateProbData = Partial<Record<Currency, CBRatePath>>;
|
||||
@@ -217,6 +218,7 @@ function buildOfficialCalendarPath(
|
||||
meetings,
|
||||
peakMeeting: peakMeeting.probMovePct > 0 ? peakMeeting : null,
|
||||
yearEndImplied: meetings.at(-1)?.impliedRate ?? null,
|
||||
instrumentSource: "InvestingLive — estimation hebdomadaire analyste (pas de futures/OIS coté public pour cette devise) + calendrier officiel de réunions",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -288,7 +290,8 @@ function parseCBBody(ccy: Currency, body: Record<string, unknown>): CBRatePath |
|
||||
const currentYear = new Date().getFullYear();
|
||||
const meetsThisYear = meetings.filter(m => m.dateIso <= `${currentYear}-12-31`);
|
||||
const yearEndImplied = meetsThisYear.length > 0 ? meetsThisYear.at(-1)!.impliedRate : meetings[0].impliedRate;
|
||||
return { currency: ccy, asOf, currentRate, meetings, peakMeeting, yearEndImplied };
|
||||
const instrumentSource = typeof today["source"] === "string" ? today["source"] as string : undefined;
|
||||
return { currency: ccy, asOf, currentRate, meetings, peakMeeting, yearEndImplied, instrumentSource };
|
||||
}
|
||||
|
||||
// ── Fetch toutes les CB — depuis le cache GitHub Actions + enrichissement IL ───
|
||||
|
||||
Reference in New Issue
Block a user