- Fixed entryPrice field mapping from currentPrice to entryPrice - Added proper position size mapping using realTradingAmount/tradingAmount - Added side (BUY/SELL) direction field to execution details - Fixed amount field for position size display - All trade execution details now populated with real data: * Entry Price: 88.6771 * Position Size: 9 * Direction: BUY * Leverage: 3x * Stop Loss: 74.50 * Take Profit: 76.50
64 lines
3.0 KiB
JavaScript
64 lines
3.0 KiB
JavaScript
// Test the specific values that should be displayed
|
|
const testDisplayValues = async () => {
|
|
try {
|
|
console.log('🔍 Testing display values for missing data fields...\n');
|
|
|
|
// Get the analysis data
|
|
const analysisResponse = await fetch('http://localhost:9001/api/automation/analysis-details');
|
|
const analysisData = await analysisResponse.json();
|
|
|
|
if (analysisData.success) {
|
|
const analysis = analysisData.data.analysis;
|
|
const recentTrade = analysisData.data.recentTrades?.[0];
|
|
|
|
console.log('📊 Analysis Data:');
|
|
console.log('- Decision:', analysis.decision);
|
|
console.log('- Confidence:', analysis.confidence + '%');
|
|
console.log('- Entry Price:', '$' + (analysis.entry?.price || 'N/A'));
|
|
console.log('- Stop Loss:', '$' + (analysis.stopLoss?.price || 'N/A'));
|
|
console.log('- Take Profit:', '$' + (analysis.takeProfits?.tp1?.price || 'N/A'));
|
|
|
|
console.log('\n💰 Recent Trade Data:');
|
|
if (recentTrade) {
|
|
console.log('- Entry Price:', '$' + (recentTrade.entryPrice || recentTrade.price || 'N/A'));
|
|
console.log('- Position Size:', '$' + (recentTrade.positionSize || recentTrade.amount || 'N/A'));
|
|
console.log('- Trading Amount:', '$' + (recentTrade.realTradingAmount || recentTrade.tradingAmount || 'N/A'));
|
|
console.log('- Side:', recentTrade.side || 'N/A');
|
|
console.log('- Leverage:', (recentTrade.leverage || 'N/A') + 'x');
|
|
console.log('- Status:', recentTrade.status || 'N/A');
|
|
} else {
|
|
console.log('No recent trade found');
|
|
}
|
|
|
|
// Simulate the execution details object
|
|
console.log('\n🎯 Execution Details Object (as component would create):');
|
|
if (recentTrade) {
|
|
const executionDetails = {
|
|
leverage: recentTrade.leverage || 3,
|
|
entryPrice: recentTrade.entryPrice || recentTrade.price,
|
|
stopLoss: analysis.stopLoss?.price || 185.50,
|
|
takeProfit: analysis.takeProfits?.tp1?.price || 193.00,
|
|
positionSize: recentTrade.positionSize || recentTrade.amount || 15.2,
|
|
side: recentTrade.side || 'BUY',
|
|
amount: recentTrade.realTradingAmount || recentTrade.tradingAmount || recentTrade.actualInvestment
|
|
};
|
|
|
|
console.log('Execution Details:', JSON.stringify(executionDetails, null, 2));
|
|
|
|
console.log('\n📋 Display Values:');
|
|
console.log('- Entry Price Display:', '$' + (executionDetails.entryPrice?.toFixed(4) || 'N/A'));
|
|
console.log('- Position Size Display:', '$' + (executionDetails.amount || 'N/A'));
|
|
console.log('- Direction Display:', executionDetails.side || 'N/A');
|
|
console.log('- Leverage Display:', (executionDetails.leverage || 'N/A') + 'x');
|
|
console.log('- Stop Loss Display:', '$' + (executionDetails.stopLoss?.toFixed(4) || 'N/A'));
|
|
console.log('- Take Profit Display:', '$' + (executionDetails.takeProfit?.toFixed(4) || 'N/A'));
|
|
}
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('❌ Error testing display values:', error);
|
|
}
|
|
};
|
|
|
|
testDisplayValues();
|