cleaned up web-app
This commit is contained in:
parent
805ce0ebf1
commit
3843dc95a3
21 changed files with 105 additions and 2420 deletions
|
|
@ -46,15 +46,32 @@ export const BacktestChart = memo(function BacktestChart({ result, isLoading }:
|
|||
|
||||
// Find trades for this symbol
|
||||
const symbolTrades = result.trades?.filter(t => t.symbol === symbol) || [];
|
||||
console.log('Symbol trades for', symbol, ':', symbolTrades);
|
||||
|
||||
const tradeMarkers = symbolTrades
|
||||
.filter(trade => trade.entryPrice != null && trade.entryDate != null)
|
||||
.map(trade => ({
|
||||
time: new Date(trade.entryDate).getTime() / 1000,
|
||||
position: 'belowBar' as const,
|
||||
color: trade.side === 'buy' ? '#10b981' : '#ef4444',
|
||||
shape: trade.side === 'buy' ? 'arrowUp' : 'arrowDown' as const,
|
||||
text: `${trade.side === 'buy' ? 'Buy' : 'Sell'} @ $${trade.entryPrice.toFixed(2)}`
|
||||
}));
|
||||
.filter(trade => {
|
||||
// Check multiple possible field names
|
||||
const hasPrice = trade.price != null || trade.entryPrice != null;
|
||||
const hasTime = trade.timestamp != null || trade.entryDate != null || trade.date != null;
|
||||
return hasPrice && hasTime;
|
||||
})
|
||||
.map(trade => {
|
||||
// Use whatever field names are present
|
||||
const price = trade.price || trade.entryPrice;
|
||||
const timestamp = trade.timestamp || trade.entryDate || trade.date;
|
||||
const side = trade.side || (trade.quantity > 0 ? 'buy' : 'sell');
|
||||
|
||||
return {
|
||||
time: new Date(timestamp).getTime() / 1000,
|
||||
position: 'belowBar' as const,
|
||||
color: side === 'buy' ? '#10b981' : '#ef4444',
|
||||
shape: (side === 'buy' ? 'arrowUp' : 'arrowDown') as const,
|
||||
text: `${side === 'buy' ? 'Buy' : 'Sell'} @ $${price.toFixed(2)}`,
|
||||
price: price
|
||||
};
|
||||
});
|
||||
|
||||
console.log('Trade markers:', tradeMarkers);
|
||||
|
||||
const processedOhlcData = ohlcData
|
||||
.filter(d => d && d.timestamp != null && d.open != null && d.high != null && d.low != null && d.close != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue