mirror of
https://github.com/RomySaputraSihananda/ares.git
synced 2026-08-15 11:48:07 +00:00
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
19 lines
673 B
TypeScript
19 lines
673 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { NextRequest } from "next/server";
|
|
import { getDeals } from "@/lib/mt5";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function GET(req: NextRequest) {
|
|
const { searchParams } = req.nextUrl;
|
|
const dateFrom = searchParams.get("date_from") ?? "2026-06-01T00:00:00";
|
|
const dateTo = searchParams.get("date_to") ?? new Date().toISOString().slice(0, 19);
|
|
const symbol = searchParams.get("symbol") ?? undefined;
|
|
try {
|
|
const data = await getDeals(dateFrom, dateTo, symbol);
|
|
return NextResponse.json(data);
|
|
} catch (e) {
|
|
return NextResponse.json({ error: String(e) }, { status: 502 });
|
|
}
|
|
}
|