✅ 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:
@@ -1,58 +0,0 @@
|
||||
const { PrismaClient } = require('@prisma/client')
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
async function checkDatabase() {
|
||||
try {
|
||||
console.log('=== DATABASE VERIFICATION ===')
|
||||
|
||||
// Count total trades
|
||||
const totalTrades = await prisma.trade.count()
|
||||
console.log(`Total trades in database: ${totalTrades}`)
|
||||
|
||||
// Get all trades with details
|
||||
const allTrades = await prisma.trade.findMany({
|
||||
orderBy: { createdAt: 'desc' }
|
||||
})
|
||||
|
||||
console.log('\n=== ALL TRADES ===')
|
||||
allTrades.forEach((trade, index) => {
|
||||
console.log(`\nTrade ${index + 1}:`)
|
||||
console.log(` ID: ${trade.id}`)
|
||||
console.log(` Symbol: ${trade.symbol}`)
|
||||
console.log(` Side: ${trade.side}`)
|
||||
console.log(` Amount: ${trade.amount}`)
|
||||
console.log(` Price: ${trade.price}`)
|
||||
console.log(` Status: ${trade.status}`)
|
||||
console.log(` Created: ${trade.createdAt}`)
|
||||
console.log(` Profit: ${trade.profit}`)
|
||||
console.log(` Confidence: ${trade.confidence}`)
|
||||
})
|
||||
|
||||
// Check automation sessions
|
||||
const totalSessions = await prisma.automationSession.count()
|
||||
console.log(`\n=== AUTOMATION SESSIONS ===`)
|
||||
console.log(`Total sessions: ${totalSessions}`)
|
||||
|
||||
const sessions = await prisma.automationSession.findMany({
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: 5
|
||||
})
|
||||
|
||||
sessions.forEach((session, index) => {
|
||||
console.log(`\nSession ${index + 1}:`)
|
||||
console.log(` ID: ${session.id}`)
|
||||
console.log(` Symbol: ${session.symbol}`)
|
||||
console.log(` Timeframe: ${session.timeframe}`)
|
||||
console.log(` Status: ${session.status}`)
|
||||
console.log(` Created: ${session.createdAt}`)
|
||||
})
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error checking database:', error)
|
||||
} finally {
|
||||
await prisma.$disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
checkDatabase()
|
||||
|
||||
Reference in New Issue
Block a user