Implement pure Drift Protocol automation system
- Remove Jupiter DEX completely from automation system - Implement exclusive Drift Protocol integration with up to 100x leverage - Update executeLiveTrade method to use only Drift API endpoints - Change default DEX provider from Jupiter to Drift - Create minimal professional UI without promotional banners - Add comprehensive leverage options (1x-100x) with risk indicators - Update automation service to route all trades through /api/automation/trade - Fix type definitions to support Drift-only configuration - Add multiple trading pairs support (SOL, BTC, ETH, APT, AVAX, DOGE) - Implement clean configuration interface with essential controls - Remove excessive marketing text and promotional elements - Maintain full automation functionality while simplifying UX
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
const { PrismaClient } = require('@prisma/client')
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
async function testPnLCalculation() {
|
||||
try {
|
||||
const trades = await prisma.trade.findMany({
|
||||
orderBy: { createdAt: 'desc' },
|
||||
take: 3
|
||||
})
|
||||
|
||||
const currentPrice = 175.82
|
||||
|
||||
console.log('=== P&L CALCULATION TEST ===')
|
||||
trades.forEach((trade, i) => {
|
||||
const pnl = trade.status === 'COMPLETED' ?
|
||||
((trade.side === 'BUY' ? (currentPrice - trade.price) * trade.amount : (trade.price - currentPrice) * trade.amount)) :
|
||||
0
|
||||
|
||||
console.log(`\nTrade ${i + 1}:`)
|
||||
console.log(` Side: ${trade.side}`)
|
||||
console.log(` Amount: ${trade.amount}`)
|
||||
console.log(` Price: ${trade.price}`)
|
||||
console.log(` Status: ${trade.status}`)
|
||||
console.log(` Current Price: ${currentPrice}`)
|
||||
console.log(` Price Diff: ${currentPrice - trade.price}`)
|
||||
console.log(` Raw P&L: ${pnl}`)
|
||||
console.log(` Formatted P&L: ${pnl.toFixed(2)}`)
|
||||
})
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error:', error)
|
||||
} finally {
|
||||
await prisma.$disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
testPnLCalculation()
|
||||
|
||||
Reference in New Issue
Block a user