Files
forex-dashboard/app/api/rate-probabilities/route.ts
T

24 lines
853 B
TypeScript
Raw Normal View History

2026-06-01 23:24:32 +02:00
import { NextResponse } from "next/server";
import { fetchAllCBPaths } from "@/lib/rateprobability";
import type { RateProbData } from "@/lib/rateprobability";
export const dynamic = "force-dynamic";
export const preferredRegion = ["fra1", "lhr1", "cdg1"]; // Europe (Frankfurt / London / Paris)
2026-06-01 23:24:32 +02:00
export type { RateProbData, CBRatePath, RateProbMeeting } from "@/lib/rateprobability";
export interface RateProbabilitiesResponse {
data: RateProbData;
fetchedAt: string;
}
export async function GET() {
const data = await fetchAllCBPaths();
const currencies = Object.keys(data);
console.log(`[rate-prob] fetched ${currencies.length} CBs: ${currencies.join(", ")}`);
2026-06-01 23:24:32 +02:00
return NextResponse.json(
{ data, fetchedAt: new Date().toISOString() } satisfies RateProbabilitiesResponse,
{ headers: { "Cache-Control": "no-store" } }
2026-06-01 23:24:32 +02:00
);
}