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:
25
debug-pnl.js
25
debug-pnl.js
@@ -1,25 +0,0 @@
|
||||
// Debug P&L calculation
|
||||
const currentPrice = 175.82
|
||||
|
||||
// Example trade from database
|
||||
const trade = {
|
||||
side: 'BUY',
|
||||
amount: 2.04,
|
||||
price: 100.3703837088441,
|
||||
status: 'COMPLETED'
|
||||
}
|
||||
|
||||
console.log('=== P&L CALCULATION DEBUG ===')
|
||||
console.log(`Trade: ${trade.side} ${trade.amount} @ $${trade.price}`)
|
||||
console.log(`Current Price: $${currentPrice}`)
|
||||
console.log(`Price Difference: $${currentPrice - trade.price}`)
|
||||
console.log(`Expected P&L: $${(currentPrice - trade.price) * trade.amount}`)
|
||||
|
||||
// Check if logic is working
|
||||
const priceChange = trade.side === 'BUY' ?
|
||||
(currentPrice - trade.price) :
|
||||
(trade.price - currentPrice)
|
||||
const realizedPnL = trade.status === 'COMPLETED' ? priceChange * trade.amount : null
|
||||
|
||||
console.log(`Calculated P&L: $${realizedPnL}`)
|
||||
console.log(`Should be profitable: ${realizedPnL > 0 ? 'YES' : 'NO'}`)
|
||||
|
||||
Reference in New Issue
Block a user