Features: - Autonomous trading system with Drift Protocol on Solana - Real-time position monitoring with Pyth price feeds - Dynamic stop-loss and take-profit management - n8n workflow integration for TradingView signals - Beautiful web UI for settings management - REST API for trade execution and monitoring - Next.js 15 with standalone output mode - TypeScript with strict typing - Docker containerization with multi-stage builds - PostgreSQL database for trade history - Singleton pattern for Drift client connection pooling - BN.js for BigNumber handling (Drift SDK requirement) - Configurable stop-loss and take-profit levels - Breakeven trigger and profit locking - Daily loss limits and trade cooldowns - Slippage tolerance controls - DRY_RUN mode for safe testing - Real-time risk calculator - Interactive sliders for all parameters - Live preview of trade outcomes - Position sizing and leverage controls - Beautiful gradient design with Tailwind CSS - POST /api/trading/execute - Execute trades - POST /api/trading/close - Close positions - GET /api/trading/positions - Monitor active trades - GET /api/trading/check-risk - Validate trade signals - GET /api/settings - View configuration - POST /api/settings - Update configuration - Fixed Borsh serialization errors (simplified order params) - Resolved RPC rate limiting with singleton pattern - Fixed BigInt vs BN type mismatches - Corrected order execution flow - Improved position state management - Complete setup guides - Docker deployment instructions - n8n workflow configuration - API reference documentation - Risk management guidelines - Runs on port 3001 (external), 3000 (internal) - Uses Helius RPC for optimal performance - Production-ready with error handling - Health monitoring and logging
100 lines
2.1 KiB
JSON
100 lines
2.1 KiB
JSON
{
|
|
"name": "Trader",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"httpMethod": "POST",
|
|
"path": "3371ad7c-0866-4161-90a4-f251de4aceb8",
|
|
"options": {}
|
|
},
|
|
"id": "683db7ad-2df6-44c7-afaa-d2f40705f268",
|
|
"name": "Webhook",
|
|
"type": "n8n-nodes-base.webhook",
|
|
"typeVersion": 1,
|
|
"position": [
|
|
500,
|
|
460
|
|
],
|
|
"webhookId": "3371ad7c-0866-4161-90a4-f251de4aceb8"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"chatId": "579304651",
|
|
"text": "={{ $json.signal.startsWith(\"Buy\") ? \"🟢 \" + $json.signal : \"🔴 \" + $json.signal }}\n",
|
|
"additionalFields": {
|
|
"appendAttribution": false
|
|
}
|
|
},
|
|
"id": "e9caf28b-5731-46ba-bb31-b152fde4bae5",
|
|
"name": "Telegram",
|
|
"type": "n8n-nodes-base.telegram",
|
|
"typeVersion": 1.1,
|
|
"position": [
|
|
1300,
|
|
460
|
|
],
|
|
"credentials": {
|
|
"telegramApi": {
|
|
"id": "Csk5cg4HtaSqP5jJ",
|
|
"name": "Telegram account"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"parameters": {
|
|
"fields": {
|
|
"values": [
|
|
{
|
|
"name": "signal",
|
|
"stringValue": "={{ $json.body.split('|')[0].trim() }}"
|
|
}
|
|
]
|
|
},
|
|
"options": {}
|
|
},
|
|
"id": "1844fbcb-282b-4b01-9744-b21adda235e9",
|
|
"name": "Edit Fields",
|
|
"type": "n8n-nodes-base.set",
|
|
"typeVersion": 3.2,
|
|
"position": [
|
|
860,
|
|
460
|
|
]
|
|
}
|
|
],
|
|
"pinData": {},
|
|
"connections": {
|
|
"Webhook": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Edit Fields",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Edit Fields": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Telegram",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"active": true,
|
|
"settings": {
|
|
"executionOrder": "v1"
|
|
},
|
|
"versionId": "b35ed14e-bd11-4601-a304-6263832f11b4",
|
|
"id": "Bg1iplLiwLdVexG1",
|
|
"meta": {
|
|
"instanceId": "e766d4f0b5def8ee8cb8561cd9d2b9ba7733e1907990b6987bca40175f82c379"
|
|
},
|
|
"tags": []
|
|
} |