feat(research): disclose saved result provenance and limitations
This commit is contained in:
parent
43ffb547be
commit
fe00ecd0e2
12 changed files with 456 additions and 12 deletions
|
|
@ -7,6 +7,7 @@ interface ExtendedMetrics {
|
|||
maxDrawdown?: number | null;
|
||||
winRate?: number | null;
|
||||
totalProfit?: number | null;
|
||||
totalPnl?: number | null;
|
||||
profitFactor?: number | null;
|
||||
totalTrades?: number | null;
|
||||
avgWin?: number | null;
|
||||
|
|
@ -55,10 +56,13 @@ export function CompactPerformanceMetrics({ result, isLoading }: CompactPerforma
|
|||
...metrics,
|
||||
};
|
||||
|
||||
// Calculate totalProfit if not provided
|
||||
// Never infer a historical cash amount from a mutable legacy definition's capital.
|
||||
const totalProfit =
|
||||
allMetrics.totalProfit ??
|
||||
(typeof allMetrics.totalReturn === 'number' && typeof result.config?.initialCapital === 'number'
|
||||
allMetrics.totalPnl ??
|
||||
(result.provenance?.configurationSource === 'stored-snapshot' &&
|
||||
typeof allMetrics.totalReturn === 'number' &&
|
||||
typeof result.config?.initialCapital === 'number'
|
||||
? allMetrics.totalReturn * result.config.initialCapital
|
||||
: undefined);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue