From cbdb2b2e1c2ca7e590aef9c2c219cf3fbf6541ac Mon Sep 17 00:00:00 2001 From: tinkle Date: Thu, 30 Oct 2025 18:11:15 +0800 Subject: [PATCH] UI: Display position details in Trade History MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Frontend changes: - Update TradeOutcome interface with new fields: - quantity: Position size - leverage: Leverage multiplier - position_value: Total position value - margin_used: Margin required - Add position details display in trade cards: - Quantity (with 4 decimal precision) - Leverage (shown as "50x") - Position Value (shown as "$10000.00") - Margin Used (shown as "$200.00") Visual design: - 2x2 grid layout for position details - Color coding: Leverage in gold, Margin in purple - Conditional rendering with fallback "-" for missing data 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- web/src/components/AILearning.tsx | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/web/src/components/AILearning.tsx b/web/src/components/AILearning.tsx index 8ef1a840..20da61d2 100644 --- a/web/src/components/AILearning.tsx +++ b/web/src/components/AILearning.tsx @@ -6,8 +6,12 @@ import { api } from '../lib/api'; interface TradeOutcome { symbol: string; side: string; + quantity: number; + leverage: number; open_price: number; close_price: number; + position_value: number; + margin_used: number; pn_l: number; pn_l_pct: number; duration: string; @@ -558,6 +562,34 @@ export default function AILearning({ traderId }: AILearningProps) { + {/* Position Details */} +
+
+
Quantity
+
+ {trade.quantity ? trade.quantity.toFixed(4) : '-'} +
+
+
+
Leverage
+
+ {trade.leverage ? `${trade.leverage}x` : '-'} +
+
+
+
Position Value
+
+ {trade.position_value ? `$${trade.position_value.toFixed(2)}` : '-'} +
+
+
+
Margin Used
+
+ {trade.margin_used ? `$${trade.margin_used.toFixed(2)}` : '-'} +
+
+
+