fix: TradeFollowUpPanel property mismatch causing position loading error
- Fix property names: size → amount, pnl → unrealizedPnl - Update TradePosition interface to match actual API response - Add missing properties: pnlPercentage, totalValue, timestamp, status, leverage, txId - Resolves 'Error Loading Positions' issue when accessing marked trades - Follow-up assistant now properly displays position information
This commit is contained in:
@@ -7,11 +7,16 @@ interface TradePosition {
|
|||||||
side: 'LONG' | 'SHORT'
|
side: 'LONG' | 'SHORT'
|
||||||
entryPrice: number
|
entryPrice: number
|
||||||
currentPrice: number
|
currentPrice: number
|
||||||
size: number
|
amount: number
|
||||||
pnl: number
|
unrealizedPnl: number
|
||||||
|
pnlPercentage: number
|
||||||
|
totalValue: number
|
||||||
stopLoss?: number
|
stopLoss?: number
|
||||||
takeProfit?: number
|
takeProfit?: number
|
||||||
entryTime: string
|
timestamp: number
|
||||||
|
status: string
|
||||||
|
leverage: number
|
||||||
|
txId: string
|
||||||
entryAnalysis?: string
|
entryAnalysis?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +65,7 @@ export default function TradeFollowUpPanel({ onClose }: TradeFollowUpPanelProps)
|
|||||||
setChatMessages([{
|
setChatMessages([{
|
||||||
id: Date.now().toString(),
|
id: Date.now().toString(),
|
||||||
type: 'system',
|
type: 'system',
|
||||||
content: `🎯 **Trade Follow-up Assistant**\n\nI'm here to help you manage your active ${data.positions[0].symbol} ${data.positions[0].side} position.\n\n**Current Position:**\n• Entry: $${data.positions[0].entryPrice}\n• Size: ${data.positions[0].size}\n• Current P&L: ${data.positions[0].pnl > 0 ? '+' : ''}$${data.positions[0].pnl.toFixed(2)}\n\nAsk me anything about your trade!`,
|
content: `🎯 **Trade Follow-up Assistant**\n\nI'm here to help you manage your active ${data.positions[0].symbol} ${data.positions[0].side} position.\n\n**Current Position:**\n• Entry: $${data.positions[0].entryPrice}\n• Size: ${data.positions[0].amount}\n• Current P&L: ${data.positions[0].unrealizedPnl > 0 ? '+' : ''}$${data.positions[0].unrealizedPnl.toFixed(2)}\n\nAsk me anything about your trade!`,
|
||||||
timestamp: new Date().toISOString()
|
timestamp: new Date().toISOString()
|
||||||
}])
|
}])
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user