@@ -228,7 +221,6 @@ function StrategyDetailView({ strategy, stats, trades }) {
- {/* Strategy Config */}
{strategy.config && Object.entries(strategy.config).map(([k, v]) => (
@@ -276,7 +268,6 @@ function StrategyDetailView({ strategy, stats, trades }) {
- {/* Open Positions */}
{s.openPositions.length > 0 && (
Open Positions ({s.openPositions.length})
@@ -284,7 +275,6 @@ function StrategyDetailView({ strategy, stats, trades }) {
)}
- {/* Trade History — only settled trades from DB */}
Trade History ({trades.length})
@@ -349,8 +339,11 @@ function StatBox({ label, value, color }) {
}
function TradeRow({ trade, isOpen }) {
- const won = trade.pnl > 0;
- const pnlColor = trade.pnl == null ? 'text-gray-400' : won ? 'text-green-600' : 'text-red-600';
+ // Fix: Check side vs result for actual win condition, not strictly PNL > 0
+ const won = trade.result && trade.side.toLowerCase() === trade.result.toLowerCase();
+ const isNeutral = trade.result === 'cancelled' || trade.result === 'expired';
+
+ const pnlColor = trade.pnl == null ? 'text-gray-400' : trade.pnl > 0 ? 'text-green-600' : trade.pnl < 0 ? 'text-red-600' : 'text-gray-600';
return (
@@ -359,7 +352,7 @@ function TradeRow({ trade, isOpen }) {
{isOpen ? (
) : (
- {won ? '✅' : '❌'}
+ {isNeutral ? '➖' : won ? '✅' : '❌'}
)}
{trade.side}
@ {trade.price}¢