initial backtests
This commit is contained in:
parent
fa70ada2bb
commit
5a3a23a2ba
6 changed files with 400 additions and 129 deletions
|
|
@ -13,11 +13,6 @@ interface BacktestResultsProps {
|
|||
}
|
||||
|
||||
export function BacktestResults({ status, results, currentTime }: BacktestResultsProps) {
|
||||
// Debug logging
|
||||
console.log('BacktestResults - results:', results);
|
||||
console.log('BacktestResults - ohlcData keys:', results?.ohlcData ? Object.keys(results.ohlcData) : 'No ohlcData');
|
||||
console.log('BacktestResults - first symbol data:', results?.ohlcData && Object.keys(results.ohlcData).length > 0 ? results.ohlcData[Object.keys(results.ohlcData)[0]] : 'No data');
|
||||
console.log('BacktestResults - equity data:', results?.equity);
|
||||
if (status === 'idle') {
|
||||
return (
|
||||
<div className="bg-surface-secondary p-8 rounded-lg border border-border h-full flex items-center justify-center">
|
||||
|
|
@ -125,14 +120,9 @@ export function BacktestResults({ status, results, currentTime }: BacktestResult
|
|||
const hasOhlcData = results.ohlcData && Object.keys(results.ohlcData).length > 0;
|
||||
const hasEquityData = results.equity && results.equity.length > 0;
|
||||
|
||||
console.log('Chart section - hasOhlcData:', hasOhlcData);
|
||||
console.log('Chart section - hasEquityData:', hasEquityData);
|
||||
|
||||
if (hasOhlcData) {
|
||||
const firstSymbol = Object.keys(results.ohlcData)[0];
|
||||
const ohlcData = results.ohlcData[firstSymbol];
|
||||
console.log('Chart section - using OHLC data for symbol:', firstSymbol);
|
||||
console.log('Chart section - OHLC data points:', ohlcData?.length);
|
||||
|
||||
return (
|
||||
<Chart
|
||||
|
|
@ -156,7 +146,6 @@ export function BacktestResults({ status, results, currentTime }: BacktestResult
|
|||
/>
|
||||
);
|
||||
} else if (hasEquityData) {
|
||||
console.log('Chart section - using equity data only');
|
||||
return (
|
||||
<Chart
|
||||
data={results.equity.map(point => ({
|
||||
|
|
@ -171,7 +160,6 @@ export function BacktestResults({ status, results, currentTime }: BacktestResult
|
|||
/>
|
||||
);
|
||||
} else {
|
||||
console.log('Chart section - showing no data message');
|
||||
return (
|
||||
<div className="h-96 bg-background rounded border border-border flex items-center justify-center">
|
||||
<p className="text-sm text-text-muted">
|
||||
|
|
@ -190,13 +178,13 @@ export function BacktestResults({ status, results, currentTime }: BacktestResult
|
|||
Trade History
|
||||
</h3>
|
||||
<TradeLog trades={results.trades.map(trade => ({
|
||||
id: crypto.randomUUID(),
|
||||
timestamp: trade.entryDate,
|
||||
id: trade.id,
|
||||
timestamp: trade.exitDate || trade.entryDate,
|
||||
symbol: trade.symbol,
|
||||
side: 'buy' as const,
|
||||
side: trade.side as 'buy' | 'sell',
|
||||
quantity: trade.quantity,
|
||||
price: trade.entryPrice,
|
||||
commission: 0,
|
||||
price: trade.exitPrice,
|
||||
commission: trade.commission,
|
||||
pnl: trade.pnl
|
||||
}))} />
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue