auto: sync 2026-06-02 16:21

This commit is contained in:
Capucine Gest
2026-06-02 16:21:27 +02:00
parent 28eaa699dc
commit 1a334fd2c8
3 changed files with 17 additions and 16 deletions
+6 -3
View File
@@ -58,11 +58,12 @@ function TrendIcon({ trend }: { trend: "up"|"down"|"flat"|null }) {
return <Minus size={11} className="text-gray-300 flex-shrink-0" />;
}
function Row({ label, ind, unit = "", invertSurprise = false, warn = false, consensus = null, surpriseVsCons = null, tooltip = null }: {
function Row({ label, ind, unit = "", invertSurprise = false, warn = false, consensus = null, surpriseVsCons = null, tooltip = null, info = null }: {
label: string; ind: Ind | null; unit?: string; invertSurprise?: boolean; warn?: boolean;
consensus?: number | null;
surpriseVsCons?: number | null;
tooltip?: string | null;
info?: string | null; // petit "i" avec tooltip sur le label
}) {
const value = ind?.value ?? null;
const prev = ind?.prev ?? null;
@@ -94,7 +95,9 @@ function Row({ label, ind, unit = "", invertSurprise = false, warn = false, cons
<div className="flex items-center gap-1.5 min-w-0">
<TrendIcon trend={ind?.trend ?? null} />
<span className="text-xs text-gray-500 truncate">
{label}{warn && <span className="text-amber-400 ml-0.5"></span>}
{label}
{warn && <span className="text-amber-400 ml-0.5"></span>}
{info && <span className="text-blue-300 ml-0.5 text-[9px] cursor-help" title={info}></span>}
</span>
</div>
<span className={`text-xs font-semibold tabular-nums flex-shrink-0 ${valCls}`} title={tooltip ?? undefined}>
@@ -380,7 +383,7 @@ export default function CurrencyCard({ currency, expectations, yields, sentiment
{(inflFilter === "all" || inflFilter === "mom") && (
<>
<Row label="PPI MoM" ind={inds?.ppiMoM ?? null} unit="%" />
<Row label="CPI MoM" ind={inds?.cpiMoM ?? null} unit="%" consensus={fc?.cpiMoM ?? null} />
<Row label="CPI MoM" ind={inds?.cpiMoM ?? null} unit="%" consensus={fc?.cpiMoM ?? null} info="Source : Inflation Rate MoM (TradingEconomics)" />
<Row
label={(() => {
const isQoQ = (inds?.cpiCoreMoM as (Ind & { isQoQ?: boolean }) | null)?.isQoQ;
+10 -12
View File
@@ -246,21 +246,19 @@ export async function fetchTECoreCPIMoM(): Promise<MoMCPIMap> {
const MONTHS: Record<string, string> = { January:"01",February:"02",March:"03",April:"04",May:"05",June:"06",July:"07",August:"08",September:"09",October:"10",November:"11",December:"12" };
const QUARTERS: Record<string, string> = { first:"01",second:"04",third:"07",fourth:"10" };
const curYear = new Date().getFullYear().toString();
// 1) "in [Month] of [Year]" ou "in [Month] from ... [Year]"
const dateM = desc.match(/in\s+([A-Za-z]+)\s+(?:of\s+)?(\d{4})/i);
// 2) Trimestriel : "in the fourth quarter of 2025"
const dateQ = desc.match(/in\s+the\s+(first|second|third|fourth)\s+quarter\s+of\s+(\d{4})/i);
// 3) Mois sans année : "remained unchanged at X points in March."
const dateNoYear = desc.match(/in\s+(January|February|March|April|May|June|July|August|September|October|November|December)[\s.,]/i);
// Mois courant = premier "to/at X [points/percent] in [Month]" dans la description
const dateCurrM = desc.match(/(?:to|at)\s+[\d.]+\s+(?:points?|percent)\s+in\s+([A-Za-z]+)/i);
// Année = "of [Year]" n'importe où
const yearM = desc.match(/\bof\s+(\d{4})\b/);
// Trimestriel NZD
const dateQ = desc.match(/in\s+the\s+(first|second|third|fourth)\s+quarter\s+of\s+(\d{4})/i);
let refMonth = "";
if (dateM && MONTHS[dateM[1]]) {
refMonth = `${dateM[2]}-${MONTHS[dateM[1]]}-01`;
} else if (dateQ) {
if (dateQ) {
refMonth = `${dateQ[2]}-${QUARTERS[dateQ[1].toLowerCase()]}-01`;
} else if (dateNoYear) {
const mn = dateNoYear[1];
} else if (dateCurrM) {
const mn = dateCurrM[1];
const cap = mn.charAt(0).toUpperCase() + mn.slice(1).toLowerCase();
if (MONTHS[cap]) refMonth = `${curYear}-${MONTHS[cap]}-01`;
if (MONTHS[cap]) refMonth = `${yearM?.[1] ?? curYear}-${MONTHS[cap]}-01`;
}
const entry: MoMCPIEntry = {
value: parsed.value,
+1 -1
View File
File diff suppressed because one or more lines are too long