diff --git a/app/page.tsx b/app/page.tsx index 7fa1765..d59bd11 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -599,10 +599,10 @@ export default function Dashboard() {
- - - - + + + +
)} diff --git a/components/TvChart.tsx b/components/TvChart.tsx index 1c6b1ed..96c64e8 100644 --- a/components/TvChart.tsx +++ b/components/TvChart.tsx @@ -84,13 +84,16 @@ export function TvAdvancedChart({ backgroundColor: "rgba(8,12,20,0)", gridColor: "rgba(30,45,61,0.5)", hide_top_toolbar: false, + hide_side_toolbar: false, hide_legend: false, allow_symbol_change: false, calendar: false, hide_volume: false, isTransparent: true, save_image: true, + withdateranges: true, drawings_access: { type: "all" }, + support_host: "https://www.tradingview.com", container_id: containerId, }, height @@ -102,13 +105,29 @@ export function TvAdvancedChart({ }; }, []); // eslint-disable-line + const tvUrl = `https://www.tradingview.com/chart/?symbol=${encodeURIComponent(symbol)}&interval=${interval}`; + return (
- {label && ( -

- {label} -

- )} +
+ {label && ( +

{label}

+ )} + + + + + + + TradingView + +
{ + try { + const raw = readFileSync(IL_CACHE_FILE, "utf8"); + const cached = JSON.parse(raw) as { ts: number; data: ILExpectationsWithHistory }; + if (Date.now() - cached.ts < IL_CACHE_TTL) { + console.log(`[IL-cache] HIT (${Math.round((Date.now() - cached.ts) / 60000)}min old)`); + return cached.data; + } + console.log("[IL-cache] STALE — refetch"); + } catch { + console.log("[IL-cache] MISS — premier fetch"); + } + const data = await fetchILExpectationsWithHistory(); + try { + writeFileSync(IL_CACHE_FILE, JSON.stringify({ ts: Date.now(), data })); + } catch { /* /tmp read-only en prod Vercel — ignoré */ } + return data; +} // ── Types publics ────────────────────────────────────────────────────────────── @@ -291,7 +315,7 @@ function parseCBBody(ccy: Currency, body: Record): CBRatePath | export async function fetchAllCBPaths(): Promise { // GitHub Actions met à jour data/rate-probabilities.json toutes les heures // (CME FedWatch pour USD, Investing.com pour les autres, InvestingLive en fallback) - const [ilHistory] = await Promise.all([fetchILExpectationsWithHistory()]); + const [ilHistory] = await Promise.all([getCachedILHistory()]); const ilData = ilHistory.current; const ilPrev = ilHistory.prev; const prevDate = ilHistory.prevDate;