From cbb6592153e2c8cbac70bd7745a56d86356b6b61 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Wed, 5 Nov 2025 07:58:27 +0100 Subject: [PATCH] fix: correct PnL math and add health probe --- app/api/health/route.ts | 16 ++++++++++++++++ app/api/trading/execute/route.ts | 7 ++++--- lib/drift/orders.ts | 11 +++++------ lib/trading/position-manager.ts | 17 ++++++++--------- 4 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 app/api/health/route.ts diff --git a/app/api/health/route.ts b/app/api/health/route.ts new file mode 100644 index 0000000..d143f33 --- /dev/null +++ b/app/api/health/route.ts @@ -0,0 +1,16 @@ +import { NextResponse } from 'next/server' + +/** + * Health check endpoint for Docker HEALTHCHECK + * Returns 200 OK if the server is running + */ +export async function GET() { + return NextResponse.json( + { + status: 'healthy', + timestamp: new Date().toISOString(), + uptime: process.uptime(), + }, + { status: 200 } + ) +} diff --git a/app/api/trading/execute/route.ts b/app/api/trading/execute/route.ts index ecb6f30..f49a47c 100644 --- a/app/api/trading/execute/route.ts +++ b/app/api/trading/execute/route.ts @@ -240,9 +240,10 @@ export async function POST(request: NextRequest): Promise