diff --git a/app/api/drift/orders/route.js b/app/api/drift/orders/route.js index bb1730c..063d076 100644 --- a/app/api/drift/orders/route.js +++ b/app/api/drift/orders/route.js @@ -60,12 +60,17 @@ export async function GET() { // Get open orders const orders = userAccount.orders || [] - // Show ALL orders for debugging - not just status 0 + // Filter for active orders (status 0 = open) + const activeOrders = orders.filter(order => + order.status === 0 && !order.baseAssetAmount.isZero() + ) + + // Show ALL orders for debugging - not just active ones const allOrders = orders.filter(order => !order.baseAssetAmount.isZero() // Only filter out empty orders ) - console.log(`📋 Found ${allOrders.length} total orders (${orders.length} order slots)`) + console.log(`📋 Found ${activeOrders.length} active orders, ${allOrders.length} total orders (${orders.length} order slots)`) // Debug: log all order statuses const statusCounts = orders.reduce((acc, order) => { @@ -74,7 +79,7 @@ export async function GET() { }, {}) console.log('📊 Order status breakdown:', statusCounts) - const formattedOrders = allOrders.map(order => { + const formattedOrders = activeOrders.map(order => { const marketIndex = order.marketIndex const symbol = ['SOL', 'BTC', 'ETH', 'APT', 'AVAX', 'BNB', 'MATIC', 'ARB', 'DOGE', 'OP'][marketIndex] || `UNKNOWN_${marketIndex}` diff --git a/prisma/prisma/dev.db b/prisma/prisma/dev.db index 6eaa640..54eb031 100644 Binary files a/prisma/prisma/dev.db and b/prisma/prisma/dev.db differ