fix: correct execution details field mappings for missing data
- 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
This commit is contained in:
@@ -98,7 +98,9 @@ Based on comprehensive technical analysis across multiple timeframes:
|
||||
entryPrice: recentTrade.entryPrice || recentTrade.price,
|
||||
stopLoss: analysis.stopLoss?.price || 185.50,
|
||||
takeProfit: analysis.takeProfits?.tp1?.price || 193.00,
|
||||
positionSize: recentTrade.amount || 15.2
|
||||
positionSize: recentTrade.positionSize || recentTrade.amount || 15.2,
|
||||
side: recentTrade.side || 'BUY',
|
||||
amount: recentTrade.realTradingAmount || recentTrade.tradingAmount || recentTrade.actualInvestment
|
||||
} : null,
|
||||
isRetrospective: false
|
||||
}
|
||||
@@ -1101,7 +1103,7 @@ Based on comprehensive technical analysis across multiple timeframes:
|
||||
<div className="bg-blue-900/20 rounded-xl p-4 border border-blue-500/30">
|
||||
<div className="text-blue-400 text-sm mb-1 font-medium">Entry Price</div>
|
||||
<div className="text-white font-mono text-xl font-bold">
|
||||
${status.lastDecision.executionDetails.currentPrice?.toFixed(4)}
|
||||
${status.lastDecision.executionDetails.entryPrice?.toFixed(4)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="bg-green-900/20 rounded-xl p-4 border border-green-500/30">
|
||||
|
||||
Binary file not shown.
63
test-display-values.js
Normal file
63
test-display-values.js
Normal file
@@ -0,0 +1,63 @@
|
||||
// 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();
|
||||
Reference in New Issue
Block a user