@tradejs/types 2.0.19 → 2.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +310 -1
- package/dist/index.d.ts +310 -1
- package/dist/index.js +11 -0
- package/dist/index.mjs +8 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -114,6 +114,7 @@ interface TradingAccountRef {
|
|
|
114
114
|
interface RuntimeDeploymentStrategy {
|
|
115
115
|
strategyName: string;
|
|
116
116
|
policyProfileId: string;
|
|
117
|
+
releaseCompositionId?: string;
|
|
117
118
|
enabled?: boolean;
|
|
118
119
|
config?: Record<string, unknown>;
|
|
119
120
|
}
|
|
@@ -856,6 +857,7 @@ interface RuntimeAiAnalysisSnapshot {
|
|
|
856
857
|
type SignalOrderStatus = 'completed' | 'failed' | 'skipped' | 'canceled';
|
|
857
858
|
interface RuntimeLineage {
|
|
858
859
|
schemaVersion: 1;
|
|
860
|
+
compositionId?: string | null;
|
|
859
861
|
gitSha: string | null;
|
|
860
862
|
gitDirty: boolean | null;
|
|
861
863
|
gateFingerprint: string;
|
|
@@ -1065,6 +1067,7 @@ interface Test extends BacktestRunConfig {
|
|
|
1065
1067
|
ai?: boolean;
|
|
1066
1068
|
fast?: boolean;
|
|
1067
1069
|
collectReplaySignalEvaluations?: boolean;
|
|
1070
|
+
researchTrace?: boolean;
|
|
1068
1071
|
chunkId?: string;
|
|
1069
1072
|
backtestRunId?: string;
|
|
1070
1073
|
backtestTestKey?: string;
|
|
@@ -1089,12 +1092,55 @@ declare const BACKTEST_WARNING_CODES: {
|
|
|
1089
1092
|
};
|
|
1090
1093
|
type BacktestWarningCode = (typeof BACKTEST_WARNING_CODES)[keyof typeof BACKTEST_WARNING_CODES];
|
|
1091
1094
|
type BacktestWarningCounts = Partial<Record<BacktestWarningCode, number>>;
|
|
1095
|
+
type CoreResearchTraceEvent = {
|
|
1096
|
+
schema: 'tradejs-core-research-trace/v1';
|
|
1097
|
+
event: 'signal_emitted' | 'entry_rejected' | 'entry_executed';
|
|
1098
|
+
timestamp: number;
|
|
1099
|
+
strategy: string;
|
|
1100
|
+
symbol: string;
|
|
1101
|
+
direction: Direction;
|
|
1102
|
+
setupIdentity: string;
|
|
1103
|
+
setupIdentitySource: 'strategy-context' | 'signal-time-fallback';
|
|
1104
|
+
signalId: string;
|
|
1105
|
+
configId?: string;
|
|
1106
|
+
backtestRunId?: string;
|
|
1107
|
+
backtestTestKey?: string;
|
|
1108
|
+
} | {
|
|
1109
|
+
schema: 'tradejs-core-research-trace/v1';
|
|
1110
|
+
event: 'position_exited';
|
|
1111
|
+
timestamp: number;
|
|
1112
|
+
strategy: string;
|
|
1113
|
+
symbol: string;
|
|
1114
|
+
direction: Direction;
|
|
1115
|
+
setupIdentity: string;
|
|
1116
|
+
setupIdentitySource: 'strategy-context' | 'signal-time-fallback';
|
|
1117
|
+
signalId: string;
|
|
1118
|
+
configId?: string;
|
|
1119
|
+
backtestRunId?: string;
|
|
1120
|
+
backtestTestKey?: string;
|
|
1121
|
+
netProfit: number;
|
|
1122
|
+
exitReason: TestTradeExitReason;
|
|
1123
|
+
} | {
|
|
1124
|
+
schema: 'tradejs-core-research-trace/v1';
|
|
1125
|
+
event: 'skip_summary';
|
|
1126
|
+
timestamp: number;
|
|
1127
|
+
strategy: string;
|
|
1128
|
+
symbol: string;
|
|
1129
|
+
configId?: string;
|
|
1130
|
+
backtestRunId?: string;
|
|
1131
|
+
backtestTestKey?: string;
|
|
1132
|
+
skipCounts: Record<string, number>;
|
|
1133
|
+
};
|
|
1092
1134
|
interface TestingBoxResult {
|
|
1093
1135
|
orderLogId: string;
|
|
1094
1136
|
stat: MinimalStat;
|
|
1095
1137
|
inlineOrderLog?: OrderLogData;
|
|
1096
1138
|
inlinePositionLog?: PositionLogData;
|
|
1097
1139
|
inlineReplaySignalEvaluations?: RuntimeSignalEvaluationRecord[];
|
|
1140
|
+
researchTraceSummary?: {
|
|
1141
|
+
events: Record<string, number>;
|
|
1142
|
+
skipCounts: Record<string, number>;
|
|
1143
|
+
};
|
|
1098
1144
|
executionCostModel?: ExecutionCostModel;
|
|
1099
1145
|
warningCounts?: BacktestWarningCounts;
|
|
1100
1146
|
}
|
|
@@ -2524,6 +2570,11 @@ interface AiDatasetRow {
|
|
|
2524
2570
|
backtestRunId?: string;
|
|
2525
2571
|
backtestTestKey?: string;
|
|
2526
2572
|
backtestChunkId?: string;
|
|
2573
|
+
research?: {
|
|
2574
|
+
schema: 'tradejs-core-research-row/v1';
|
|
2575
|
+
setupIdentity: string;
|
|
2576
|
+
setupIdentitySource: 'strategy-context' | 'signal-time-fallback';
|
|
2577
|
+
};
|
|
2527
2578
|
}
|
|
2528
2579
|
|
|
2529
2580
|
type StrategyChartMetricTone = 'default' | 'neutral' | 'success' | 'warning' | 'error';
|
|
@@ -2605,4 +2656,262 @@ interface Item<T = Record<string, string | number | boolean>> {
|
|
|
2605
2656
|
}
|
|
2606
2657
|
type Items = Item[];
|
|
2607
2658
|
|
|
2608
|
-
|
|
2659
|
+
declare const STRATEGY_RELEASE_SCHEMA: "tradejs-strategy-release/v1";
|
|
2660
|
+
declare const STRATEGY_EVIDENCE_MARKERS_SCHEMA: "tradejs-strategy-evidence-markers/v1";
|
|
2661
|
+
declare const STRATEGY_LIVE_DIAGNOSIS_SCHEMA: "tradejs-strategy-live-diagnosis/v1";
|
|
2662
|
+
type StrategyReleaseVerdict = 'READY_FOR_RUNTIME' | 'UNSUITABLE_FOR_CURRENT_MARKET' | 'INSUFFICIENT_EVIDENCE';
|
|
2663
|
+
type StrategyReleaseResearchDecisionAction = 'REPAIR_RECENT_DIRECTION' | 'START_MICRO_FORWARD' | 'MICRO_FORWARD_READY' | 'FORWARD_BLOCKED' | 'STOP_RESEARCH';
|
|
2664
|
+
type StrategyReleaseResearchDecisionBlocker = 'HISTORICAL_MATRIX_INCOMPLETE' | 'HISTORICAL_EDGE_FAILED' | 'CANDIDATE_NOT_IMPLEMENTED' | 'FULL_PERIOD_CHART_MISSING' | 'FORWARD_NOT_AUTHORIZED' | 'RUNTIME_TARGET_UNRESOLVED' | 'FORWARD_RISK_MUST_BE_ONE';
|
|
2665
|
+
type StrategyReleaseHistoricalWindow = {
|
|
2666
|
+
days: number;
|
|
2667
|
+
coveredDays?: number;
|
|
2668
|
+
pnl: number;
|
|
2669
|
+
profitFactor: number;
|
|
2670
|
+
long: {
|
|
2671
|
+
pnl: number;
|
|
2672
|
+
profitFactor: number;
|
|
2673
|
+
};
|
|
2674
|
+
short: {
|
|
2675
|
+
pnl: number;
|
|
2676
|
+
profitFactor: number;
|
|
2677
|
+
};
|
|
2678
|
+
};
|
|
2679
|
+
type StrategyReleaseResearchDecisionInput = {
|
|
2680
|
+
strategy: string;
|
|
2681
|
+
historicalWindows: StrategyReleaseHistoricalWindow[];
|
|
2682
|
+
candidateImplemented: boolean;
|
|
2683
|
+
exposedEvaluation: boolean;
|
|
2684
|
+
chartArtifact: {
|
|
2685
|
+
path: string;
|
|
2686
|
+
sha256: string;
|
|
2687
|
+
} | null;
|
|
2688
|
+
recentFailure: {
|
|
2689
|
+
days: number;
|
|
2690
|
+
direction: 'LONG' | 'SHORT';
|
|
2691
|
+
closedTrades: number;
|
|
2692
|
+
causalMechanismIdentified: boolean;
|
|
2693
|
+
repairRoundsUsed: number;
|
|
2694
|
+
} | null;
|
|
2695
|
+
forwardTest: {
|
|
2696
|
+
authorized: boolean;
|
|
2697
|
+
runtimeTarget: {
|
|
2698
|
+
userName: string;
|
|
2699
|
+
deploymentId: string;
|
|
2700
|
+
accountId: string;
|
|
2701
|
+
strategyConfigName: string;
|
|
2702
|
+
} | null;
|
|
2703
|
+
maxLossValue: number;
|
|
2704
|
+
};
|
|
2705
|
+
};
|
|
2706
|
+
type StrategyReleaseResearchDecision = {
|
|
2707
|
+
strategy: string;
|
|
2708
|
+
action: StrategyReleaseResearchDecisionAction;
|
|
2709
|
+
repairAllowed: boolean;
|
|
2710
|
+
targetDirection: 'LONG' | 'SHORT' | null;
|
|
2711
|
+
maxLossValue: 1 | null;
|
|
2712
|
+
blockers: StrategyReleaseResearchDecisionBlocker[];
|
|
2713
|
+
summary: string;
|
|
2714
|
+
};
|
|
2715
|
+
type StrategyReleaseReason = 'NO_VERIFIED_CORE_EDGE' | 'AI_GATE_ADDS_NO_VALUE' | 'CURRENT_REGIME_UNSUITABLE' | 'RUNTIME_PARITY_BLOCKED' | 'EXECUTION_MODEL_UNSAFE' | 'RESEARCH_BUDGET_EXHAUSTED' | 'EVIDENCE_INCOMPLETE';
|
|
2716
|
+
type StrategyEvidenceMarkerType = 'G' | 'L' | 'E' | 'D' | 'P' | 'R';
|
|
2717
|
+
type StrategyEvidenceMarker = {
|
|
2718
|
+
id: string;
|
|
2719
|
+
type: StrategyEvidenceMarkerType;
|
|
2720
|
+
timestamp: number;
|
|
2721
|
+
label: string;
|
|
2722
|
+
summary: string;
|
|
2723
|
+
artifactId: string;
|
|
2724
|
+
artifactSha256: string;
|
|
2725
|
+
compositionId?: string;
|
|
2726
|
+
gitSha?: string;
|
|
2727
|
+
gateFingerprint?: string;
|
|
2728
|
+
configFingerprint?: string;
|
|
2729
|
+
contextFingerprint?: string;
|
|
2730
|
+
maxLossValue?: number;
|
|
2731
|
+
severity?: 'info' | 'warning' | 'blocking';
|
|
2732
|
+
coverage?: {
|
|
2733
|
+
startTime: number;
|
|
2734
|
+
endTime: number;
|
|
2735
|
+
};
|
|
2736
|
+
};
|
|
2737
|
+
type StrategyEvidenceTimeline = {
|
|
2738
|
+
status: 'verified' | 'missing' | 'invalid';
|
|
2739
|
+
observedFrom: number | null;
|
|
2740
|
+
markers: StrategyEvidenceMarker[];
|
|
2741
|
+
};
|
|
2742
|
+
type StrategyEvidenceTimelineSelector = {
|
|
2743
|
+
strategy: string;
|
|
2744
|
+
compositionId?: string | null;
|
|
2745
|
+
gitSha?: string | null;
|
|
2746
|
+
gateFingerprint?: string | null;
|
|
2747
|
+
configFingerprint?: string | null;
|
|
2748
|
+
contextFingerprint?: string | null;
|
|
2749
|
+
maxLossValue?: number | null;
|
|
2750
|
+
requireCompleteLineage?: boolean;
|
|
2751
|
+
};
|
|
2752
|
+
type StrategyEvidenceMarkerPayload = {
|
|
2753
|
+
strategy: string;
|
|
2754
|
+
createdAt: number;
|
|
2755
|
+
markers: StrategyEvidenceMarker[];
|
|
2756
|
+
sourceArtifacts: Array<{
|
|
2757
|
+
artifactId: string;
|
|
2758
|
+
sha256: string;
|
|
2759
|
+
path?: string;
|
|
2760
|
+
}>;
|
|
2761
|
+
};
|
|
2762
|
+
type StrategyEvidenceMarkerEnvelope = {
|
|
2763
|
+
schema: typeof STRATEGY_EVIDENCE_MARKERS_SCHEMA;
|
|
2764
|
+
artifactId: string;
|
|
2765
|
+
payloadSha256: string;
|
|
2766
|
+
payload: StrategyEvidenceMarkerPayload;
|
|
2767
|
+
};
|
|
2768
|
+
type StrategyReleaseEvidenceReference = {
|
|
2769
|
+
kind: 'core_research' | 'ai_gate' | 'runtime_parity' | 'execution_calibration' | 'runtime_evidence' | 'runtime_scorecard';
|
|
2770
|
+
artifactId: string;
|
|
2771
|
+
path: string;
|
|
2772
|
+
sha256: string;
|
|
2773
|
+
verified: boolean;
|
|
2774
|
+
lineage?: {
|
|
2775
|
+
strategy: string | null;
|
|
2776
|
+
gitSha: string | null;
|
|
2777
|
+
gitDirty: boolean | null;
|
|
2778
|
+
coreConfigSha256: string | null;
|
|
2779
|
+
gateConfigIdsFingerprint: string | null;
|
|
2780
|
+
gateFingerprint: string | null;
|
|
2781
|
+
runtimeConfigFingerprint: string | null;
|
|
2782
|
+
gateContextFingerprint: string | null;
|
|
2783
|
+
runtimeContextFingerprint: string | null;
|
|
2784
|
+
maxLossValue: number | null;
|
|
2785
|
+
sourceSha256s: string[];
|
|
2786
|
+
};
|
|
2787
|
+
releaseAssertions?: Partial<{
|
|
2788
|
+
coreEdgeVerified: boolean;
|
|
2789
|
+
aiGateAddsValue: boolean;
|
|
2790
|
+
currentMarketSuitable: boolean;
|
|
2791
|
+
runtimeParityVerified: boolean;
|
|
2792
|
+
executionModelVerified: boolean;
|
|
2793
|
+
}>;
|
|
2794
|
+
};
|
|
2795
|
+
type StrategyReleaseManifest = {
|
|
2796
|
+
schema: typeof STRATEGY_RELEASE_SCHEMA;
|
|
2797
|
+
releaseId: string;
|
|
2798
|
+
strategy: string;
|
|
2799
|
+
createdAt: number;
|
|
2800
|
+
composition: {
|
|
2801
|
+
compositionId: string;
|
|
2802
|
+
gitSha: string;
|
|
2803
|
+
coreConfigSha256: string;
|
|
2804
|
+
coreExportSha256: string;
|
|
2805
|
+
gateConfigIdsFingerprint: string;
|
|
2806
|
+
runtimeConfigFingerprint: string;
|
|
2807
|
+
gateFingerprint: string;
|
|
2808
|
+
gateContextFingerprint: string;
|
|
2809
|
+
runtimeContextFingerprint: string;
|
|
2810
|
+
maxLossValue: number;
|
|
2811
|
+
longEnabled: boolean;
|
|
2812
|
+
shortEnabled: boolean;
|
|
2813
|
+
};
|
|
2814
|
+
marketWindow: {
|
|
2815
|
+
startTime: number;
|
|
2816
|
+
endTime: number;
|
|
2817
|
+
universeSha256: string;
|
|
2818
|
+
symbols: number;
|
|
2819
|
+
cacheOnly: true;
|
|
2820
|
+
terminalDays: number[];
|
|
2821
|
+
};
|
|
2822
|
+
researchBudget: {
|
|
2823
|
+
hypothesisFamilies: number;
|
|
2824
|
+
maximumVariantsPerFamily: number;
|
|
2825
|
+
isolatedLongFinalists: number;
|
|
2826
|
+
aiGateTuningRounds: number;
|
|
2827
|
+
};
|
|
2828
|
+
evidence: StrategyReleaseEvidenceReference[];
|
|
2829
|
+
gates: {
|
|
2830
|
+
coreEdgeVerified: boolean;
|
|
2831
|
+
aiGateAddsValue: boolean;
|
|
2832
|
+
currentMarketSuitable: boolean;
|
|
2833
|
+
runtimeParityVerified: boolean;
|
|
2834
|
+
executionModelVerified: boolean;
|
|
2835
|
+
};
|
|
2836
|
+
monitoring: {
|
|
2837
|
+
minimumProspectiveClosedTrades: number;
|
|
2838
|
+
minimumParityRatio: number;
|
|
2839
|
+
maximumOrderFailureRate: number;
|
|
2840
|
+
drawdownEnvelopes: Array<{
|
|
2841
|
+
days: number;
|
|
2842
|
+
p95: number;
|
|
2843
|
+
maximum: number;
|
|
2844
|
+
}>;
|
|
2845
|
+
rawCoreExpectancy: number | null;
|
|
2846
|
+
aiGateExpectancy: number | null;
|
|
2847
|
+
minimumRegimeCoverage: number;
|
|
2848
|
+
overfitProbability: number | null;
|
|
2849
|
+
};
|
|
2850
|
+
verdict: {
|
|
2851
|
+
status: StrategyReleaseVerdict;
|
|
2852
|
+
reasons: StrategyReleaseReason[];
|
|
2853
|
+
summary: string;
|
|
2854
|
+
};
|
|
2855
|
+
prospective: {
|
|
2856
|
+
status: 'not_started' | 'incubating' | 'sufficient' | 'blocked';
|
|
2857
|
+
evidenceBooks: Array<'micro_live' | 'shadow_composition' | 'shadow_raw_core' | 'gate_comparison'>;
|
|
2858
|
+
llmComparatorPolicy: 'ai_approved_only' | 'all_core_candidates' | 'disabled';
|
|
2859
|
+
};
|
|
2860
|
+
};
|
|
2861
|
+
type StrategyReleaseEnvelope = {
|
|
2862
|
+
schema: 'tradejs-strategy-release-envelope/v1';
|
|
2863
|
+
releaseId: string;
|
|
2864
|
+
manifestSha256: string;
|
|
2865
|
+
manifest: StrategyReleaseManifest;
|
|
2866
|
+
};
|
|
2867
|
+
type StrategyLiveDiagnosisVerdict = 'RUNTIME_DIVERGENCE' | 'EXPECTED_DRAWDOWN' | 'GENERALIZATION_FAILURE' | 'INSUFFICIENT_EVIDENCE';
|
|
2868
|
+
type StrategyLiveDiagnosis = {
|
|
2869
|
+
schema: typeof STRATEGY_LIVE_DIAGNOSIS_SCHEMA;
|
|
2870
|
+
strategy: string;
|
|
2871
|
+
compositionId: string;
|
|
2872
|
+
createdAt: number;
|
|
2873
|
+
verdict: StrategyLiveDiagnosisVerdict;
|
|
2874
|
+
subtype: 'RAW_CORE_DECAY' | 'AI_GATE_FAILURE' | 'REGIME_SHIFT' | 'SUSPECTED_HISTORICAL_OVERFIT' | null;
|
|
2875
|
+
confidence: 'low' | 'medium' | 'high';
|
|
2876
|
+
evidence: {
|
|
2877
|
+
lineageComparable: boolean;
|
|
2878
|
+
riskScaleComparable: boolean;
|
|
2879
|
+
releaseMaxLossValue: number | null;
|
|
2880
|
+
runtimeMaxLossValue: number | null;
|
|
2881
|
+
riskScaleRatio: number | null;
|
|
2882
|
+
parityRatio: number | null;
|
|
2883
|
+
orderFailureRate: number | null;
|
|
2884
|
+
observedDrawdown: number | null;
|
|
2885
|
+
normalizedObservedDrawdown: number | null;
|
|
2886
|
+
historicalDrawdownP95: number | null;
|
|
2887
|
+
historicalDrawdownMaximum: number | null;
|
|
2888
|
+
closedTrades: number;
|
|
2889
|
+
rawCoreExpectancyDelta: number | null;
|
|
2890
|
+
aiGateAddedValue: number | null;
|
|
2891
|
+
regimeCoverage: number | null;
|
|
2892
|
+
overfitProbability: number | null;
|
|
2893
|
+
};
|
|
2894
|
+
explanation: string;
|
|
2895
|
+
recommendations: string[];
|
|
2896
|
+
};
|
|
2897
|
+
type StrategyLiveDiagnosisEnvelope = {
|
|
2898
|
+
schema: 'tradejs-strategy-live-diagnosis-envelope/v1';
|
|
2899
|
+
diagnosisId: string;
|
|
2900
|
+
diagnosisSha256: string;
|
|
2901
|
+
diagnosis: StrategyLiveDiagnosis;
|
|
2902
|
+
};
|
|
2903
|
+
type StrategyEvidenceRetentionEntry = {
|
|
2904
|
+
path: string;
|
|
2905
|
+
kind: 'operational_redis' | 'verbose_payload' | 'verified_runtime_bundle' | 'compact_ledger';
|
|
2906
|
+
createdAt: number;
|
|
2907
|
+
verified: boolean;
|
|
2908
|
+
aggregated: boolean;
|
|
2909
|
+
bytes: number;
|
|
2910
|
+
};
|
|
2911
|
+
type StrategyEvidenceRetentionPlan = {
|
|
2912
|
+
keep: StrategyEvidenceRetentionEntry[];
|
|
2913
|
+
delete: StrategyEvidenceRetentionEntry[];
|
|
2914
|
+
bytesReclaimable: number;
|
|
2915
|
+
};
|
|
2916
|
+
|
|
2917
|
+
export { type AIChatHistory, type AIChatMessage, type AggTrade, type AggTradesRequest, type AiDatasetRow, type AiPayload, type AiPromptPair, type AssetClass, BACKTEST_WARNING_CODES, type BacktestDetectorOptimizedStrategy, type BacktestPriceMode, type BacktestRunConfig, type BacktestWarningCode, type BacktestWarningCounts, type BaseContextGateFeatures, type BaseGateFeatureApproveBias, type BaseGateFeatureConfirmation, type BaseGateFeatureConflict, type BaseGateFeatureEntryLocation, type BaseGateFeaturePrimaryIssue, type BaseGateFeatureRiskLevel, type BaseGateFeatureScoreKey, type BaseHyperliquidWhaleFlowContext, type BaseIndicatorsHistorySnapshot, type BaseMarketBreadthContext, type BaseMarketBreadthsContext, type BaseMarketTradeFlowContext, type BaseMultiTimeframeContext, type BaseParticipationContext, type BasePsychologicalLevelAssetContext, type BasePsychologicalLevelWindowContext, type BaseRawIndicatorSnapshot, type BaseRegimeContext, type BaseRelativeContext, type BaseStrategyContextSnapshot, type BaseStructureContext, type Bot, type BotConfig, type BotResults, type BotStatus, type BuildStrategySignalDraft, type BuildStrategySignalParams, type Candle, type ChartColor, type ClosedPnlRecord, type CmcExchangeLiquidityRegime, type CmcFearGreedClassification, type CmcFearGreedRegime, type CompletedTest, type Connector, type ConnectorCapabilities, type ConnectorConfig, type ConnectorCreator, type ConnectorPluginDefinition, type ConnectorRegistryEntry, type CoreResearchTraceEvent, type CreateStrategyCore, type CreateStrategyCoreParams, DEFAULT_MARKET_UNIVERSE, type DerivativesContext, type DerivativesContextRiskFlag, type DerivativesInterval, type DerivativesIntervalContext, type DerivativesPressure, type DerivativesPriceOiDivergenceType, type DerivativesRow, type DerivativesSymbolContext, type DerivativesTargetDerivedContext, type Direction, type EOMPoint, type ExchangeEntryRecord, type ExecutionCostModel, type ExecutionCostQuality, type ExecutionCostSource, type Filters, type FundingRateHistoryRequest, type FundingRatePoint, type GetAggTrades, type GetClosedPnlParams, type GetFundingRateHistory, type GetOrderBookDepth, type GetTickers, type GetTopOfBookTicker, type GetTradingFeeRate, HYPERLIQUID_WHALE_DATA_MODEL_VERSION, type HyperliquidPositionAction, type HyperliquidWhaleCoverageRow, type HyperliquidWhaleFlowRow, type HyperliquidWhaleTradeEventRow, type Indicator, type IndicatorPluginComputeParams, type IndicatorPluginDefinition, type IndicatorPluginEntry, type IndicatorPluginFigureRenderer, type IndicatorPluginRenderer, type IndicatorSnapshot, type Indicators, type IndicatorsHistorySnapshot, type InstrumentDescriptor, type InstrumentKind, type InstrumentQuery, type InstrumentStatus, type Interval, type Item, type Items, type Kline, type KlineChartData, type KlineChartItem, type KlineRequest, type ListInstruments, type MarketBreadthRow, type MarketCmcExchangeLiquidityContextRow, type MarketCmcFearGreedContextRow, type MarketCmcIndexConstituent, type MarketCmcIndexContextRow, type MarketCmcIndexSlug, type MarketDataCapability, type MarketFeatureInterval, type MarketGlobalContextRow, type MarketGlobalContextSource, type MarketKlineEvent, type MarketReferenceAssetContextRow, type MarketTradeFlowRow, type MarketUniverse, type MetricThreshold, type Metrics, type MinimalStat, type MlCandleIndicatorsSnapshot, type MonthlyEquityStats, type OnChangeCompare, type Order, type OrderBookDepth, type OrderBookDepthRequest, type OrderLog, type OrderLogData, type OrderPositionIntent, type OrderType, type Position, type PositionLog, type PositionLogData, type PositionPnlSnapshot, type Provider, type RuntimeAiAnalysisSnapshot, type RuntimeDeployment, type RuntimeDeploymentHeartbeat, type RuntimeDeploymentStrategy, type RuntimeLineage, type RuntimeSignalEvaluationRecord, type RuntimeSignalEvaluationStatus, type RuntimeStrategyCloseNotification, type RuntimeStrategyConfigSnapshot, type RuntimeTradeExitType, type RuntimeTradeFillSource, type RuntimeTradeRecord, type RuntimeTradeStatus, type RuntimeTradeTelemetryQuality, STRATEGY_EVIDENCE_MARKERS_SCHEMA, STRATEGY_LIVE_DIAGNOSIS_SCHEMA, STRATEGY_RELEASE_SCHEMA, type Signal, type SignalAnalysis, type SignalOrderStatus, type SimpleOrderLogData, type Sl, type SpreadRow, type Strategy, type StrategyAPI, type StrategyAPIEntryParams, type StrategyAPIExitParams, type StrategyAPIProtectParams, type StrategyAdditionalIndicatorsMap, type StrategyAiAdapter, type StrategyAiMode, type StrategyChartDetail, type StrategyChartMetric, type StrategyChartMetricTone, type StrategyChartOrder, type StrategyChartSnapshot, type StrategyChartsSnapshotResponse, type StrategyClosePlan, type StrategyConfig, type StrategyConfigGrid, type StrategyCoreRunner, type StrategyCreator, type StrategyCreatorParams, type StrategyDecision, type StrategyDecisionPriceContext, type StrategyDirectionalTpSlParams, type StrategyDirectionalTpSlResult, type StrategyEntryBaseParams, type StrategyEntryModelFigures, type StrategyEntryOrderPlan, type StrategyEntryRuntimeBaseParams, type StrategyEntryRuntimeBuilderParams, type StrategyEntryRuntimeOptions, type StrategyEntrySignalContext, type StrategyEntrySignalDecisionBuilderParams, type StrategyEntryTakeProfitsParams, type StrategyEvidenceMarker, type StrategyEvidenceMarkerEnvelope, type StrategyEvidenceMarkerPayload, type StrategyEvidenceMarkerType, type StrategyEvidenceRetentionEntry, type StrategyEvidenceRetentionPlan, type StrategyEvidenceTimeline, type StrategyEvidenceTimelineSelector, type StrategyFigureAnnotation, type StrategyFigureLine, type StrategyFigurePoint, type StrategyFigurePoints, type StrategyFigureZone, type StrategyHookAfterAiContext, type StrategyHookAfterDecisionContext, type StrategyHookAfterPlaceOrderContext, type StrategyHookAiContext, type StrategyHookAiSkippedReason, type StrategyHookBarContext, type StrategyHookBeforeCloseContext, type StrategyHookBeforeEntryGateContext, type StrategyHookBeforePlaceOrderContext, type StrategyHookCtx, type StrategyHookEnrichContext, type StrategyHookEntryContext, type StrategyHookErrorContext, type StrategyHookErrorPayload, type StrategyHookGateResult, type StrategyHookInitContext, type StrategyHookMarketContext, type StrategyHookMlContext, type StrategyHookMlSkippedReason, type StrategyHookOrderContext, type StrategyHookPolicyContext, type StrategyHookSkipContext, type StrategyHookStage, type StrategyIndicatorsContext, type StrategyIndicatorsMap, type StrategyIndicatorsState, type StrategyLastTradeController, type StrategyLastTradeControllerParams, type StrategyLiveDiagnosis, type StrategyLiveDiagnosisEnvelope, type StrategyLiveDiagnosisVerdict, type StrategyManifest, type StrategyMarketContextSource, type StrategyMlAdapter, type StrategyPluginDefinition, type StrategyPolicyProfile, type StrategyProtectPlan, type StrategyRegistryEntry, type StrategyReleaseEnvelope, type StrategyReleaseEvidenceReference, type StrategyReleaseHistoricalWindow, type StrategyReleaseManifest, type StrategyReleaseReason, type StrategyReleaseResearchDecision, type StrategyReleaseResearchDecisionAction, type StrategyReleaseResearchDecisionBlocker, type StrategyReleaseResearchDecisionInput, type StrategyReleaseVerdict, type StrategyResultConfig, type StrategyResultEntry, type StrategyResults, type StrategyRuntimeAiOptions, type StrategyRuntimeMlOptions, type StrategySharedReplayStateGetter, type StrategySignalMetaParams, type StrategySignalPriceParams, type StrategyStateController, type StrategyStateControllerOptions, type Test, type TestClosedSignalResult, type TestCompare, type TestCompareList, type TestConnector, type TestConnectorContext, type TestConnectorCreator, type TestResult, type TestStat, type TestSuite, type TestThresholds, type TestThresholdsKey, type TestTradeExitReason, type TestTradeResult, type TestWorkerResult, type TestingBox, type TestingBoxResult, type TestingOptions, type ThresholdLevel, type Ticker, type TickerQuery, type TopOfBookTicker, type Tp, type TradingAccountRef, type TradingFeeRate, type Trend, type TrendLine, type TrendLineMode, type TrendLineOptions, isMarketUniverse, resolveConnectorUniverse };
|
package/dist/index.d.ts
CHANGED
|
@@ -114,6 +114,7 @@ interface TradingAccountRef {
|
|
|
114
114
|
interface RuntimeDeploymentStrategy {
|
|
115
115
|
strategyName: string;
|
|
116
116
|
policyProfileId: string;
|
|
117
|
+
releaseCompositionId?: string;
|
|
117
118
|
enabled?: boolean;
|
|
118
119
|
config?: Record<string, unknown>;
|
|
119
120
|
}
|
|
@@ -856,6 +857,7 @@ interface RuntimeAiAnalysisSnapshot {
|
|
|
856
857
|
type SignalOrderStatus = 'completed' | 'failed' | 'skipped' | 'canceled';
|
|
857
858
|
interface RuntimeLineage {
|
|
858
859
|
schemaVersion: 1;
|
|
860
|
+
compositionId?: string | null;
|
|
859
861
|
gitSha: string | null;
|
|
860
862
|
gitDirty: boolean | null;
|
|
861
863
|
gateFingerprint: string;
|
|
@@ -1065,6 +1067,7 @@ interface Test extends BacktestRunConfig {
|
|
|
1065
1067
|
ai?: boolean;
|
|
1066
1068
|
fast?: boolean;
|
|
1067
1069
|
collectReplaySignalEvaluations?: boolean;
|
|
1070
|
+
researchTrace?: boolean;
|
|
1068
1071
|
chunkId?: string;
|
|
1069
1072
|
backtestRunId?: string;
|
|
1070
1073
|
backtestTestKey?: string;
|
|
@@ -1089,12 +1092,55 @@ declare const BACKTEST_WARNING_CODES: {
|
|
|
1089
1092
|
};
|
|
1090
1093
|
type BacktestWarningCode = (typeof BACKTEST_WARNING_CODES)[keyof typeof BACKTEST_WARNING_CODES];
|
|
1091
1094
|
type BacktestWarningCounts = Partial<Record<BacktestWarningCode, number>>;
|
|
1095
|
+
type CoreResearchTraceEvent = {
|
|
1096
|
+
schema: 'tradejs-core-research-trace/v1';
|
|
1097
|
+
event: 'signal_emitted' | 'entry_rejected' | 'entry_executed';
|
|
1098
|
+
timestamp: number;
|
|
1099
|
+
strategy: string;
|
|
1100
|
+
symbol: string;
|
|
1101
|
+
direction: Direction;
|
|
1102
|
+
setupIdentity: string;
|
|
1103
|
+
setupIdentitySource: 'strategy-context' | 'signal-time-fallback';
|
|
1104
|
+
signalId: string;
|
|
1105
|
+
configId?: string;
|
|
1106
|
+
backtestRunId?: string;
|
|
1107
|
+
backtestTestKey?: string;
|
|
1108
|
+
} | {
|
|
1109
|
+
schema: 'tradejs-core-research-trace/v1';
|
|
1110
|
+
event: 'position_exited';
|
|
1111
|
+
timestamp: number;
|
|
1112
|
+
strategy: string;
|
|
1113
|
+
symbol: string;
|
|
1114
|
+
direction: Direction;
|
|
1115
|
+
setupIdentity: string;
|
|
1116
|
+
setupIdentitySource: 'strategy-context' | 'signal-time-fallback';
|
|
1117
|
+
signalId: string;
|
|
1118
|
+
configId?: string;
|
|
1119
|
+
backtestRunId?: string;
|
|
1120
|
+
backtestTestKey?: string;
|
|
1121
|
+
netProfit: number;
|
|
1122
|
+
exitReason: TestTradeExitReason;
|
|
1123
|
+
} | {
|
|
1124
|
+
schema: 'tradejs-core-research-trace/v1';
|
|
1125
|
+
event: 'skip_summary';
|
|
1126
|
+
timestamp: number;
|
|
1127
|
+
strategy: string;
|
|
1128
|
+
symbol: string;
|
|
1129
|
+
configId?: string;
|
|
1130
|
+
backtestRunId?: string;
|
|
1131
|
+
backtestTestKey?: string;
|
|
1132
|
+
skipCounts: Record<string, number>;
|
|
1133
|
+
};
|
|
1092
1134
|
interface TestingBoxResult {
|
|
1093
1135
|
orderLogId: string;
|
|
1094
1136
|
stat: MinimalStat;
|
|
1095
1137
|
inlineOrderLog?: OrderLogData;
|
|
1096
1138
|
inlinePositionLog?: PositionLogData;
|
|
1097
1139
|
inlineReplaySignalEvaluations?: RuntimeSignalEvaluationRecord[];
|
|
1140
|
+
researchTraceSummary?: {
|
|
1141
|
+
events: Record<string, number>;
|
|
1142
|
+
skipCounts: Record<string, number>;
|
|
1143
|
+
};
|
|
1098
1144
|
executionCostModel?: ExecutionCostModel;
|
|
1099
1145
|
warningCounts?: BacktestWarningCounts;
|
|
1100
1146
|
}
|
|
@@ -2524,6 +2570,11 @@ interface AiDatasetRow {
|
|
|
2524
2570
|
backtestRunId?: string;
|
|
2525
2571
|
backtestTestKey?: string;
|
|
2526
2572
|
backtestChunkId?: string;
|
|
2573
|
+
research?: {
|
|
2574
|
+
schema: 'tradejs-core-research-row/v1';
|
|
2575
|
+
setupIdentity: string;
|
|
2576
|
+
setupIdentitySource: 'strategy-context' | 'signal-time-fallback';
|
|
2577
|
+
};
|
|
2527
2578
|
}
|
|
2528
2579
|
|
|
2529
2580
|
type StrategyChartMetricTone = 'default' | 'neutral' | 'success' | 'warning' | 'error';
|
|
@@ -2605,4 +2656,262 @@ interface Item<T = Record<string, string | number | boolean>> {
|
|
|
2605
2656
|
}
|
|
2606
2657
|
type Items = Item[];
|
|
2607
2658
|
|
|
2608
|
-
|
|
2659
|
+
declare const STRATEGY_RELEASE_SCHEMA: "tradejs-strategy-release/v1";
|
|
2660
|
+
declare const STRATEGY_EVIDENCE_MARKERS_SCHEMA: "tradejs-strategy-evidence-markers/v1";
|
|
2661
|
+
declare const STRATEGY_LIVE_DIAGNOSIS_SCHEMA: "tradejs-strategy-live-diagnosis/v1";
|
|
2662
|
+
type StrategyReleaseVerdict = 'READY_FOR_RUNTIME' | 'UNSUITABLE_FOR_CURRENT_MARKET' | 'INSUFFICIENT_EVIDENCE';
|
|
2663
|
+
type StrategyReleaseResearchDecisionAction = 'REPAIR_RECENT_DIRECTION' | 'START_MICRO_FORWARD' | 'MICRO_FORWARD_READY' | 'FORWARD_BLOCKED' | 'STOP_RESEARCH';
|
|
2664
|
+
type StrategyReleaseResearchDecisionBlocker = 'HISTORICAL_MATRIX_INCOMPLETE' | 'HISTORICAL_EDGE_FAILED' | 'CANDIDATE_NOT_IMPLEMENTED' | 'FULL_PERIOD_CHART_MISSING' | 'FORWARD_NOT_AUTHORIZED' | 'RUNTIME_TARGET_UNRESOLVED' | 'FORWARD_RISK_MUST_BE_ONE';
|
|
2665
|
+
type StrategyReleaseHistoricalWindow = {
|
|
2666
|
+
days: number;
|
|
2667
|
+
coveredDays?: number;
|
|
2668
|
+
pnl: number;
|
|
2669
|
+
profitFactor: number;
|
|
2670
|
+
long: {
|
|
2671
|
+
pnl: number;
|
|
2672
|
+
profitFactor: number;
|
|
2673
|
+
};
|
|
2674
|
+
short: {
|
|
2675
|
+
pnl: number;
|
|
2676
|
+
profitFactor: number;
|
|
2677
|
+
};
|
|
2678
|
+
};
|
|
2679
|
+
type StrategyReleaseResearchDecisionInput = {
|
|
2680
|
+
strategy: string;
|
|
2681
|
+
historicalWindows: StrategyReleaseHistoricalWindow[];
|
|
2682
|
+
candidateImplemented: boolean;
|
|
2683
|
+
exposedEvaluation: boolean;
|
|
2684
|
+
chartArtifact: {
|
|
2685
|
+
path: string;
|
|
2686
|
+
sha256: string;
|
|
2687
|
+
} | null;
|
|
2688
|
+
recentFailure: {
|
|
2689
|
+
days: number;
|
|
2690
|
+
direction: 'LONG' | 'SHORT';
|
|
2691
|
+
closedTrades: number;
|
|
2692
|
+
causalMechanismIdentified: boolean;
|
|
2693
|
+
repairRoundsUsed: number;
|
|
2694
|
+
} | null;
|
|
2695
|
+
forwardTest: {
|
|
2696
|
+
authorized: boolean;
|
|
2697
|
+
runtimeTarget: {
|
|
2698
|
+
userName: string;
|
|
2699
|
+
deploymentId: string;
|
|
2700
|
+
accountId: string;
|
|
2701
|
+
strategyConfigName: string;
|
|
2702
|
+
} | null;
|
|
2703
|
+
maxLossValue: number;
|
|
2704
|
+
};
|
|
2705
|
+
};
|
|
2706
|
+
type StrategyReleaseResearchDecision = {
|
|
2707
|
+
strategy: string;
|
|
2708
|
+
action: StrategyReleaseResearchDecisionAction;
|
|
2709
|
+
repairAllowed: boolean;
|
|
2710
|
+
targetDirection: 'LONG' | 'SHORT' | null;
|
|
2711
|
+
maxLossValue: 1 | null;
|
|
2712
|
+
blockers: StrategyReleaseResearchDecisionBlocker[];
|
|
2713
|
+
summary: string;
|
|
2714
|
+
};
|
|
2715
|
+
type StrategyReleaseReason = 'NO_VERIFIED_CORE_EDGE' | 'AI_GATE_ADDS_NO_VALUE' | 'CURRENT_REGIME_UNSUITABLE' | 'RUNTIME_PARITY_BLOCKED' | 'EXECUTION_MODEL_UNSAFE' | 'RESEARCH_BUDGET_EXHAUSTED' | 'EVIDENCE_INCOMPLETE';
|
|
2716
|
+
type StrategyEvidenceMarkerType = 'G' | 'L' | 'E' | 'D' | 'P' | 'R';
|
|
2717
|
+
type StrategyEvidenceMarker = {
|
|
2718
|
+
id: string;
|
|
2719
|
+
type: StrategyEvidenceMarkerType;
|
|
2720
|
+
timestamp: number;
|
|
2721
|
+
label: string;
|
|
2722
|
+
summary: string;
|
|
2723
|
+
artifactId: string;
|
|
2724
|
+
artifactSha256: string;
|
|
2725
|
+
compositionId?: string;
|
|
2726
|
+
gitSha?: string;
|
|
2727
|
+
gateFingerprint?: string;
|
|
2728
|
+
configFingerprint?: string;
|
|
2729
|
+
contextFingerprint?: string;
|
|
2730
|
+
maxLossValue?: number;
|
|
2731
|
+
severity?: 'info' | 'warning' | 'blocking';
|
|
2732
|
+
coverage?: {
|
|
2733
|
+
startTime: number;
|
|
2734
|
+
endTime: number;
|
|
2735
|
+
};
|
|
2736
|
+
};
|
|
2737
|
+
type StrategyEvidenceTimeline = {
|
|
2738
|
+
status: 'verified' | 'missing' | 'invalid';
|
|
2739
|
+
observedFrom: number | null;
|
|
2740
|
+
markers: StrategyEvidenceMarker[];
|
|
2741
|
+
};
|
|
2742
|
+
type StrategyEvidenceTimelineSelector = {
|
|
2743
|
+
strategy: string;
|
|
2744
|
+
compositionId?: string | null;
|
|
2745
|
+
gitSha?: string | null;
|
|
2746
|
+
gateFingerprint?: string | null;
|
|
2747
|
+
configFingerprint?: string | null;
|
|
2748
|
+
contextFingerprint?: string | null;
|
|
2749
|
+
maxLossValue?: number | null;
|
|
2750
|
+
requireCompleteLineage?: boolean;
|
|
2751
|
+
};
|
|
2752
|
+
type StrategyEvidenceMarkerPayload = {
|
|
2753
|
+
strategy: string;
|
|
2754
|
+
createdAt: number;
|
|
2755
|
+
markers: StrategyEvidenceMarker[];
|
|
2756
|
+
sourceArtifacts: Array<{
|
|
2757
|
+
artifactId: string;
|
|
2758
|
+
sha256: string;
|
|
2759
|
+
path?: string;
|
|
2760
|
+
}>;
|
|
2761
|
+
};
|
|
2762
|
+
type StrategyEvidenceMarkerEnvelope = {
|
|
2763
|
+
schema: typeof STRATEGY_EVIDENCE_MARKERS_SCHEMA;
|
|
2764
|
+
artifactId: string;
|
|
2765
|
+
payloadSha256: string;
|
|
2766
|
+
payload: StrategyEvidenceMarkerPayload;
|
|
2767
|
+
};
|
|
2768
|
+
type StrategyReleaseEvidenceReference = {
|
|
2769
|
+
kind: 'core_research' | 'ai_gate' | 'runtime_parity' | 'execution_calibration' | 'runtime_evidence' | 'runtime_scorecard';
|
|
2770
|
+
artifactId: string;
|
|
2771
|
+
path: string;
|
|
2772
|
+
sha256: string;
|
|
2773
|
+
verified: boolean;
|
|
2774
|
+
lineage?: {
|
|
2775
|
+
strategy: string | null;
|
|
2776
|
+
gitSha: string | null;
|
|
2777
|
+
gitDirty: boolean | null;
|
|
2778
|
+
coreConfigSha256: string | null;
|
|
2779
|
+
gateConfigIdsFingerprint: string | null;
|
|
2780
|
+
gateFingerprint: string | null;
|
|
2781
|
+
runtimeConfigFingerprint: string | null;
|
|
2782
|
+
gateContextFingerprint: string | null;
|
|
2783
|
+
runtimeContextFingerprint: string | null;
|
|
2784
|
+
maxLossValue: number | null;
|
|
2785
|
+
sourceSha256s: string[];
|
|
2786
|
+
};
|
|
2787
|
+
releaseAssertions?: Partial<{
|
|
2788
|
+
coreEdgeVerified: boolean;
|
|
2789
|
+
aiGateAddsValue: boolean;
|
|
2790
|
+
currentMarketSuitable: boolean;
|
|
2791
|
+
runtimeParityVerified: boolean;
|
|
2792
|
+
executionModelVerified: boolean;
|
|
2793
|
+
}>;
|
|
2794
|
+
};
|
|
2795
|
+
type StrategyReleaseManifest = {
|
|
2796
|
+
schema: typeof STRATEGY_RELEASE_SCHEMA;
|
|
2797
|
+
releaseId: string;
|
|
2798
|
+
strategy: string;
|
|
2799
|
+
createdAt: number;
|
|
2800
|
+
composition: {
|
|
2801
|
+
compositionId: string;
|
|
2802
|
+
gitSha: string;
|
|
2803
|
+
coreConfigSha256: string;
|
|
2804
|
+
coreExportSha256: string;
|
|
2805
|
+
gateConfigIdsFingerprint: string;
|
|
2806
|
+
runtimeConfigFingerprint: string;
|
|
2807
|
+
gateFingerprint: string;
|
|
2808
|
+
gateContextFingerprint: string;
|
|
2809
|
+
runtimeContextFingerprint: string;
|
|
2810
|
+
maxLossValue: number;
|
|
2811
|
+
longEnabled: boolean;
|
|
2812
|
+
shortEnabled: boolean;
|
|
2813
|
+
};
|
|
2814
|
+
marketWindow: {
|
|
2815
|
+
startTime: number;
|
|
2816
|
+
endTime: number;
|
|
2817
|
+
universeSha256: string;
|
|
2818
|
+
symbols: number;
|
|
2819
|
+
cacheOnly: true;
|
|
2820
|
+
terminalDays: number[];
|
|
2821
|
+
};
|
|
2822
|
+
researchBudget: {
|
|
2823
|
+
hypothesisFamilies: number;
|
|
2824
|
+
maximumVariantsPerFamily: number;
|
|
2825
|
+
isolatedLongFinalists: number;
|
|
2826
|
+
aiGateTuningRounds: number;
|
|
2827
|
+
};
|
|
2828
|
+
evidence: StrategyReleaseEvidenceReference[];
|
|
2829
|
+
gates: {
|
|
2830
|
+
coreEdgeVerified: boolean;
|
|
2831
|
+
aiGateAddsValue: boolean;
|
|
2832
|
+
currentMarketSuitable: boolean;
|
|
2833
|
+
runtimeParityVerified: boolean;
|
|
2834
|
+
executionModelVerified: boolean;
|
|
2835
|
+
};
|
|
2836
|
+
monitoring: {
|
|
2837
|
+
minimumProspectiveClosedTrades: number;
|
|
2838
|
+
minimumParityRatio: number;
|
|
2839
|
+
maximumOrderFailureRate: number;
|
|
2840
|
+
drawdownEnvelopes: Array<{
|
|
2841
|
+
days: number;
|
|
2842
|
+
p95: number;
|
|
2843
|
+
maximum: number;
|
|
2844
|
+
}>;
|
|
2845
|
+
rawCoreExpectancy: number | null;
|
|
2846
|
+
aiGateExpectancy: number | null;
|
|
2847
|
+
minimumRegimeCoverage: number;
|
|
2848
|
+
overfitProbability: number | null;
|
|
2849
|
+
};
|
|
2850
|
+
verdict: {
|
|
2851
|
+
status: StrategyReleaseVerdict;
|
|
2852
|
+
reasons: StrategyReleaseReason[];
|
|
2853
|
+
summary: string;
|
|
2854
|
+
};
|
|
2855
|
+
prospective: {
|
|
2856
|
+
status: 'not_started' | 'incubating' | 'sufficient' | 'blocked';
|
|
2857
|
+
evidenceBooks: Array<'micro_live' | 'shadow_composition' | 'shadow_raw_core' | 'gate_comparison'>;
|
|
2858
|
+
llmComparatorPolicy: 'ai_approved_only' | 'all_core_candidates' | 'disabled';
|
|
2859
|
+
};
|
|
2860
|
+
};
|
|
2861
|
+
type StrategyReleaseEnvelope = {
|
|
2862
|
+
schema: 'tradejs-strategy-release-envelope/v1';
|
|
2863
|
+
releaseId: string;
|
|
2864
|
+
manifestSha256: string;
|
|
2865
|
+
manifest: StrategyReleaseManifest;
|
|
2866
|
+
};
|
|
2867
|
+
type StrategyLiveDiagnosisVerdict = 'RUNTIME_DIVERGENCE' | 'EXPECTED_DRAWDOWN' | 'GENERALIZATION_FAILURE' | 'INSUFFICIENT_EVIDENCE';
|
|
2868
|
+
type StrategyLiveDiagnosis = {
|
|
2869
|
+
schema: typeof STRATEGY_LIVE_DIAGNOSIS_SCHEMA;
|
|
2870
|
+
strategy: string;
|
|
2871
|
+
compositionId: string;
|
|
2872
|
+
createdAt: number;
|
|
2873
|
+
verdict: StrategyLiveDiagnosisVerdict;
|
|
2874
|
+
subtype: 'RAW_CORE_DECAY' | 'AI_GATE_FAILURE' | 'REGIME_SHIFT' | 'SUSPECTED_HISTORICAL_OVERFIT' | null;
|
|
2875
|
+
confidence: 'low' | 'medium' | 'high';
|
|
2876
|
+
evidence: {
|
|
2877
|
+
lineageComparable: boolean;
|
|
2878
|
+
riskScaleComparable: boolean;
|
|
2879
|
+
releaseMaxLossValue: number | null;
|
|
2880
|
+
runtimeMaxLossValue: number | null;
|
|
2881
|
+
riskScaleRatio: number | null;
|
|
2882
|
+
parityRatio: number | null;
|
|
2883
|
+
orderFailureRate: number | null;
|
|
2884
|
+
observedDrawdown: number | null;
|
|
2885
|
+
normalizedObservedDrawdown: number | null;
|
|
2886
|
+
historicalDrawdownP95: number | null;
|
|
2887
|
+
historicalDrawdownMaximum: number | null;
|
|
2888
|
+
closedTrades: number;
|
|
2889
|
+
rawCoreExpectancyDelta: number | null;
|
|
2890
|
+
aiGateAddedValue: number | null;
|
|
2891
|
+
regimeCoverage: number | null;
|
|
2892
|
+
overfitProbability: number | null;
|
|
2893
|
+
};
|
|
2894
|
+
explanation: string;
|
|
2895
|
+
recommendations: string[];
|
|
2896
|
+
};
|
|
2897
|
+
type StrategyLiveDiagnosisEnvelope = {
|
|
2898
|
+
schema: 'tradejs-strategy-live-diagnosis-envelope/v1';
|
|
2899
|
+
diagnosisId: string;
|
|
2900
|
+
diagnosisSha256: string;
|
|
2901
|
+
diagnosis: StrategyLiveDiagnosis;
|
|
2902
|
+
};
|
|
2903
|
+
type StrategyEvidenceRetentionEntry = {
|
|
2904
|
+
path: string;
|
|
2905
|
+
kind: 'operational_redis' | 'verbose_payload' | 'verified_runtime_bundle' | 'compact_ledger';
|
|
2906
|
+
createdAt: number;
|
|
2907
|
+
verified: boolean;
|
|
2908
|
+
aggregated: boolean;
|
|
2909
|
+
bytes: number;
|
|
2910
|
+
};
|
|
2911
|
+
type StrategyEvidenceRetentionPlan = {
|
|
2912
|
+
keep: StrategyEvidenceRetentionEntry[];
|
|
2913
|
+
delete: StrategyEvidenceRetentionEntry[];
|
|
2914
|
+
bytesReclaimable: number;
|
|
2915
|
+
};
|
|
2916
|
+
|
|
2917
|
+
export { type AIChatHistory, type AIChatMessage, type AggTrade, type AggTradesRequest, type AiDatasetRow, type AiPayload, type AiPromptPair, type AssetClass, BACKTEST_WARNING_CODES, type BacktestDetectorOptimizedStrategy, type BacktestPriceMode, type BacktestRunConfig, type BacktestWarningCode, type BacktestWarningCounts, type BaseContextGateFeatures, type BaseGateFeatureApproveBias, type BaseGateFeatureConfirmation, type BaseGateFeatureConflict, type BaseGateFeatureEntryLocation, type BaseGateFeaturePrimaryIssue, type BaseGateFeatureRiskLevel, type BaseGateFeatureScoreKey, type BaseHyperliquidWhaleFlowContext, type BaseIndicatorsHistorySnapshot, type BaseMarketBreadthContext, type BaseMarketBreadthsContext, type BaseMarketTradeFlowContext, type BaseMultiTimeframeContext, type BaseParticipationContext, type BasePsychologicalLevelAssetContext, type BasePsychologicalLevelWindowContext, type BaseRawIndicatorSnapshot, type BaseRegimeContext, type BaseRelativeContext, type BaseStrategyContextSnapshot, type BaseStructureContext, type Bot, type BotConfig, type BotResults, type BotStatus, type BuildStrategySignalDraft, type BuildStrategySignalParams, type Candle, type ChartColor, type ClosedPnlRecord, type CmcExchangeLiquidityRegime, type CmcFearGreedClassification, type CmcFearGreedRegime, type CompletedTest, type Connector, type ConnectorCapabilities, type ConnectorConfig, type ConnectorCreator, type ConnectorPluginDefinition, type ConnectorRegistryEntry, type CoreResearchTraceEvent, type CreateStrategyCore, type CreateStrategyCoreParams, DEFAULT_MARKET_UNIVERSE, type DerivativesContext, type DerivativesContextRiskFlag, type DerivativesInterval, type DerivativesIntervalContext, type DerivativesPressure, type DerivativesPriceOiDivergenceType, type DerivativesRow, type DerivativesSymbolContext, type DerivativesTargetDerivedContext, type Direction, type EOMPoint, type ExchangeEntryRecord, type ExecutionCostModel, type ExecutionCostQuality, type ExecutionCostSource, type Filters, type FundingRateHistoryRequest, type FundingRatePoint, type GetAggTrades, type GetClosedPnlParams, type GetFundingRateHistory, type GetOrderBookDepth, type GetTickers, type GetTopOfBookTicker, type GetTradingFeeRate, HYPERLIQUID_WHALE_DATA_MODEL_VERSION, type HyperliquidPositionAction, type HyperliquidWhaleCoverageRow, type HyperliquidWhaleFlowRow, type HyperliquidWhaleTradeEventRow, type Indicator, type IndicatorPluginComputeParams, type IndicatorPluginDefinition, type IndicatorPluginEntry, type IndicatorPluginFigureRenderer, type IndicatorPluginRenderer, type IndicatorSnapshot, type Indicators, type IndicatorsHistorySnapshot, type InstrumentDescriptor, type InstrumentKind, type InstrumentQuery, type InstrumentStatus, type Interval, type Item, type Items, type Kline, type KlineChartData, type KlineChartItem, type KlineRequest, type ListInstruments, type MarketBreadthRow, type MarketCmcExchangeLiquidityContextRow, type MarketCmcFearGreedContextRow, type MarketCmcIndexConstituent, type MarketCmcIndexContextRow, type MarketCmcIndexSlug, type MarketDataCapability, type MarketFeatureInterval, type MarketGlobalContextRow, type MarketGlobalContextSource, type MarketKlineEvent, type MarketReferenceAssetContextRow, type MarketTradeFlowRow, type MarketUniverse, type MetricThreshold, type Metrics, type MinimalStat, type MlCandleIndicatorsSnapshot, type MonthlyEquityStats, type OnChangeCompare, type Order, type OrderBookDepth, type OrderBookDepthRequest, type OrderLog, type OrderLogData, type OrderPositionIntent, type OrderType, type Position, type PositionLog, type PositionLogData, type PositionPnlSnapshot, type Provider, type RuntimeAiAnalysisSnapshot, type RuntimeDeployment, type RuntimeDeploymentHeartbeat, type RuntimeDeploymentStrategy, type RuntimeLineage, type RuntimeSignalEvaluationRecord, type RuntimeSignalEvaluationStatus, type RuntimeStrategyCloseNotification, type RuntimeStrategyConfigSnapshot, type RuntimeTradeExitType, type RuntimeTradeFillSource, type RuntimeTradeRecord, type RuntimeTradeStatus, type RuntimeTradeTelemetryQuality, STRATEGY_EVIDENCE_MARKERS_SCHEMA, STRATEGY_LIVE_DIAGNOSIS_SCHEMA, STRATEGY_RELEASE_SCHEMA, type Signal, type SignalAnalysis, type SignalOrderStatus, type SimpleOrderLogData, type Sl, type SpreadRow, type Strategy, type StrategyAPI, type StrategyAPIEntryParams, type StrategyAPIExitParams, type StrategyAPIProtectParams, type StrategyAdditionalIndicatorsMap, type StrategyAiAdapter, type StrategyAiMode, type StrategyChartDetail, type StrategyChartMetric, type StrategyChartMetricTone, type StrategyChartOrder, type StrategyChartSnapshot, type StrategyChartsSnapshotResponse, type StrategyClosePlan, type StrategyConfig, type StrategyConfigGrid, type StrategyCoreRunner, type StrategyCreator, type StrategyCreatorParams, type StrategyDecision, type StrategyDecisionPriceContext, type StrategyDirectionalTpSlParams, type StrategyDirectionalTpSlResult, type StrategyEntryBaseParams, type StrategyEntryModelFigures, type StrategyEntryOrderPlan, type StrategyEntryRuntimeBaseParams, type StrategyEntryRuntimeBuilderParams, type StrategyEntryRuntimeOptions, type StrategyEntrySignalContext, type StrategyEntrySignalDecisionBuilderParams, type StrategyEntryTakeProfitsParams, type StrategyEvidenceMarker, type StrategyEvidenceMarkerEnvelope, type StrategyEvidenceMarkerPayload, type StrategyEvidenceMarkerType, type StrategyEvidenceRetentionEntry, type StrategyEvidenceRetentionPlan, type StrategyEvidenceTimeline, type StrategyEvidenceTimelineSelector, type StrategyFigureAnnotation, type StrategyFigureLine, type StrategyFigurePoint, type StrategyFigurePoints, type StrategyFigureZone, type StrategyHookAfterAiContext, type StrategyHookAfterDecisionContext, type StrategyHookAfterPlaceOrderContext, type StrategyHookAiContext, type StrategyHookAiSkippedReason, type StrategyHookBarContext, type StrategyHookBeforeCloseContext, type StrategyHookBeforeEntryGateContext, type StrategyHookBeforePlaceOrderContext, type StrategyHookCtx, type StrategyHookEnrichContext, type StrategyHookEntryContext, type StrategyHookErrorContext, type StrategyHookErrorPayload, type StrategyHookGateResult, type StrategyHookInitContext, type StrategyHookMarketContext, type StrategyHookMlContext, type StrategyHookMlSkippedReason, type StrategyHookOrderContext, type StrategyHookPolicyContext, type StrategyHookSkipContext, type StrategyHookStage, type StrategyIndicatorsContext, type StrategyIndicatorsMap, type StrategyIndicatorsState, type StrategyLastTradeController, type StrategyLastTradeControllerParams, type StrategyLiveDiagnosis, type StrategyLiveDiagnosisEnvelope, type StrategyLiveDiagnosisVerdict, type StrategyManifest, type StrategyMarketContextSource, type StrategyMlAdapter, type StrategyPluginDefinition, type StrategyPolicyProfile, type StrategyProtectPlan, type StrategyRegistryEntry, type StrategyReleaseEnvelope, type StrategyReleaseEvidenceReference, type StrategyReleaseHistoricalWindow, type StrategyReleaseManifest, type StrategyReleaseReason, type StrategyReleaseResearchDecision, type StrategyReleaseResearchDecisionAction, type StrategyReleaseResearchDecisionBlocker, type StrategyReleaseResearchDecisionInput, type StrategyReleaseVerdict, type StrategyResultConfig, type StrategyResultEntry, type StrategyResults, type StrategyRuntimeAiOptions, type StrategyRuntimeMlOptions, type StrategySharedReplayStateGetter, type StrategySignalMetaParams, type StrategySignalPriceParams, type StrategyStateController, type StrategyStateControllerOptions, type Test, type TestClosedSignalResult, type TestCompare, type TestCompareList, type TestConnector, type TestConnectorContext, type TestConnectorCreator, type TestResult, type TestStat, type TestSuite, type TestThresholds, type TestThresholdsKey, type TestTradeExitReason, type TestTradeResult, type TestWorkerResult, type TestingBox, type TestingBoxResult, type TestingOptions, type ThresholdLevel, type Ticker, type TickerQuery, type TopOfBookTicker, type Tp, type TradingAccountRef, type TradingFeeRate, type Trend, type TrendLine, type TrendLineMode, type TrendLineOptions, isMarketUniverse, resolveConnectorUniverse };
|
package/dist/index.js
CHANGED
|
@@ -23,6 +23,9 @@ __export(index_exports, {
|
|
|
23
23
|
BACKTEST_WARNING_CODES: () => BACKTEST_WARNING_CODES,
|
|
24
24
|
DEFAULT_MARKET_UNIVERSE: () => DEFAULT_MARKET_UNIVERSE,
|
|
25
25
|
HYPERLIQUID_WHALE_DATA_MODEL_VERSION: () => HYPERLIQUID_WHALE_DATA_MODEL_VERSION,
|
|
26
|
+
STRATEGY_EVIDENCE_MARKERS_SCHEMA: () => STRATEGY_EVIDENCE_MARKERS_SCHEMA,
|
|
27
|
+
STRATEGY_LIVE_DIAGNOSIS_SCHEMA: () => STRATEGY_LIVE_DIAGNOSIS_SCHEMA,
|
|
28
|
+
STRATEGY_RELEASE_SCHEMA: () => STRATEGY_RELEASE_SCHEMA,
|
|
26
29
|
isMarketUniverse: () => isMarketUniverse,
|
|
27
30
|
resolveConnectorUniverse: () => resolveConnectorUniverse
|
|
28
31
|
});
|
|
@@ -51,11 +54,19 @@ var resolveConnectorUniverse = (capabilities, requested) => {
|
|
|
51
54
|
}
|
|
52
55
|
return requested;
|
|
53
56
|
};
|
|
57
|
+
|
|
58
|
+
// src/strategyRelease.ts
|
|
59
|
+
var STRATEGY_RELEASE_SCHEMA = "tradejs-strategy-release/v1";
|
|
60
|
+
var STRATEGY_EVIDENCE_MARKERS_SCHEMA = "tradejs-strategy-evidence-markers/v1";
|
|
61
|
+
var STRATEGY_LIVE_DIAGNOSIS_SCHEMA = "tradejs-strategy-live-diagnosis/v1";
|
|
54
62
|
// Annotate the CommonJS export names for ESM import in node:
|
|
55
63
|
0 && (module.exports = {
|
|
56
64
|
BACKTEST_WARNING_CODES,
|
|
57
65
|
DEFAULT_MARKET_UNIVERSE,
|
|
58
66
|
HYPERLIQUID_WHALE_DATA_MODEL_VERSION,
|
|
67
|
+
STRATEGY_EVIDENCE_MARKERS_SCHEMA,
|
|
68
|
+
STRATEGY_LIVE_DIAGNOSIS_SCHEMA,
|
|
69
|
+
STRATEGY_RELEASE_SCHEMA,
|
|
59
70
|
isMarketUniverse,
|
|
60
71
|
resolveConnectorUniverse
|
|
61
72
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -21,10 +21,18 @@ var resolveConnectorUniverse = (capabilities, requested) => {
|
|
|
21
21
|
}
|
|
22
22
|
return requested;
|
|
23
23
|
};
|
|
24
|
+
|
|
25
|
+
// src/strategyRelease.ts
|
|
26
|
+
var STRATEGY_RELEASE_SCHEMA = "tradejs-strategy-release/v1";
|
|
27
|
+
var STRATEGY_EVIDENCE_MARKERS_SCHEMA = "tradejs-strategy-evidence-markers/v1";
|
|
28
|
+
var STRATEGY_LIVE_DIAGNOSIS_SCHEMA = "tradejs-strategy-live-diagnosis/v1";
|
|
24
29
|
export {
|
|
25
30
|
BACKTEST_WARNING_CODES,
|
|
26
31
|
DEFAULT_MARKET_UNIVERSE,
|
|
27
32
|
HYPERLIQUID_WHALE_DATA_MODEL_VERSION,
|
|
33
|
+
STRATEGY_EVIDENCE_MARKERS_SCHEMA,
|
|
34
|
+
STRATEGY_LIVE_DIAGNOSIS_SCHEMA,
|
|
35
|
+
STRATEGY_RELEASE_SCHEMA,
|
|
28
36
|
isMarketUniverse,
|
|
29
37
|
resolveConnectorUniverse
|
|
30
38
|
};
|