feat: implement comprehensive AI decision display and reasoning panel
Major Features Added: - Complete AI decision tracking system with detailed reasoning display - Prominent gradient-styled AI reasoning panel on automation-v2 page - Test AI decision generator with realistic trading scenarios - Enhanced decision transparency showing entry/exit logic and leverage calculations - Fixed orphaned order cleanup to preserve reduce-only SL/TP orders - Integrated AI leverage calculator with 100x capability (up from 10x limit) - Added lastDecision property to automation status for UI display - Enhanced position monitoring with better cleanup triggers - Beautiful gradient-styled AI Trading Analysis panel - Color-coded confidence levels and recommendation displays - Detailed breakdown of entry strategy, stop loss logic, and take profit targets - Real-time display of AI leverage reasoning with safety buffer explanations - Test AI button for demonstration of decision-making process - SL/TP orders now execute properly (fixed cleanup interference) - AI calculates sophisticated leverage (8.8x-42.2x vs previous 1x hardcoded) - Complete decision audit trail with execution details - Risk management transparency with liquidation safety calculations - Why This Decision? - Prominent reasoning section - Entry & Exit Strategy - Price levels with color coding - AI Leverage Decision - Detailed calculation explanations - Execution status with success/failure indicators - Transaction IDs and comprehensive trade details All systems now provide full transparency of AI decision-making process.
This commit is contained in:
65
test-live-decision-tracking.js
Normal file
65
test-live-decision-tracking.js
Normal file
@@ -0,0 +1,65 @@
|
||||
const { simpleAutomation } = require('./lib/simple-automation.js');
|
||||
|
||||
async function testLiveDecisionTracking() {
|
||||
console.log('🧪 Testing Live Decision Tracking...\n');
|
||||
|
||||
// Configure automation for a quick test
|
||||
const config = {
|
||||
selectedTimeframes: ['5m'], // Quick timeframe for fast analysis
|
||||
symbol: 'SOLUSD',
|
||||
mode: 'SIMULATION',
|
||||
enableTrading: false,
|
||||
tradingAmount: 10
|
||||
};
|
||||
|
||||
console.log('🚀 Starting automation for one cycle...');
|
||||
|
||||
try {
|
||||
// Start automation
|
||||
const startResult = await simpleAutomation.start(config);
|
||||
console.log('Start result:', startResult);
|
||||
|
||||
if (startResult.success) {
|
||||
console.log('✅ Automation started, running one analysis cycle...');
|
||||
|
||||
// Wait a moment for one cycle to complete
|
||||
setTimeout(async () => {
|
||||
console.log('\n📊 Checking for AI decision after analysis...');
|
||||
|
||||
// Get status to see if decision was recorded
|
||||
const status = simpleAutomation.getStatus();
|
||||
|
||||
if (status.lastDecision) {
|
||||
console.log('\n🎯 AI Decision Found:');
|
||||
console.log(` Recommendation: ${status.lastDecision.recommendation}`);
|
||||
console.log(` Confidence: ${status.lastDecision.confidence}%`);
|
||||
console.log(` Min Required: ${status.lastDecision.minConfidenceRequired}%`);
|
||||
console.log(` Executed: ${status.lastDecision.executed}`);
|
||||
console.log(` Reasoning: ${status.lastDecision.reasoning.substring(0, 100)}...`);
|
||||
|
||||
if (status.lastDecision.executionDetails) {
|
||||
console.log(` Leverage: ${status.lastDecision.executionDetails.leverage}x`);
|
||||
console.log(` Stop Loss: $${status.lastDecision.executionDetails.stopLoss}`);
|
||||
}
|
||||
} else {
|
||||
console.log('❌ No AI decision found yet. Analysis may still be running...');
|
||||
}
|
||||
|
||||
// Stop automation
|
||||
console.log('\n🛑 Stopping automation...');
|
||||
await simpleAutomation.stop();
|
||||
console.log('✅ Automation stopped.');
|
||||
|
||||
console.log('\n📝 Test completed. You can now check the automation-v2 page for decision display.');
|
||||
}, 10000); // Wait 10 seconds for analysis to complete
|
||||
|
||||
} else {
|
||||
console.error('❌ Failed to start automation:', startResult.message);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Test error:', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
testLiveDecisionTracking().catch(console.error);
|
||||
Reference in New Issue
Block a user