Fix database persistence and add analytics
- Fixed Prisma client not being available in Docker container - Added isTestTrade flag to exclude test trades from analytics - Created analytics views for net positions (matches Drift UI netting) - Added API endpoints: /api/analytics/positions and /api/analytics/stats - Added test trade endpoint: /api/trading/test-db - Updated Dockerfile to properly copy Prisma client from builder stage - Database now successfully stores all trades with full details - Supports position netting calculations to match Drift perpetuals behavior
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Trade" ADD COLUMN "isTestTrade" BOOLEAN NOT NULL DEFAULT false;
|
||||
@@ -68,6 +68,7 @@ model Trade {
|
||||
|
||||
// Status
|
||||
status String @default("open") // "open", "closed", "failed"
|
||||
isTestTrade Boolean @default(false) // Flag test trades for exclusion from analytics
|
||||
|
||||
// Relations
|
||||
priceUpdates PriceUpdate[]
|
||||
|
||||
Reference in New Issue
Block a user