-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalyzeContract.ts
More file actions
58 lines (51 loc) · 1.31 KB
/
Copy pathanalyzeContract.ts
File metadata and controls
58 lines (51 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Minimal analyze() input/output contracts.
*/
export type TradeInput = {
profit: number;
openTime?: number;
closeTime?: number;
direction?: "long" | "short";
symbol?: string;
};
/** Alias for integrations that speak in terms of trades. */
export type Trade = TradeInput;
export type AnalyzeInput = {
strategyId?: string;
trades?: TradeInput[];
tags?: string[];
};
export type AnalysisSummary = {
totalTrades: number;
netProfit: number;
avgTradeProfit: number;
};
export type ReproducibilityMetadata = {
engineVersion: string;
formulaVersion: string;
riskAnalysisVersion: number;
contractVersion: string;
inputHash: string;
configHash: string;
seed: number;
decimals: number;
wfaSchemaVersion?: string;
wfaInputMode?: "precomputed" | "tradeSlicedPseudoWfa";
robustnessScoreImputed?: boolean;
};
export type AnalyzeOutput = {
summary: AnalysisSummary;
metadata: ReproducibilityMetadata;
};
export type AnalyzeConfig = {
seed?: number;
decimals?: number;
/**
* Permutation count for WFE p-value. Default and bounds: `WFE_PERMUTATION_N_*` in `@kiploks/engine-contracts`.
*/
permutationN?: number;
/**
* Bootstrap iterations for professional `monteCarloValidation` (window OOS returns). Default 1000; clamped to [100, 50_000].
*/
monteCarloBootstrapN?: number;
};