- Add PostgreSQL database with Prisma ORM - Trade model: tracks entry/exit, P&L, order signatures, config snapshots - PriceUpdate model: tracks price movements for drawdown analysis - SystemEvent model: logs errors and system events - DailyStats model: aggregated performance metrics - Implement dual stop loss system (enabled by default) - Soft stop (TRIGGER_LIMIT) at -1.5% to avoid wicks - Hard stop (TRIGGER_MARKET) at -2.5% to guarantee exit - Configurable via USE_DUAL_STOPS, SOFT_STOP_PERCENT, HARD_STOP_PERCENT - Backward compatible with single stop modes - Add database service layer (lib/database/trades.ts) - createTrade(): save new trades with all details - updateTradeExit(): close trades with P&L calculations - addPriceUpdate(): track price movements during trade - getTradeStats(): calculate win rate, profit factor, avg win/loss - logSystemEvent(): log errors and system events - Update execute endpoint to use dual stops and save to database - Calculate dual stop prices when enabled - Pass dual stop parameters to placeExitOrders - Save complete trade record to database after execution - Add test trade button to settings page - New /api/trading/test endpoint for executing test trades - Displays detailed results including dual stop prices - Confirmation dialog before execution - Shows entry price, position size, stops, and TX signature - Generate Prisma client in Docker build - Update DATABASE_URL for container networking
38 lines
941 B
JSON
38 lines
941 B
JSON
{
|
|
"name": "trading-bot-v4",
|
|
"version": "4.0.0",
|
|
"description": "Autonomous Trading Bot v4 with Drift Protocol and Pyth Network integration",
|
|
"private": true,
|
|
"scripts": {
|
|
"dev": "next dev",
|
|
"build": "next build",
|
|
"start": "next start",
|
|
"lint": "next lint"
|
|
},
|
|
"dependencies": {
|
|
"@drift-labs/sdk": "^2.75.0",
|
|
"@prisma/client": "^6.18.0",
|
|
"@pythnetwork/hermes-client": "^1.0.0",
|
|
"@pythnetwork/price-service-client": "^1.3.0",
|
|
"@solana/web3.js": "^1.91.1",
|
|
"autoprefixer": "^10.4.21",
|
|
"bs58": "^5.0.0",
|
|
"next": "^15.0.0",
|
|
"postcss": "^8.5.6",
|
|
"prisma": "^6.18.0",
|
|
"react": "^18.3.0",
|
|
"react-dom": "^18.3.0",
|
|
"tailwindcss": "^3.4.1"
|
|
},
|
|
"devDependencies": {
|
|
"@types/bn.js": "^5.2.0",
|
|
"@types/node": "^20.11.0",
|
|
"@types/react": "^18.2.0",
|
|
"@types/react-dom": "^18.2.0",
|
|
"typescript": "^5.3.0"
|
|
},
|
|
"engines": {
|
|
"node": ">=20.0.0"
|
|
}
|
|
}
|