660 lines
24 KiB
TypeScript
660 lines
24 KiB
TypeScript
import { ArrowLeftIcon, PlusIcon } from '@heroicons/react/24/outline';
|
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
import { Link, useNavigate, useParams } from 'react-router-dom';
|
|
import { isCanonicalRunResult } from '@stock-bot/stock-config/canonical-research';
|
|
import { SaveFindingDialog } from '@/features/research/components/SaveFindingDialog';
|
|
import { catalogExecutionReason } from '@/features/strategies/components/StrategySelection';
|
|
import { useWebSocket } from '@/hooks/useWebSocket';
|
|
import { ArchiveBacktestDialog } from './components/ArchiveBacktestDialog';
|
|
import { BacktestConfiguration } from './components/BacktestConfiguration';
|
|
import { BacktestPlayback } from './components/BacktestPlayback';
|
|
import { BacktestTrades } from './components/BacktestTrades';
|
|
import { CanonicalResults } from './components/CanonicalResults';
|
|
import { CanonicalSetup } from './components/CanonicalSetup';
|
|
import { RunControlsCompact } from './components/RunControlsCompact';
|
|
import { RunDataset } from './components/RunDataset';
|
|
import { RunReproduction } from './components/RunReproduction';
|
|
import { RunsListWithMetrics } from './components/RunsListWithMetrics';
|
|
import { useBacktestV2 } from './hooks/useBacktestV2';
|
|
import type { BacktestConfig } from './types/backtest.types';
|
|
|
|
const baseTabs = [
|
|
{ id: 'runs', name: 'Runs' },
|
|
{ id: 'settings', name: 'Settings' },
|
|
];
|
|
|
|
const runTabs = [
|
|
{ id: 'details', name: 'Details' },
|
|
{ id: 'trades', name: 'Trades' },
|
|
];
|
|
|
|
export function BacktestDetailPageV2() {
|
|
const { id, runId } = useParams<{ id: string; runId?: string }>();
|
|
const navigate = useNavigate();
|
|
const [activeTab, setActiveTab] = useState('details');
|
|
const [showNewRun, setShowNewRun] = useState(false);
|
|
const [showFinding, setShowFinding] = useState(false);
|
|
const [showArchiveDialog, setShowArchiveDialog] = useState(false);
|
|
const [showCanonicalSetup, setShowCanonicalSetup] = useState(false);
|
|
// A visited editor owns drafts and captured dataset retries until this backtest changes.
|
|
const [settingsOwner, setSettingsOwner] = useState<string | null>(null);
|
|
const navigationGeneration = useRef(0);
|
|
|
|
const {
|
|
backtest,
|
|
runs,
|
|
currentRun,
|
|
runResults,
|
|
canonicalCapability,
|
|
capabilityError,
|
|
isCapabilityLoading,
|
|
refreshCanonicalCapability,
|
|
isLoading,
|
|
error,
|
|
submissionError,
|
|
isSubmitting,
|
|
hasPendingSubmission,
|
|
loadBacktest,
|
|
updateBacktest,
|
|
setBacktestArchived,
|
|
createRun,
|
|
cancelRun,
|
|
cancelRequested,
|
|
selectRun,
|
|
refreshRun,
|
|
} = useBacktestV2();
|
|
const archived = Boolean(backtest?.archivedAt);
|
|
const findingResult =
|
|
!isLoading &&
|
|
currentRun?.status === 'completed' &&
|
|
currentRun.id === runId &&
|
|
currentRun.backtestId === id &&
|
|
runResults?.status === 'completed' &&
|
|
runResults.runId === runId &&
|
|
runResults.backtestId === id &&
|
|
backtest?.id === id
|
|
? runResults
|
|
: null;
|
|
const catalog = Boolean(backtest?.strategyVersionId) || backtest?.strategy === 'catalog';
|
|
const unsupportedLegacy = Boolean(backtest && !catalog);
|
|
const executionUnavailable = catalog ? !canonicalCapability?.available : unsupportedLegacy;
|
|
const canSubmit = (!archived && !executionUnavailable) || hasPendingSubmission;
|
|
|
|
// Notifications invalidate the same persisted-state reader used by polling.
|
|
useWebSocket({
|
|
runId:
|
|
currentRun && ['pending', 'running', 'paused'].includes(currentRun.status)
|
|
? currentRun.id
|
|
: null,
|
|
onMessage: message => {
|
|
if (message.type !== 'pong') {
|
|
void refreshRun(message.runId);
|
|
}
|
|
},
|
|
});
|
|
|
|
useEffect(() => {
|
|
navigationGeneration.current++;
|
|
setShowNewRun(false);
|
|
setShowArchiveDialog(false);
|
|
setShowFinding(false);
|
|
return () => {
|
|
navigationGeneration.current++;
|
|
};
|
|
}, [id, runId]);
|
|
|
|
useEffect(() => {
|
|
setSettingsOwner(null);
|
|
setShowCanonicalSetup(false);
|
|
setActiveTab('runs');
|
|
}, [id]);
|
|
|
|
useEffect(() => {
|
|
if (id) {
|
|
void loadBacktest(id);
|
|
}
|
|
}, [id, loadBacktest]);
|
|
|
|
// URL selection is immediate; a new selection invalidates every old continuation.
|
|
useEffect(() => {
|
|
void selectRun(runId);
|
|
setActiveTab(previous => (runId ? (previous === 'runs' ? 'details' : previous) : 'runs'));
|
|
}, [runId, selectRun]);
|
|
|
|
// Handle configuration save
|
|
const handleConfigSubmit = useCallback(
|
|
async (config: BacktestConfig) => {
|
|
if (!id || archived) {
|
|
return;
|
|
}
|
|
|
|
const executionConfig = { ...backtest?.config };
|
|
if (catalog) {
|
|
delete executionConfig.speedMultiplier;
|
|
} else {
|
|
executionConfig.speedMultiplier = config.speedMultiplier;
|
|
}
|
|
await updateBacktest(id, {
|
|
name: config.name,
|
|
strategy: config.strategy,
|
|
...(config.strategyVersionId
|
|
? {
|
|
strategyVersionId: config.strategyVersionId,
|
|
strategyParameters: config.strategyParameters,
|
|
}
|
|
: {}),
|
|
symbols: config.symbols,
|
|
startDate: config.startDate,
|
|
endDate: config.endDate,
|
|
initialCapital: config.initialCapital,
|
|
config: {
|
|
...executionConfig,
|
|
commission: config.commission,
|
|
slippage: config.slippage,
|
|
dataFrequency: config.dataFrequency,
|
|
dataSource: config.dataSource,
|
|
datasetHash: config.datasetHash,
|
|
dataPolicy: {
|
|
adjustment: config.priceAdjustment ?? 'raw',
|
|
timestamp:
|
|
!config.dataFrequency || config.dataFrequency === '1d'
|
|
? 'utc-session-date'
|
|
: 'utc-instant',
|
|
},
|
|
},
|
|
});
|
|
},
|
|
[id, updateBacktest, backtest, archived, catalog]
|
|
);
|
|
|
|
// Handle new run creation
|
|
const handleCreateRun = useCallback(async () => {
|
|
const generation = navigationGeneration.current;
|
|
const newRun = await createRun(null);
|
|
if (newRun && id && generation === navigationGeneration.current) {
|
|
setShowNewRun(false);
|
|
navigate(`/backtests/${id}/run/${newRun.id}`);
|
|
}
|
|
}, [createRun, navigate, id]);
|
|
|
|
// Handle rerun
|
|
const handleRerun = useCallback(
|
|
async (speedMultiplier: number | null) => {
|
|
const generation = navigationGeneration.current;
|
|
const newRun = await createRun(speedMultiplier);
|
|
if (newRun && id && generation === navigationGeneration.current) {
|
|
navigate(`/backtests/${id}/run/${newRun.id}`);
|
|
}
|
|
},
|
|
[createRun, navigate, id]
|
|
);
|
|
|
|
// Convert backtest to config format for the form
|
|
const backtestConfig = useMemo<BacktestConfig | undefined>(
|
|
() =>
|
|
backtest
|
|
? {
|
|
name: backtest.name,
|
|
startDate: backtest.startDate,
|
|
endDate: backtest.endDate,
|
|
initialCapital: backtest.initialCapital,
|
|
symbols: backtest.symbols,
|
|
strategy: backtest.strategy,
|
|
strategyVersionId: backtest.strategyVersionId,
|
|
strategyParameters: backtest.strategyParameters,
|
|
speedMultiplier: 1,
|
|
dataFrequency: (backtest.config?.dataFrequency ??
|
|
'1d') as BacktestConfig['dataFrequency'],
|
|
dataSource: (backtest.config?.dataSource ?? 'auto') as BacktestConfig['dataSource'],
|
|
datasetHash:
|
|
typeof backtest.config?.datasetHash === 'string'
|
|
? backtest.config.datasetHash
|
|
: undefined,
|
|
commission: Number(backtest.config?.commission ?? 0.001),
|
|
slippage: Number(backtest.config?.slippage ?? 0.0001),
|
|
priceAdjustment:
|
|
backtest.config?.dataPolicy &&
|
|
typeof backtest.config.dataPolicy === 'object' &&
|
|
'adjustment' in backtest.config.dataPolicy &&
|
|
backtest.config.dataPolicy.adjustment === 'provider-adjusted'
|
|
? 'provider-adjusted'
|
|
: 'raw',
|
|
}
|
|
: undefined,
|
|
[backtest]
|
|
);
|
|
|
|
const renderSettings = () => (
|
|
<div className="max-w-4xl mx-auto space-y-4">
|
|
{catalog && backtest && (showCanonicalSetup || backtest.config.canonical) ? (
|
|
<CanonicalSetup
|
|
key={backtest.id}
|
|
backtest={backtest}
|
|
disabled={archived || isLoading}
|
|
onSave={request => updateBacktest(backtest.id, request)}
|
|
onClose={!backtest.config.canonical ? () => setShowCanonicalSetup(false) : undefined}
|
|
/>
|
|
) : (
|
|
<>
|
|
{catalog && (
|
|
<div className="space-y-2">
|
|
<p className="text-sm text-text-secondary">
|
|
This draft is not configured for canonical execution. Select an eligible retained
|
|
dataset and inspect the simulation policy before running.
|
|
</p>
|
|
<button
|
|
type="button"
|
|
className="px-3 py-2 border border-border rounded-md text-primary-500 disabled:opacity-50"
|
|
disabled={archived || isLoading}
|
|
onClick={() => setShowCanonicalSetup(true)}
|
|
>
|
|
Configure canonical research
|
|
</button>
|
|
</div>
|
|
)}
|
|
<BacktestConfiguration
|
|
onSubmit={handleConfigSubmit}
|
|
disabled={archived || isLoading}
|
|
initialConfig={backtestConfig}
|
|
/>
|
|
</>
|
|
)}
|
|
</div>
|
|
);
|
|
|
|
const renderTabContent = () => {
|
|
if (['details', 'trades'].includes(activeTab)) {
|
|
if (isLoading) {
|
|
return (
|
|
<div role="status" className="p-8 text-text-secondary">
|
|
Loading run data...
|
|
</div>
|
|
);
|
|
}
|
|
if (currentRun?.status === 'failed' || currentRun?.status === 'cancelled') {
|
|
return (
|
|
<div role="status" className="p-8 text-text-secondary">
|
|
{currentRun.status === 'failed'
|
|
? `Run failed: ${currentRun.error || 'No error details were saved.'}`
|
|
: 'Run cancelled. No completed results are available.'}
|
|
</div>
|
|
);
|
|
}
|
|
if (currentRun && currentRun.status !== 'completed') {
|
|
return (
|
|
<div role="status" className="p-8 text-text-secondary">
|
|
{cancelRequested || currentRun.cancelRequested
|
|
? 'Cancellation requested. Waiting for the worker to stop.'
|
|
: 'Run is not complete. Results will appear when saved.'}
|
|
</div>
|
|
);
|
|
}
|
|
if (currentRun && !runResults) {
|
|
return (
|
|
<div className="p-8 text-text-secondary">
|
|
<p>Run completed, but saved results are unavailable.</p>
|
|
<button className="mt-2 text-primary-500" onClick={() => void refreshRun()}>
|
|
Retry results
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
// A missing result is not a successful run with zero trades.
|
|
if (!currentRun && ['details', 'trades'].includes(activeTab)) {
|
|
return (
|
|
<div className="flex items-center justify-center h-full">
|
|
<div className="text-center">
|
|
<p className="text-text-secondary mb-4">Please select a run to view {activeTab}</p>
|
|
<button
|
|
onClick={() => setActiveTab('runs')}
|
|
className="text-primary-500 hover:text-primary-600 font-medium"
|
|
>
|
|
Go to Runs
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
switch (activeTab) {
|
|
case 'runs':
|
|
return (
|
|
<div className="space-y-4">
|
|
<div className="flex justify-between items-center">
|
|
<h3 className="text-lg font-medium text-text-primary">Run History</h3>
|
|
<button
|
|
onClick={() => setShowNewRun(true)}
|
|
disabled={archived || executionUnavailable}
|
|
className="inline-flex items-center px-4 py-2 bg-primary-500 text-white rounded-md text-sm font-medium hover:bg-primary-600 transition-colors"
|
|
>
|
|
<PlusIcon className="w-4 h-4 mr-2" />
|
|
New Run
|
|
</button>
|
|
</div>
|
|
|
|
{showNewRun && canSubmit && (
|
|
<div className="bg-surface-secondary rounded-lg border border-border p-4 space-y-4">
|
|
<h4 className="text-base font-medium text-text-primary">Run current settings</h4>
|
|
<p className="text-sm text-text-secondary">
|
|
Submit the current configuration, not a reproduction of a previous run. A retry
|
|
recovers the original submission if it was already accepted.
|
|
</p>
|
|
<div className="flex space-x-2">
|
|
<button
|
|
onClick={() => {
|
|
void handleCreateRun();
|
|
}}
|
|
disabled={isSubmitting || !canSubmit}
|
|
className="px-4 py-2 bg-primary-500 text-white rounded-md text-sm font-medium hover:bg-primary-600 transition-colors"
|
|
>
|
|
{isSubmitting
|
|
? 'Submitting...'
|
|
: hasPendingSubmission
|
|
? 'Retry submission'
|
|
: 'Run current settings'}
|
|
</button>
|
|
<button
|
|
onClick={() => {
|
|
navigationGeneration.current++;
|
|
setShowNewRun(false);
|
|
}}
|
|
className="px-4 py-2 bg-surface-tertiary text-text-primary rounded-md text-sm font-medium hover:bg-surface-secondary transition-colors"
|
|
>
|
|
Cancel
|
|
</button>
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
<RunsListWithMetrics
|
|
runs={runs}
|
|
currentRunId={currentRun?.id}
|
|
onSelectRun={selectRun}
|
|
/>
|
|
</div>
|
|
);
|
|
case 'details':
|
|
// Only render if we have matching results or no results yet
|
|
if (runResults && currentRun && runResults.runId !== currentRun.id) {
|
|
return (
|
|
<div className="h-full flex items-center justify-center">
|
|
<div className="text-text-secondary">Loading run data...</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (runResults && isCanonicalRunResult(runResults)) {
|
|
return <CanonicalResults key={runResults.runId} result={runResults} />;
|
|
}
|
|
return (
|
|
<div className="h-full overflow-hidden">
|
|
<BacktestPlayback
|
|
key={currentRun?.id || 'no-run'} // Force remount on run change
|
|
result={runResults}
|
|
isLoading={isLoading}
|
|
/>
|
|
</div>
|
|
);
|
|
case 'trades':
|
|
if (runResults && isCanonicalRunResult(runResults)) {
|
|
return <CanonicalResults key={runResults.runId} result={runResults} fillsOnly />;
|
|
}
|
|
return (
|
|
<div className="h-full overflow-y-auto">
|
|
<BacktestTrades result={runResults} isLoading={isLoading} />
|
|
</div>
|
|
);
|
|
default:
|
|
return null;
|
|
}
|
|
};
|
|
|
|
if (!backtest && !isLoading) {
|
|
return (
|
|
<div className="h-full flex items-center justify-center">
|
|
<div className="text-center">
|
|
<p className="text-text-secondary mb-4">{error || 'Backtest not found'}</p>
|
|
{error && id && (
|
|
<button className="mr-4 text-primary-500" onClick={() => void loadBacktest(id)}>
|
|
Retry backtest
|
|
</button>
|
|
)}
|
|
<button
|
|
onClick={() => navigate('/backtests')}
|
|
className="text-primary-500 hover:text-primary-600"
|
|
>
|
|
Back to Backtests
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="h-full flex flex-col">
|
|
{/* Header with Tabs */}
|
|
<div className="flex-shrink-0 border-b border-border">
|
|
<div className="flex items-center justify-between">
|
|
<div className="flex items-center flex-1">
|
|
<button
|
|
onClick={() => navigate('/backtests')}
|
|
className="p-2 hover:bg-surface-tertiary transition-colors"
|
|
aria-label="Back to backtests"
|
|
>
|
|
<ArrowLeftIcon className="h-5 w-5 text-text-secondary" />
|
|
</button>
|
|
<div className="px-2">
|
|
<h1 className="text-sm font-bold text-text-primary flex items-center gap-1">
|
|
{backtest?.name || 'Loading...'}
|
|
{archived && (
|
|
<span className="text-xs font-normal text-text-secondary">Archived</span>
|
|
)}
|
|
{currentRun && (
|
|
<span className="text-text-secondary font-normal">
|
|
- Run #{currentRun.runNumber}
|
|
</span>
|
|
)}
|
|
</h1>
|
|
<p className="text-xs text-text-secondary">
|
|
Current definition: {backtest?.strategy || ''} •{' '}
|
|
{backtest?.symbols.join(', ') || ''}
|
|
</p>
|
|
</div>
|
|
|
|
{/* Tabs */}
|
|
<nav className="flex ml-4" aria-label="Tabs">
|
|
{(currentRun ? runTabs : []).concat(baseTabs).map(tab => (
|
|
<button
|
|
key={tab.id}
|
|
onClick={() => {
|
|
if (tab.id === 'settings' && id) {
|
|
setSettingsOwner(id);
|
|
}
|
|
setActiveTab(tab.id);
|
|
}}
|
|
className={`
|
|
whitespace-nowrap py-2 px-3 border-b-2 font-medium text-sm
|
|
${
|
|
activeTab === tab.id
|
|
? 'border-primary-500 text-primary-500'
|
|
: 'border-transparent text-text-secondary hover:text-text-primary hover:border-border'
|
|
}
|
|
`}
|
|
>
|
|
{tab.name}
|
|
</button>
|
|
))}
|
|
</nav>
|
|
</div>
|
|
|
|
{/* Run Controls */}
|
|
{currentRun && (
|
|
<button
|
|
type="button"
|
|
disabled={!findingResult}
|
|
title={
|
|
findingResult
|
|
? 'Cite saved run measurements'
|
|
: 'A completed run with available saved results is required'
|
|
}
|
|
onClick={() => setShowFinding(true)}
|
|
className="px-3 py-2 text-sm text-primary-500 border border-border rounded-md disabled:opacity-50"
|
|
>
|
|
Save finding
|
|
</button>
|
|
)}
|
|
{backtest && (
|
|
<button
|
|
type="button"
|
|
disabled={isLoading}
|
|
onClick={() => setShowArchiveDialog(true)}
|
|
className="px-3 py-2 text-sm text-text-secondary border border-border rounded-md disabled:opacity-50"
|
|
>
|
|
{archived ? 'Restore backtest' : 'Archive backtest'}
|
|
</button>
|
|
)}
|
|
{backtest && catalog && !archived && (
|
|
<Link
|
|
to={`/experiments?backtestId=${encodeURIComponent(backtest.id)}`}
|
|
className="px-3 py-2 text-sm text-primary-500 border border-border rounded-md"
|
|
>
|
|
Create experiment
|
|
</Link>
|
|
)}
|
|
{currentRun && (
|
|
<div className="px-4">
|
|
<p className="text-xs text-text-secondary">Run current settings</p>
|
|
<RunControlsCompact
|
|
run={currentRun}
|
|
onCancel={cancelRun}
|
|
cancelRequested={cancelRequested}
|
|
onRerun={handleRerun}
|
|
isSubmitting={isSubmitting}
|
|
hasPendingSubmission={hasPendingSubmission}
|
|
archived={archived}
|
|
executionUnavailable={executionUnavailable}
|
|
/>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
|
|
{/* Tab Content */}
|
|
<div className="flex flex-col flex-1 min-h-0 overflow-hidden py-4">
|
|
{catalog && (
|
|
<p
|
|
role="status"
|
|
className="mb-4 p-3 border border-border rounded-lg text-sm text-text-secondary"
|
|
>
|
|
{isCapabilityLoading
|
|
? 'Checking canonical execution eligibility...'
|
|
: canonicalCapability?.available
|
|
? 'Canonical execution is available for this saved configuration. Admission will verify it again before starting.'
|
|
: (capabilityError ?? canonicalCapability?.reason ?? catalogExecutionReason)}{' '}
|
|
<button
|
|
type="button"
|
|
className="text-primary-500 underline"
|
|
disabled={isCapabilityLoading || archived}
|
|
onClick={refreshCanonicalCapability}
|
|
>
|
|
Retry execution eligibility
|
|
</button>
|
|
{canonicalCapability?.execution && !isCapabilityLoading && (
|
|
<span className="block break-all">
|
|
Isolated candidate sandbox: {canonicalCapability.execution.imageId}. Limit{' '}
|
|
{canonicalCapability.execution.profile.limits.wallMs / 1000}s per container; agent
|
|
attempt deadlines may be shorter.
|
|
</span>
|
|
)}
|
|
{backtest?.strategyVersionId && (
|
|
<>
|
|
{' '}
|
|
Selected immutable version:{' '}
|
|
<Link
|
|
className="text-primary-500"
|
|
to={`/strategies/versions/${backtest.strategyVersionId}`}
|
|
>
|
|
{backtest.strategyVersionId}
|
|
</Link>
|
|
.
|
|
</>
|
|
)}
|
|
</p>
|
|
)}
|
|
{unsupportedLegacy && (
|
|
<p role="status" className="mb-4 text-sm text-text-secondary">
|
|
Legacy execution is retired. Create a catalog backtest to run with retained canonical
|
|
inputs. Its existing history remains readable.
|
|
</p>
|
|
)}
|
|
{archived && (
|
|
<p
|
|
role="status"
|
|
className="mb-4 p-3 border border-border rounded-lg text-sm text-text-secondary"
|
|
>
|
|
This backtest is archived. Restore it to edit settings or start new runs. Saved history
|
|
remains available; accepted runs can finish, recover or be cancelled.
|
|
</p>
|
|
)}
|
|
{submissionError && (
|
|
<div className="mb-4 p-4 bg-error/10 border border-error/20 rounded-lg">
|
|
<p role="alert" className="text-sm text-error">
|
|
Run submission failed: {submissionError}. Retry to recover the same submission.
|
|
</p>
|
|
{!showNewRun && (
|
|
<button
|
|
disabled={isSubmitting || !canSubmit}
|
|
className="mt-2 text-primary-500"
|
|
onClick={() => void handleCreateRun()}
|
|
>
|
|
Retry submission
|
|
</button>
|
|
)}
|
|
</div>
|
|
)}
|
|
{error && (
|
|
<div className="mb-4 p-4 bg-error/10 border border-error/20 rounded-lg">
|
|
<p role="alert" className="text-sm text-error">
|
|
{error}
|
|
</p>
|
|
{runId && (
|
|
<button className="mt-2 text-primary-500" onClick={() => void refreshRun()}>
|
|
Retry run
|
|
</button>
|
|
)}
|
|
</div>
|
|
)}
|
|
{currentRun && <RunDataset dataset={currentRun.dataset} />}
|
|
<div className="min-h-0 flex-1 overflow-y-auto">
|
|
{currentRun &&
|
|
currentRun.id === runId &&
|
|
currentRun.backtestId === id &&
|
|
backtest?.id === id && <RunReproduction run={currentRun} archived={archived} />}
|
|
{settingsOwner === id && backtest?.id === id && (
|
|
<div key={id} hidden={activeTab !== 'settings'} aria-label="Backtest settings panel">
|
|
{renderSettings()}
|
|
</div>
|
|
)}
|
|
{activeTab !== 'settings' && renderTabContent()}
|
|
</div>
|
|
</div>
|
|
{showFinding && findingResult && (
|
|
<SaveFindingDialog
|
|
key={findingResult.runId}
|
|
result={findingResult}
|
|
onClose={() => setShowFinding(false)}
|
|
/>
|
|
)}
|
|
{showArchiveDialog && backtest && (
|
|
<ArchiveBacktestDialog
|
|
key={backtest.id}
|
|
name={backtest.name}
|
|
archived={!archived}
|
|
onClose={() => setShowArchiveDialog(false)}
|
|
onConfirm={() => setBacktestArchived(backtest.id, !archived)}
|
|
/>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|