Implement working Drift leverage trading

Key Features:
-  Drift SDK v2.126.0-beta.14 integration with Helius RPC
-  User account initialization and balance reading
-  Leverage trading API with real trades executed
-  Support for SOL, BTC, ETH, APT, AVAX, BNB, MATIC, ARB, DOGE, OP
-  Transaction confirmed: gNmaWVqcE4qNK31ksoUsK6pcHqdDTaUtJXY52ZoXRF

API Endpoints:
- POST /api/drift/trade - Main trading endpoint
- Actions: get_balance, place_order
- Successfully tested with 0.01 SOL buy order at 2x leverage

Technical Fixes:
- Fixed RPC endpoint blocking with Helius API key
- Resolved wallet signing compatibility issues
- Implemented proper BigNumber handling for amounts
- Added comprehensive error handling and logging

Trading Bot Status: 🚀 FULLY OPERATIONAL with leverage trading!
This commit is contained in:
mindesbunister
2025-07-22 12:23:51 +02:00
parent 491ff51ba9
commit fb194f1b12
28 changed files with 7285 additions and 198 deletions

20
test-cleanup.js Normal file
View File

@@ -0,0 +1,20 @@
// Test aggressive cleanup behavior in development mode
const aggressiveCleanup = require('./lib/aggressive-cleanup.ts').default;
console.log('Testing aggressive cleanup in development mode...');
console.log('NODE_ENV:', process.env.NODE_ENV);
// Test the startup
aggressiveCleanup.startPeriodicCleanup();
// Test post-analysis cleanup
console.log('\nTesting post-analysis cleanup...');
aggressiveCleanup.runPostAnalysisCleanup().then(() => {
console.log('Post-analysis cleanup completed');
}).catch(console.error);
// Test manual cleanup
console.log('\nTesting manual cleanup...');
aggressiveCleanup.cleanupOrphanedProcesses().then(() => {
console.log('Manual cleanup completed');
}).catch(console.error);