@tradejs/types 3.0.1 → 3.1.1

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.ts CHANGED
@@ -50,6 +50,368 @@ interface MetricThreshold {
50
50
  precision: number;
51
51
  }
52
52
 
53
+ type ExecutionCostSource = 'exchange-account' | 'connector-default' | 'config' | 'historical' | 'calibrated' | 'fallback' | 'disabled' | 'unavailable';
54
+ type ExecutionCostQuality = 'full' | 'partial' | 'fallback';
55
+ interface ExecutionCostModel {
56
+ fees: {
57
+ makerRate: number;
58
+ takerRate: number;
59
+ source: ExecutionCostSource;
60
+ };
61
+ funding: {
62
+ enabled: boolean;
63
+ source: ExecutionCostSource;
64
+ points?: number;
65
+ fromTimestamp?: number | null;
66
+ toTimestamp?: number | null;
67
+ };
68
+ slippage: {
69
+ baseBps: number;
70
+ spreadMultiplier: number;
71
+ marketImpactBps: number;
72
+ delayRiskMultiplier: number;
73
+ source: ExecutionCostSource;
74
+ };
75
+ leverage: {
76
+ requested: number;
77
+ effective: number;
78
+ maxAllowed: number | null;
79
+ };
80
+ quality: ExecutionCostQuality;
81
+ capturedAt: number;
82
+ }
83
+ type Strategy = (candle: KlineChartItem, btcCandle: KlineChartItem, ethCandle?: KlineChartItem) => Promise<string | Signal>;
84
+ type BacktestDetectorOptimizedStrategy = Strategy & {
85
+ detectorFanoutKey?: string;
86
+ detectorNoSignalSkipReason?: string;
87
+ canFastAdvanceDetectorNoSignal?: boolean;
88
+ advanceDetectorNoSignal?: (candle: KlineChartItem, btcCandle: KlineChartItem, code: string) => Promise<string | Signal>;
89
+ skipDetectorNoSignal?: (candle: KlineChartItem, btcCandle: KlineChartItem, code: string) => Promise<string | Signal>;
90
+ };
91
+ type BacktestPriceMode = 'mid' | 'close' | 'open';
92
+ interface StrategyConfig {
93
+ ENABLE?: boolean;
94
+ INTERVAL?: Interval | string;
95
+ UNIVERSE?: MarketUniverse;
96
+ ACCOUNT_ID?: string;
97
+ BACKTEST_PRICE_MODE?: BacktestPriceMode;
98
+ BACKTEST_ENTRY_DELAY_BARS?: number;
99
+ BACKTEST_EXECUTION_INTERVAL?: Interval;
100
+ BACKTEST_EXECUTION_DELAY_MS?: number;
101
+ ML_ENABLED?: boolean;
102
+ POLICY_PROFILE_ID?: string;
103
+ MAKER_FEE_RATE?: number;
104
+ TAKER_FEE_RATE?: number;
105
+ FUNDING_ENABLED?: boolean;
106
+ LEVERAGE?: number;
107
+ SLIPPAGE_BASE_BPS?: number;
108
+ SLIPPAGE_SPREAD_MULTIPLIER?: number;
109
+ SLIPPAGE_MARKET_IMPACT_BPS?: number;
110
+ SLIPPAGE_DELAY_RISK_MULTIPLIER?: number;
111
+ EXECUTION_COSTS_CACHE_ONLY?: boolean;
112
+ [key: string]: any;
113
+ }
114
+ type StrategyResultConfig = StrategyConfig;
115
+ type StrategyConfigGrid = Record<string, unknown[]>;
116
+ interface RuntimeStrategyConfigSnapshot {
117
+ userConfig: StrategyConfig;
118
+ symbolResultConfig?: StrategyConfig | null;
119
+ }
120
+ interface StrategyCreatorParams {
121
+ userName: string;
122
+ connectorName: string;
123
+ symbol: string;
124
+ universe?: MarketUniverse;
125
+ assetClass?: AssetClass;
126
+ instrument?: InstrumentDescriptor;
127
+ accountId?: string;
128
+ deploymentId?: string;
129
+ policyProfileId?: string;
130
+ runtimeConfigId?: string;
131
+ runtimeReleaseVersion?: number;
132
+ entriesPaused?: boolean;
133
+ runtimeLineage?: RuntimeLineage;
134
+ runtimeConfigSnapshot?: RuntimeStrategyConfigSnapshot;
135
+ config: StrategyConfig;
136
+ connector: Connector;
137
+ data: KlineChartData;
138
+ btcData: KlineChartData;
139
+ ethData?: KlineChartData;
140
+ btcBinanceData?: KlineChartData;
141
+ btcCoinbaseData?: KlineChartData;
142
+ backtestExecutionMarketData?: {
143
+ interval: Interval;
144
+ data: KlineChartData;
145
+ btcData?: KlineChartData;
146
+ dataByTimestamp?: Map<number, KlineChartItem>;
147
+ btcDataByTimestamp?: Map<number, KlineChartItem>;
148
+ };
149
+ sharedIndicatorsReplayKey?: string;
150
+ sharedStrategyStateKey?: string;
151
+ onRuntimeClose?: (event: RuntimeStrategyCloseNotification) => void;
152
+ }
153
+ interface StrategyCreator {
154
+ (params: StrategyCreatorParams): Promise<Strategy>;
155
+ detectorKey?: (config: StrategyConfig) => string | undefined;
156
+ detectorNoSignalSkipReason?: string;
157
+ }
158
+ type TestingOptions = Pick<KlineRequest, 'start' | 'end'>;
159
+ interface BacktestRunConfig {
160
+ strategyName: string;
161
+ strategyConfig: StrategyConfig;
162
+ connectorName: string;
163
+ }
164
+ interface Test extends BacktestRunConfig {
165
+ userName: string;
166
+ name: string;
167
+ testId: string;
168
+ testSuiteId: string;
169
+ configId?: string;
170
+ symbol: string;
171
+ universe?: MarketUniverse;
172
+ assetClass?: AssetClass;
173
+ instrument?: InstrumentDescriptor;
174
+ accountId?: string;
175
+ deploymentId?: string;
176
+ policyProfileId?: string;
177
+ executionCostModel?: ExecutionCostModel;
178
+ interval?: Interval;
179
+ options: TestingOptions;
180
+ ml?: boolean;
181
+ ai?: boolean;
182
+ fast?: boolean;
183
+ collectReplaySignalEvaluations?: boolean;
184
+ researchTrace?: boolean;
185
+ chunkId?: string;
186
+ backtestRunId?: string;
187
+ backtestTestKey?: string;
188
+ timeoutMs?: number;
189
+ }
190
+ type TestSuite = Test[];
191
+ interface TestStat extends Metrics {
192
+ score?: number;
193
+ }
194
+ interface StrategyResultEntry {
195
+ config: StrategyResultConfig;
196
+ stats: TestStat;
197
+ }
198
+ type StrategyResults = Record<string, StrategyResultEntry>;
199
+ interface MinimalStat {
200
+ amount: number;
201
+ profit: number;
202
+ orders: number;
203
+ }
204
+ declare const BACKTEST_WARNING_CODES: {
205
+ readonly TAKE_PROFIT_CROSSED_BEFORE_ENTRY: "TAKE_PROFIT_CROSSED_BEFORE_ENTRY";
206
+ };
207
+ type BacktestWarningCode = (typeof BACKTEST_WARNING_CODES)[keyof typeof BACKTEST_WARNING_CODES];
208
+ type BacktestWarningCounts = Partial<Record<BacktestWarningCode, number>>;
209
+ type CoreResearchTraceEvent = {
210
+ schema: 'tradejs-core-research-trace/v1';
211
+ event: 'signal_emitted' | 'entry_rejected' | 'entry_executed';
212
+ timestamp: number;
213
+ strategy: string;
214
+ symbol: string;
215
+ direction: Direction;
216
+ setupIdentity: string;
217
+ setupIdentitySource: 'strategy-context' | 'signal-time-fallback';
218
+ signalId: string;
219
+ configId?: string;
220
+ backtestRunId?: string;
221
+ backtestTestKey?: string;
222
+ } | {
223
+ schema: 'tradejs-core-research-trace/v1';
224
+ event: 'position_exited';
225
+ timestamp: number;
226
+ strategy: string;
227
+ symbol: string;
228
+ direction: Direction;
229
+ setupIdentity: string;
230
+ setupIdentitySource: 'strategy-context' | 'signal-time-fallback';
231
+ signalId: string;
232
+ configId?: string;
233
+ backtestRunId?: string;
234
+ backtestTestKey?: string;
235
+ netProfit: number;
236
+ exitReason: TestTradeExitReason;
237
+ } | {
238
+ schema: 'tradejs-core-research-trace/v1';
239
+ event: 'skip_summary';
240
+ timestamp: number;
241
+ strategy: string;
242
+ symbol: string;
243
+ configId?: string;
244
+ backtestRunId?: string;
245
+ backtestTestKey?: string;
246
+ skipCounts: Record<string, number>;
247
+ };
248
+ interface TestingBoxResult {
249
+ orderLogId: string;
250
+ stat: MinimalStat;
251
+ inlineOrderLog?: OrderLogData;
252
+ inlinePositionLog?: PositionLogData;
253
+ inlineReplaySignalEvaluations?: RuntimeSignalEvaluationRecord[];
254
+ researchTraceSummary?: {
255
+ events: Record<string, number>;
256
+ skipCounts: Record<string, number>;
257
+ };
258
+ executionCostModel?: ExecutionCostModel;
259
+ warningCounts?: BacktestWarningCounts;
260
+ }
261
+ type TestingBox = (test: Test) => Promise<TestingBoxResult | null>;
262
+ interface TestWorkerResult extends TestingBoxResult {
263
+ test: Test;
264
+ }
265
+ interface CompletedTest extends Omit<TestWorkerResult, 'stat'> {
266
+ stat: TestStat;
267
+ }
268
+ type OrderLog = Order & {
269
+ type: OrderType;
270
+ profit: number;
271
+ amount: number;
272
+ fee?: number;
273
+ index: number;
274
+ executionSlippageStage?: 'entry' | 'exit';
275
+ executionSlippageBps?: number | null;
276
+ executionBaseSlippageBps?: number | null;
277
+ executionSpreadBps?: number | null;
278
+ executionSpreadSlippageBps?: number | null;
279
+ executionMarketImpactBps?: number | null;
280
+ executionDelayRiskBps?: number | null;
281
+ };
282
+ type OrderLogData = OrderLog[];
283
+ type SimpleOrderLogData = [number, number][];
284
+ interface TestResult extends Omit<CompletedTest, 'orderLogId'> {
285
+ orderLog: SimpleOrderLogData;
286
+ }
287
+ interface PositionLog {
288
+ direction: Direction;
289
+ open: {
290
+ amount: number;
291
+ timestamp: number;
292
+ };
293
+ close: {
294
+ amount: number;
295
+ timestamp: number;
296
+ };
297
+ }
298
+ type PositionLogData = PositionLog[];
299
+ type TestThresholds = Record<keyof TestStat, MetricThreshold>;
300
+ type TestThresholdsKey = keyof TestThresholds;
301
+ interface TestConnector extends Connector {
302
+ getResult: () => Promise<TestingBoxResult>;
303
+ checkTp: (candle: Candle) => Promise<void>;
304
+ checkSl: (candle: Candle) => Promise<void>;
305
+ checkExits: (candle: Candle) => Promise<void>;
306
+ drainMlResultsBatch: () => Promise<TestClosedSignalResult[]>;
307
+ }
308
+ type TestTradeExitReason = 'take_profit' | 'stop_loss' | 'exit';
309
+ interface TestTradeResult {
310
+ signalId: string;
311
+ /** Stable id shared by every entry leg belonging to one position lifecycle. */
312
+ positionCycleId?: string;
313
+ direction: Direction;
314
+ qty: number;
315
+ closedQty: number;
316
+ entryTimestamp: number;
317
+ exitTimestamp: number;
318
+ exitReason: TestTradeExitReason;
319
+ requestedEntryPrice: number;
320
+ entryPrice: number;
321
+ requestedExitPrice: number | null;
322
+ exitPrice: number | null;
323
+ grossProfit: number;
324
+ netProfit: number;
325
+ openFee: number;
326
+ closeFee: number;
327
+ fundingFee: number | null;
328
+ totalFee: number;
329
+ entrySlippagePrice: number;
330
+ entrySlippageBps: number;
331
+ entryBaseSlippageBps: number;
332
+ entrySpreadBps: number;
333
+ entrySpreadSlippageBps: number;
334
+ entryMarketImpactBps: number;
335
+ entryDelayRiskBps: number | null;
336
+ entrySlippageCost: number;
337
+ exitSlippagePrice: number | null;
338
+ exitSlippageBps: number | null;
339
+ exitBaseSlippageBps: number | null;
340
+ exitSpreadBps: number | null;
341
+ exitSpreadSlippageBps: number | null;
342
+ exitMarketImpactBps: number | null;
343
+ exitDelayRiskBps: number | null;
344
+ exitSlippageCost: number;
345
+ totalSlippageCost: number;
346
+ }
347
+ interface TestClosedSignalResult {
348
+ signalId: string;
349
+ profit: number;
350
+ tradeResult?: TestTradeResult;
351
+ }
352
+ interface TestConnectorContext {
353
+ userName?: string;
354
+ mlEnabled?: boolean;
355
+ aiEnabled?: boolean;
356
+ fastMode?: boolean;
357
+ instrument?: InstrumentDescriptor;
358
+ executionCostModel?: ExecutionCostModel;
359
+ fundingRates?: FundingRatePoint[];
360
+ }
361
+ type TestConnectorCreator = (connector: Connector, context?: TestConnectorContext) => TestConnector;
362
+ type ChartColor = string;
363
+ interface TestCompare {
364
+ testResult: TestResult;
365
+ color: ChartColor;
366
+ }
367
+ type TestCompareList = TestCompare[];
368
+ type OnChangeCompare = (testId: string) => void;
369
+
370
+ declare const RUNTIME_STRATEGY_RELEASE_SCHEMA: "tradejs-runtime-strategy-release/v2";
371
+ declare const RUNTIME_STRATEGY_DRAFT_SCHEMA: "tradejs-runtime-strategy-draft/v2";
372
+ type RuntimeStrategyControlState = 'active' | 'entries_paused';
373
+ /**
374
+ * An immutable strategy-owned runtime snapshot. Deployment/account bindings are
375
+ * intentionally not part of this record.
376
+ */
377
+ interface RuntimeStrategyRelease {
378
+ schema: typeof RUNTIME_STRATEGY_RELEASE_SCHEMA;
379
+ strategyName: string;
380
+ releaseVersion: number;
381
+ config: StrategyConfig;
382
+ strategyPackage: string | null;
383
+ strategyPackageVersion: string | null;
384
+ runtimePackageVersion: string | null;
385
+ createdAt: number;
386
+ createdBy: string;
387
+ contentSha256: string;
388
+ }
389
+ interface RuntimeStrategyDraft {
390
+ schema: typeof RUNTIME_STRATEGY_DRAFT_SCHEMA;
391
+ strategyName: string;
392
+ baseReleaseVersion: number | null;
393
+ config: StrategyConfig;
394
+ updatedAt: number;
395
+ updatedBy: string;
396
+ }
397
+ interface RuntimeStrategyReleaseRef {
398
+ strategyName: string;
399
+ releaseVersion: number;
400
+ controlState: RuntimeStrategyControlState;
401
+ }
402
+ type RuntimeStrategyControlEventAction = 'pause_entries' | 'resume';
403
+ interface RuntimeStrategyControlEvent {
404
+ eventId: string;
405
+ deploymentId: string;
406
+ strategyName: string;
407
+ releaseVersion: number;
408
+ action: RuntimeStrategyControlEventAction;
409
+ previousState: RuntimeStrategyControlState;
410
+ nextState: RuntimeStrategyControlState;
411
+ createdAt: number;
412
+ createdBy: string;
413
+ }
414
+
53
415
  type MarketUniverse = 'crypto' | 'tradfi';
54
416
  type AssetClass = 'crypto' | 'equity' | 'commodity' | 'forex';
55
417
  type InstrumentKind = 'perpetual' | 'spot';
@@ -113,9 +475,17 @@ interface TradingAccountRef {
113
475
  }
114
476
  interface RuntimeDeploymentStrategy {
115
477
  strategyName: string;
478
+ /** Immutable per-strategy release selected for this deployment. */
479
+ releaseVersion?: number;
480
+ /** New entries may be paused while exit/position management keeps running. */
481
+ controlState?: RuntimeStrategyControlState;
482
+ /** @deprecated Legacy runtime identity. Use releaseVersion. */
116
483
  policyProfileId?: string;
484
+ /** @deprecated Legacy evidence identity. Use releaseVersion. */
117
485
  releaseCompositionId?: string;
486
+ /** @deprecated Legacy all-or-nothing switch. Use controlState. */
118
487
  enabled?: boolean;
488
+ /** @deprecated Runtime config belongs to an immutable strategy release. */
119
489
  config?: Record<string, unknown>;
120
490
  }
121
491
  interface RuntimeDeployment {
@@ -492,13 +862,37 @@ interface PositionPnlSnapshot extends Position {
492
862
  fundingFee?: number | null;
493
863
  }
494
864
  type OrderType = 'OPEN_LONG' | 'OPEN_SHORT' | 'CLOSE_LONG' | 'CLOSE_SHORT' | 'TAKE_PROFIT_LONG' | 'TAKE_PROFIT_SHORT' | 'STOP_LOSS_LONG' | 'STOP_LOSS_SHORT';
495
- type ConnectorCreator = (config: ConnectorConfig) => Promise<Connector>;
496
865
  interface ConnectorConfig {
497
866
  userName: string;
498
867
  accountId?: string;
499
868
  deploymentId?: string;
500
869
  universe?: MarketUniverse;
501
870
  }
871
+ interface ConnectorLogger {
872
+ log: (level: string, message: string, ...meta: unknown[]) => unknown;
873
+ info: (message: string, ...meta: unknown[]) => unknown;
874
+ warn: (message: string, ...meta: unknown[]) => unknown;
875
+ error: (message: string, ...meta: unknown[]) => unknown;
876
+ }
877
+ type ConnectorAccountResolver = (params: {
878
+ userName: string;
879
+ accountId?: string;
880
+ provider: string;
881
+ universe?: MarketUniverse;
882
+ }) => Promise<TradingAccountRef | null>;
883
+ type ConnectorCachedKlineFactory = (options: {
884
+ provider: string;
885
+ request: Kline;
886
+ intervalToMinutes: (interval: Interval) => number | null;
887
+ limit?: number;
888
+ cacheFallbackWindow?: number;
889
+ }) => Kline;
890
+ interface ConnectorRuntime {
891
+ logger: ConnectorLogger;
892
+ resolveTradingAccount: ConnectorAccountResolver;
893
+ createCachedKline: ConnectorCachedKlineFactory;
894
+ }
895
+ type ConnectorCreator = (config: ConnectorConfig, runtime?: ConnectorRuntime) => Promise<Connector>;
502
896
  interface ConnectorRegistryEntry {
503
897
  name: string;
504
898
  creator: ConnectorCreator;
@@ -769,6 +1163,7 @@ interface Signal {
769
1163
  deploymentId?: string;
770
1164
  policyProfileId?: string;
771
1165
  runtimeConfigId?: string;
1166
+ runtimeReleaseVersion?: number;
772
1167
  runtimeLineage?: RuntimeLineage;
773
1168
  direction: Direction;
774
1169
  timestamp: number;
@@ -790,468 +1185,164 @@ interface Signal {
790
1185
  points?: StrategyFigurePoints[];
791
1186
  zones?: StrategyFigureZone[];
792
1187
  annotations?: StrategyFigureAnnotation[];
793
- [key: string]: any;
794
- };
795
- prices: {
796
- currentPrice: number;
797
- takeProfitPrice: number;
798
- stopLossPrice: number;
799
- riskRatio: number;
800
- };
801
- indicators: Record<string, any>;
802
- additionalIndicators?: Record<string, any>;
803
- }
804
- type RuntimeSignalEvaluationStatus = 'signal' | 'skip' | 'error';
805
- interface RuntimeSignalEvaluationRecord {
806
- evaluationId: string;
807
- userName: string;
808
- strategy: string;
809
- universe?: MarketUniverse;
810
- assetClass?: AssetClass;
811
- accountId?: string;
812
- deploymentId?: string;
813
- policyProfileId?: string;
814
- runtimeConfigId?: string;
815
- runtimeLineage?: RuntimeLineage;
816
- symbol: string;
817
- interval: Interval;
818
- timestamp: number;
819
- evaluatedAt: number;
820
- status: RuntimeSignalEvaluationStatus;
821
- reason?: string;
822
- signalId?: string;
823
- direction?: Direction;
824
- orderStatus?: SignalOrderStatus;
825
- orderSkipReason?: string;
826
- aiAnalysis?: Partial<SignalAnalysis> | null;
827
- ml?: Signal['ml'];
828
- }
829
- interface SignalAnalysis {
830
- direction: Direction | null;
831
- quality: 1 | 2 | 3 | 4 | 5 | number;
832
- needRetest: boolean;
833
- retestPrice: number | null;
834
- takeProfitPrice: number | null;
835
- stopLossPrice: number | null;
836
- setup?: string;
837
- confirmations?: string;
838
- btcContext?: string;
839
- retestPlan?: string;
840
- riskLevels?: string;
841
- qualityReason?: string;
842
- triggerInvalidation?: string;
843
- gateAnalysis?: Partial<SignalAnalysis>;
844
- gateContradictsLlm?: boolean;
845
- gateDecision?: 'approved' | 'rejected';
846
- llmDecision?: 'approved' | 'rejected';
847
- comment: string;
848
- }
849
- interface RuntimeAiAnalysisSnapshot {
850
- strategy?: string;
851
- symbol: string;
852
- direction: Direction;
853
- timestamp: number;
854
- toleranceMs?: number;
855
- analysis: Partial<SignalAnalysis>;
856
- }
857
- type SignalOrderStatus = 'completed' | 'failed' | 'skipped' | 'canceled';
858
- interface RuntimeLineage {
859
- schemaVersion: 1;
860
- compositionId?: string | null;
861
- gitSha: string | null;
862
- gitDirty: boolean | null;
863
- gateFingerprint: string;
864
- configFingerprint: string;
865
- contextFingerprint: string;
866
- maxLossValue?: number | null;
867
- }
868
- type RuntimeTradeStatus = 'active' | 'closed';
869
- type RuntimeTradeExitType = 'exit' | 'tp' | 'sl' | 'unknown';
870
- type RuntimeTradeFillSource = 'exchange_position' | 'requested_price' | 'unknown';
871
- type RuntimeTradeTelemetryQuality = 'full' | 'partial' | 'price_only' | 'none';
872
- interface RuntimeTradeRecord {
873
- orderId: string;
874
- signalId?: string;
875
- runtimeLineage?: RuntimeLineage;
876
- strategy: string;
877
- universe?: MarketUniverse;
878
- assetClass?: AssetClass;
879
- accountId?: string;
880
- deploymentId?: string;
881
- policyProfileId?: string;
882
- runtimeConfigId?: string;
883
- symbol: string;
884
- interval?: Interval;
885
- direction: Direction;
886
- qty: number;
887
- entryPrice: number;
888
- entryCount?: number;
889
- lastEntryPrice?: number | null;
890
- lastEntryQty?: number | null;
891
- lastEntryTimestamp?: number | null;
892
- actualEntryPrice?: number | null;
893
- entryTimestamp: number;
894
- signalTimestamp?: number | null;
895
- signalClosePrice?: number | null;
896
- arrivalSnapshotTime?: number | null;
897
- arrivalSource?: string | null;
898
- arrivalMid?: number | null;
899
- bid?: number | null;
900
- ask?: number | null;
901
- spreadBps?: number | null;
902
- orderSubmitTime?: number | null;
903
- orderAckTime?: number | null;
904
- fillAvgPrice?: number | null;
905
- fillSource?: RuntimeTradeFillSource | null;
906
- fillTime?: number | null;
907
- telemetryQuality?: RuntimeTradeTelemetryQuality | null;
908
- fee?: number | null;
909
- status: RuntimeTradeStatus;
910
- currentPrice?: number | null;
911
- currentPnl?: number | null;
912
- closedPnl?: number | null;
913
- exitPrice?: number | null;
914
- actualExitPrice?: number | null;
915
- exitTimestamp?: number | null;
916
- exitType?: RuntimeTradeExitType | null;
917
- openFee?: number | null;
918
- closeFee?: number | null;
919
- fundingFee?: number | null;
920
- totalFee?: number | null;
921
- aiAnalysis?: Partial<SignalAnalysis> | null;
922
- lastSyncedAt?: number;
923
- }
924
- interface RuntimeStrategyCloseNotification {
925
- userName?: string;
926
- strategy: string;
927
- openedByStrategy: string;
928
- symbol: string;
929
- direction: Direction;
930
- code: string;
931
- orderId: string;
932
- signalId?: string;
933
- qty: number;
934
- entryPrice: number;
935
- entryTimestamp: number;
936
- exitPrice?: number | null;
937
- exitTimestamp?: number | null;
938
- closedPnl?: number | null;
939
- exitType?: RuntimeTradeExitType | null;
940
- }
941
-
942
- type ExecutionCostSource = 'exchange-account' | 'connector-default' | 'config' | 'historical' | 'calibrated' | 'fallback' | 'disabled' | 'unavailable';
943
- type ExecutionCostQuality = 'full' | 'partial' | 'fallback';
944
- interface ExecutionCostModel {
945
- fees: {
946
- makerRate: number;
947
- takerRate: number;
948
- source: ExecutionCostSource;
949
- };
950
- funding: {
951
- enabled: boolean;
952
- source: ExecutionCostSource;
953
- points?: number;
954
- fromTimestamp?: number | null;
955
- toTimestamp?: number | null;
956
- };
957
- slippage: {
958
- baseBps: number;
959
- spreadMultiplier: number;
960
- marketImpactBps: number;
961
- delayRiskMultiplier: number;
962
- source: ExecutionCostSource;
963
- };
964
- leverage: {
965
- requested: number;
966
- effective: number;
967
- maxAllowed: number | null;
968
- };
969
- quality: ExecutionCostQuality;
970
- capturedAt: number;
971
- }
972
- type Strategy = (candle: KlineChartItem, btcCandle: KlineChartItem, ethCandle?: KlineChartItem) => Promise<string | Signal>;
973
- type BacktestDetectorOptimizedStrategy = Strategy & {
974
- detectorFanoutKey?: string;
975
- detectorNoSignalSkipReason?: string;
976
- canFastAdvanceDetectorNoSignal?: boolean;
977
- advanceDetectorNoSignal?: (candle: KlineChartItem, btcCandle: KlineChartItem, code: string) => Promise<string | Signal>;
978
- skipDetectorNoSignal?: (candle: KlineChartItem, btcCandle: KlineChartItem, code: string) => Promise<string | Signal>;
979
- };
980
- type BacktestPriceMode = 'mid' | 'close' | 'open';
981
- interface StrategyConfig {
982
- ENABLE?: boolean;
983
- INTERVAL?: Interval | string;
984
- UNIVERSE?: MarketUniverse;
985
- ACCOUNT_ID?: string;
986
- BACKTEST_PRICE_MODE?: BacktestPriceMode;
987
- BACKTEST_ENTRY_DELAY_BARS?: number;
988
- BACKTEST_EXECUTION_INTERVAL?: Interval;
989
- BACKTEST_EXECUTION_DELAY_MS?: number;
990
- ML_ENABLED?: boolean;
991
- POLICY_PROFILE_ID?: string;
992
- MAKER_FEE_RATE?: number;
993
- TAKER_FEE_RATE?: number;
994
- FUNDING_ENABLED?: boolean;
995
- LEVERAGE?: number;
996
- SLIPPAGE_BASE_BPS?: number;
997
- SLIPPAGE_SPREAD_MULTIPLIER?: number;
998
- SLIPPAGE_MARKET_IMPACT_BPS?: number;
999
- SLIPPAGE_DELAY_RISK_MULTIPLIER?: number;
1000
- EXECUTION_COSTS_CACHE_ONLY?: boolean;
1001
- [key: string]: any;
1002
- }
1003
- type StrategyResultConfig = StrategyConfig;
1004
- type StrategyConfigGrid = Record<string, unknown[]>;
1005
- interface RuntimeStrategyConfigSnapshot {
1006
- userConfig: StrategyConfig;
1007
- symbolResultConfig?: StrategyConfig | null;
1008
- }
1009
- interface StrategyCreatorParams {
1010
- userName: string;
1011
- connectorName: string;
1012
- symbol: string;
1013
- universe?: MarketUniverse;
1014
- assetClass?: AssetClass;
1015
- instrument?: InstrumentDescriptor;
1016
- accountId?: string;
1017
- deploymentId?: string;
1018
- policyProfileId?: string;
1019
- runtimeConfigId?: string;
1020
- runtimeConfigSnapshot?: RuntimeStrategyConfigSnapshot;
1021
- config: StrategyConfig;
1022
- connector: Connector;
1023
- data: KlineChartData;
1024
- btcData: KlineChartData;
1025
- ethData?: KlineChartData;
1026
- btcBinanceData?: KlineChartData;
1027
- btcCoinbaseData?: KlineChartData;
1028
- backtestExecutionMarketData?: {
1029
- interval: Interval;
1030
- data: KlineChartData;
1031
- btcData?: KlineChartData;
1032
- dataByTimestamp?: Map<number, KlineChartItem>;
1033
- btcDataByTimestamp?: Map<number, KlineChartItem>;
1188
+ [key: string]: any;
1034
1189
  };
1035
- sharedIndicatorsReplayKey?: string;
1036
- sharedStrategyStateKey?: string;
1037
- onRuntimeClose?: (event: RuntimeStrategyCloseNotification) => void;
1038
- }
1039
- interface StrategyCreator {
1040
- (params: StrategyCreatorParams): Promise<Strategy>;
1041
- detectorKey?: (config: StrategyConfig) => string | undefined;
1042
- detectorNoSignalSkipReason?: string;
1043
- }
1044
- type TestingOptions = Pick<KlineRequest, 'start' | 'end'>;
1045
- interface BacktestRunConfig {
1046
- strategyName: string;
1047
- strategyConfig: StrategyConfig;
1048
- connectorName: string;
1190
+ prices: {
1191
+ currentPrice: number;
1192
+ takeProfitPrice: number;
1193
+ stopLossPrice: number;
1194
+ riskRatio: number;
1195
+ };
1196
+ indicators: Record<string, any>;
1197
+ additionalIndicators?: Record<string, any>;
1049
1198
  }
1050
- interface Test extends BacktestRunConfig {
1199
+ type RuntimeSignalEvaluationStatus = 'signal' | 'skip' | 'error';
1200
+ interface RuntimeSignalEvaluationRecord {
1201
+ evaluationId: string;
1051
1202
  userName: string;
1052
- name: string;
1053
- testId: string;
1054
- testSuiteId: string;
1055
- configId?: string;
1056
- symbol: string;
1203
+ strategy: string;
1057
1204
  universe?: MarketUniverse;
1058
1205
  assetClass?: AssetClass;
1059
- instrument?: InstrumentDescriptor;
1060
1206
  accountId?: string;
1061
1207
  deploymentId?: string;
1062
1208
  policyProfileId?: string;
1063
- executionCostModel?: ExecutionCostModel;
1064
- interval?: Interval;
1065
- options: TestingOptions;
1066
- ml?: boolean;
1067
- ai?: boolean;
1068
- fast?: boolean;
1069
- collectReplaySignalEvaluations?: boolean;
1070
- researchTrace?: boolean;
1071
- chunkId?: string;
1072
- backtestRunId?: string;
1073
- backtestTestKey?: string;
1074
- timeoutMs?: number;
1075
- }
1076
- type TestSuite = Test[];
1077
- interface TestStat extends Metrics {
1078
- score?: number;
1079
- }
1080
- interface StrategyResultEntry {
1081
- config: StrategyResultConfig;
1082
- stats: TestStat;
1083
- }
1084
- type StrategyResults = Record<string, StrategyResultEntry>;
1085
- interface MinimalStat {
1086
- amount: number;
1087
- profit: number;
1088
- orders: number;
1089
- }
1090
- declare const BACKTEST_WARNING_CODES: {
1091
- readonly TAKE_PROFIT_CROSSED_BEFORE_ENTRY: "TAKE_PROFIT_CROSSED_BEFORE_ENTRY";
1092
- };
1093
- type BacktestWarningCode = (typeof BACKTEST_WARNING_CODES)[keyof typeof BACKTEST_WARNING_CODES];
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;
1209
+ runtimeConfigId?: string;
1210
+ runtimeReleaseVersion?: number;
1211
+ runtimeLineage?: RuntimeLineage;
1100
1212
  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';
1213
+ interval: Interval;
1111
1214
  timestamp: number;
1112
- strategy: string;
1215
+ evaluatedAt: number;
1216
+ status: RuntimeSignalEvaluationStatus;
1217
+ reason?: string;
1218
+ signalId?: string;
1219
+ direction?: Direction;
1220
+ orderStatus?: SignalOrderStatus;
1221
+ orderSkipReason?: string;
1222
+ aiAnalysis?: Partial<SignalAnalysis> | null;
1223
+ ml?: Signal['ml'];
1224
+ }
1225
+ interface SignalAnalysis {
1226
+ direction: Direction | null;
1227
+ quality: 1 | 2 | 3 | 4 | 5 | number;
1228
+ needRetest: boolean;
1229
+ retestPrice: number | null;
1230
+ takeProfitPrice: number | null;
1231
+ stopLossPrice: number | null;
1232
+ setup?: string;
1233
+ confirmations?: string;
1234
+ btcContext?: string;
1235
+ retestPlan?: string;
1236
+ riskLevels?: string;
1237
+ qualityReason?: string;
1238
+ triggerInvalidation?: string;
1239
+ gateAnalysis?: Partial<SignalAnalysis>;
1240
+ gateContradictsLlm?: boolean;
1241
+ gateDecision?: 'approved' | 'rejected';
1242
+ llmDecision?: 'approved' | 'rejected';
1243
+ comment: string;
1244
+ }
1245
+ interface RuntimeAiAnalysisSnapshot {
1246
+ strategy?: string;
1113
1247
  symbol: string;
1114
1248
  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
1249
  timestamp: number;
1127
- strategy: string;
1128
- symbol: string;
1129
- configId?: string;
1130
- backtestRunId?: string;
1131
- backtestTestKey?: string;
1132
- skipCounts: Record<string, number>;
1133
- };
1134
- interface TestingBoxResult {
1135
- orderLogId: string;
1136
- stat: MinimalStat;
1137
- inlineOrderLog?: OrderLogData;
1138
- inlinePositionLog?: PositionLogData;
1139
- inlineReplaySignalEvaluations?: RuntimeSignalEvaluationRecord[];
1140
- researchTraceSummary?: {
1141
- events: Record<string, number>;
1142
- skipCounts: Record<string, number>;
1143
- };
1144
- executionCostModel?: ExecutionCostModel;
1145
- warningCounts?: BacktestWarningCounts;
1146
- }
1147
- type TestingBox = (test: Test) => Promise<TestingBoxResult | null>;
1148
- interface TestWorkerResult extends TestingBoxResult {
1149
- test: Test;
1250
+ toleranceMs?: number;
1251
+ analysis: Partial<SignalAnalysis>;
1150
1252
  }
1151
- interface CompletedTest extends Omit<TestWorkerResult, 'stat'> {
1152
- stat: TestStat;
1253
+ type SignalOrderStatus = 'completed' | 'failed' | 'skipped' | 'canceled';
1254
+ interface LegacyRuntimeLineage {
1255
+ schemaVersion: 1;
1256
+ compositionId?: string | null;
1257
+ gitSha: string | null;
1258
+ gitDirty: boolean | null;
1259
+ gateFingerprint: string;
1260
+ configFingerprint: string;
1261
+ contextFingerprint: string;
1262
+ maxLossValue?: number | null;
1153
1263
  }
1154
- type OrderLog = Order & {
1155
- type: OrderType;
1156
- profit: number;
1157
- amount: number;
1158
- fee?: number;
1159
- index: number;
1160
- executionSlippageStage?: 'entry' | 'exit';
1161
- executionSlippageBps?: number | null;
1162
- executionBaseSlippageBps?: number | null;
1163
- executionSpreadBps?: number | null;
1164
- executionSpreadSlippageBps?: number | null;
1165
- executionMarketImpactBps?: number | null;
1166
- executionDelayRiskBps?: number | null;
1167
- };
1168
- type OrderLogData = OrderLog[];
1169
- type SimpleOrderLogData = [number, number][];
1170
- interface TestResult extends Omit<CompletedTest, 'orderLogId'> {
1171
- orderLog: SimpleOrderLogData;
1264
+ interface VersionedRuntimeLineage {
1265
+ schemaVersion: 2;
1266
+ releaseVersion: number;
1267
+ strategyPackageVersion?: string | null;
1268
+ runtimePackageVersion?: string | null;
1269
+ maxLossValue?: number | null;
1172
1270
  }
1173
- interface PositionLog {
1271
+ type RuntimeLineage = LegacyRuntimeLineage | VersionedRuntimeLineage;
1272
+ type RuntimeTradeStatus = 'active' | 'closed';
1273
+ type RuntimeTradeExitType = 'exit' | 'tp' | 'sl' | 'unknown';
1274
+ type RuntimeTradeFillSource = 'exchange_position' | 'requested_price' | 'unknown';
1275
+ type RuntimeTradeTelemetryQuality = 'full' | 'partial' | 'price_only' | 'none';
1276
+ interface RuntimeTradeRecord {
1277
+ orderId: string;
1278
+ signalId?: string;
1279
+ runtimeLineage?: RuntimeLineage;
1280
+ strategy: string;
1281
+ universe?: MarketUniverse;
1282
+ assetClass?: AssetClass;
1283
+ accountId?: string;
1284
+ deploymentId?: string;
1285
+ policyProfileId?: string;
1286
+ runtimeConfigId?: string;
1287
+ runtimeReleaseVersion?: number;
1288
+ symbol: string;
1289
+ interval?: Interval;
1174
1290
  direction: Direction;
1175
- open: {
1176
- amount: number;
1177
- timestamp: number;
1178
- };
1179
- close: {
1180
- amount: number;
1181
- timestamp: number;
1182
- };
1183
- }
1184
- type PositionLogData = PositionLog[];
1185
- type TestThresholds = Record<keyof TestStat, MetricThreshold>;
1186
- type TestThresholdsKey = keyof TestThresholds;
1187
- interface TestConnector extends Connector {
1188
- getResult: () => Promise<TestingBoxResult>;
1189
- checkTp: (candle: Candle) => Promise<void>;
1190
- checkSl: (candle: Candle) => Promise<void>;
1191
- checkExits: (candle: Candle) => Promise<void>;
1192
- drainMlResultsBatch: () => Promise<TestClosedSignalResult[]>;
1291
+ qty: number;
1292
+ entryPrice: number;
1293
+ entryCount?: number;
1294
+ lastEntryPrice?: number | null;
1295
+ lastEntryQty?: number | null;
1296
+ lastEntryTimestamp?: number | null;
1297
+ actualEntryPrice?: number | null;
1298
+ entryTimestamp: number;
1299
+ signalTimestamp?: number | null;
1300
+ signalClosePrice?: number | null;
1301
+ arrivalSnapshotTime?: number | null;
1302
+ arrivalSource?: string | null;
1303
+ arrivalMid?: number | null;
1304
+ bid?: number | null;
1305
+ ask?: number | null;
1306
+ spreadBps?: number | null;
1307
+ orderSubmitTime?: number | null;
1308
+ orderAckTime?: number | null;
1309
+ fillAvgPrice?: number | null;
1310
+ fillSource?: RuntimeTradeFillSource | null;
1311
+ fillTime?: number | null;
1312
+ telemetryQuality?: RuntimeTradeTelemetryQuality | null;
1313
+ fee?: number | null;
1314
+ status: RuntimeTradeStatus;
1315
+ currentPrice?: number | null;
1316
+ currentPnl?: number | null;
1317
+ closedPnl?: number | null;
1318
+ exitPrice?: number | null;
1319
+ actualExitPrice?: number | null;
1320
+ exitTimestamp?: number | null;
1321
+ exitType?: RuntimeTradeExitType | null;
1322
+ openFee?: number | null;
1323
+ closeFee?: number | null;
1324
+ fundingFee?: number | null;
1325
+ totalFee?: number | null;
1326
+ aiAnalysis?: Partial<SignalAnalysis> | null;
1327
+ lastSyncedAt?: number;
1193
1328
  }
1194
- type TestTradeExitReason = 'take_profit' | 'stop_loss' | 'exit';
1195
- interface TestTradeResult {
1196
- signalId: string;
1197
- /** Stable id shared by every entry leg belonging to one position lifecycle. */
1198
- positionCycleId?: string;
1329
+ interface RuntimeStrategyCloseNotification {
1330
+ userName?: string;
1331
+ strategy: string;
1332
+ openedByStrategy: string;
1333
+ symbol: string;
1199
1334
  direction: Direction;
1335
+ code: string;
1336
+ orderId: string;
1337
+ signalId?: string;
1200
1338
  qty: number;
1201
- closedQty: number;
1202
- entryTimestamp: number;
1203
- exitTimestamp: number;
1204
- exitReason: TestTradeExitReason;
1205
- requestedEntryPrice: number;
1206
1339
  entryPrice: number;
1207
- requestedExitPrice: number | null;
1208
- exitPrice: number | null;
1209
- grossProfit: number;
1210
- netProfit: number;
1211
- openFee: number;
1212
- closeFee: number;
1213
- fundingFee: number | null;
1214
- totalFee: number;
1215
- entrySlippagePrice: number;
1216
- entrySlippageBps: number;
1217
- entryBaseSlippageBps: number;
1218
- entrySpreadBps: number;
1219
- entrySpreadSlippageBps: number;
1220
- entryMarketImpactBps: number;
1221
- entryDelayRiskBps: number | null;
1222
- entrySlippageCost: number;
1223
- exitSlippagePrice: number | null;
1224
- exitSlippageBps: number | null;
1225
- exitBaseSlippageBps: number | null;
1226
- exitSpreadBps: number | null;
1227
- exitSpreadSlippageBps: number | null;
1228
- exitMarketImpactBps: number | null;
1229
- exitDelayRiskBps: number | null;
1230
- exitSlippageCost: number;
1231
- totalSlippageCost: number;
1232
- }
1233
- interface TestClosedSignalResult {
1234
- signalId: string;
1235
- profit: number;
1236
- tradeResult?: TestTradeResult;
1237
- }
1238
- interface TestConnectorContext {
1239
- userName?: string;
1240
- mlEnabled?: boolean;
1241
- aiEnabled?: boolean;
1242
- fastMode?: boolean;
1243
- instrument?: InstrumentDescriptor;
1244
- executionCostModel?: ExecutionCostModel;
1245
- fundingRates?: FundingRatePoint[];
1246
- }
1247
- type TestConnectorCreator = (connector: Connector, context?: TestConnectorContext) => TestConnector;
1248
- type ChartColor = string;
1249
- interface TestCompare {
1250
- testResult: TestResult;
1251
- color: ChartColor;
1340
+ entryTimestamp: number;
1341
+ exitPrice?: number | null;
1342
+ exitTimestamp?: number | null;
1343
+ closedPnl?: number | null;
1344
+ exitType?: RuntimeTradeExitType | null;
1252
1345
  }
1253
- type TestCompareList = TestCompare[];
1254
- type OnChangeCompare = (testId: string) => void;
1255
1346
 
1256
1347
  interface Bot {
1257
1348
  symbol: string;
@@ -1267,83 +1358,6 @@ interface BotStatus {
1267
1358
  type BotResults = BotStatus[];
1268
1359
  type BotConfig = Bot[];
1269
1360
 
1270
- interface StrategySignalMetaParams {
1271
- symbol: string;
1272
- interval: Interval;
1273
- direction: Direction;
1274
- timestamp: number;
1275
- isConfigFromBacktest: boolean;
1276
- }
1277
- interface StrategySignalPriceParams {
1278
- currentPrice: number;
1279
- takeProfitPrice: number;
1280
- stopLossPrice: number;
1281
- riskRatio: number;
1282
- }
1283
- interface StrategyEntryBaseParams {
1284
- qty: number;
1285
- }
1286
- interface StrategyEntryTakeProfitsParams {
1287
- takeProfits: Tp[];
1288
- }
1289
- interface StrategyEntryRuntimeBaseParams {
1290
- symbol: string;
1291
- direction: Direction;
1292
- timestamp: number;
1293
- currentPrice: number;
1294
- }
1295
- type StrategyEntryRuntimeBuilderParams<TExtra extends object = {}> = StrategyEntryRuntimeBaseParams & TExtra;
1296
- type StrategyEntrySignalDecisionBuilderParams<TPriceFields extends object = StrategySignalPriceParams, TExtra extends object = {}> = StrategySignalMetaParams & StrategyEntryBaseParams & TPriceFields & TExtra;
1297
- type StrategyIndicatorsMap = Signal['indicators'];
1298
- type StrategyAdditionalIndicatorsMap = NonNullable<Signal['additionalIndicators']>;
1299
- interface BuildStrategySignalParams {
1300
- signalId: string;
1301
- strategy: Signal['strategy'];
1302
- symbol: string;
1303
- interval: Signal['interval'];
1304
- direction: Direction;
1305
- timestamp: number;
1306
- prices: Signal['prices'];
1307
- figures?: Signal['figures'];
1308
- indicators?: Signal['indicators'];
1309
- additionalIndicators?: NonNullable<Signal['additionalIndicators']>;
1310
- isConfigFromBacktest?: boolean;
1311
- }
1312
- type BuildStrategySignalDraft = Omit<BuildStrategySignalParams, 'signalId'> & {
1313
- signalId?: string;
1314
- };
1315
- interface StrategyEntrySignalContext {
1316
- strategy: Signal['strategy'];
1317
- symbol: Signal['symbol'];
1318
- interval: Signal['interval'];
1319
- direction: Signal['direction'];
1320
- timestamp: Signal['timestamp'];
1321
- prices: Signal['prices'];
1322
- isConfigFromBacktest?: Signal['isConfigFromBacktest'];
1323
- }
1324
- interface StrategyAPIEntryParams {
1325
- code?: string;
1326
- direction: Direction;
1327
- figures?: BuildStrategySignalDraft['figures'];
1328
- indicators?: BuildStrategySignalDraft['indicators'];
1329
- additionalIndicators?: BuildStrategySignalDraft['additionalIndicators'];
1330
- signalId?: BuildStrategySignalDraft['signalId'];
1331
- orderPlan: StrategyEntryOrderPlan;
1332
- runtime?: StrategyEntryRuntimeOptions;
1333
- }
1334
- interface StrategyAPIExitParams {
1335
- code?: string;
1336
- direction: Direction;
1337
- }
1338
- interface StrategyProtectPlan {
1339
- direction: Direction;
1340
- stopLossPrice?: number | null;
1341
- takeProfits?: Tp[];
1342
- }
1343
- interface StrategyAPIProtectParams {
1344
- code?: string;
1345
- protectPlan: StrategyProtectPlan;
1346
- }
1347
1361
  interface StrategyIndicatorsContext<TIndicators = unknown> {
1348
1362
  indicators: TIndicators | undefined;
1349
1363
  baseContext?: BaseStrategyContextSnapshot;
@@ -2136,6 +2150,84 @@ interface IndicatorSnapshot {
2136
2150
  spread: number | null;
2137
2151
  baseContext?: BaseStrategyContextSnapshot;
2138
2152
  }
2153
+
2154
+ interface StrategySignalMetaParams {
2155
+ symbol: string;
2156
+ interval: Interval;
2157
+ direction: Direction;
2158
+ timestamp: number;
2159
+ isConfigFromBacktest: boolean;
2160
+ }
2161
+ interface StrategySignalPriceParams {
2162
+ currentPrice: number;
2163
+ takeProfitPrice: number;
2164
+ stopLossPrice: number;
2165
+ riskRatio: number;
2166
+ }
2167
+ interface StrategyEntryBaseParams {
2168
+ qty: number;
2169
+ }
2170
+ interface StrategyEntryTakeProfitsParams {
2171
+ takeProfits: Tp[];
2172
+ }
2173
+ interface StrategyEntryRuntimeBaseParams {
2174
+ symbol: string;
2175
+ direction: Direction;
2176
+ timestamp: number;
2177
+ currentPrice: number;
2178
+ }
2179
+ type StrategyEntryRuntimeBuilderParams<TExtra extends object = {}> = StrategyEntryRuntimeBaseParams & TExtra;
2180
+ type StrategyEntrySignalDecisionBuilderParams<TPriceFields extends object = StrategySignalPriceParams, TExtra extends object = {}> = StrategySignalMetaParams & StrategyEntryBaseParams & TPriceFields & TExtra;
2181
+ type StrategyIndicatorsMap = Signal['indicators'];
2182
+ type StrategyAdditionalIndicatorsMap = NonNullable<Signal['additionalIndicators']>;
2183
+ interface BuildStrategySignalParams {
2184
+ signalId: string;
2185
+ strategy: Signal['strategy'];
2186
+ symbol: string;
2187
+ interval: Signal['interval'];
2188
+ direction: Direction;
2189
+ timestamp: number;
2190
+ prices: Signal['prices'];
2191
+ figures?: Signal['figures'];
2192
+ indicators?: Signal['indicators'];
2193
+ additionalIndicators?: NonNullable<Signal['additionalIndicators']>;
2194
+ isConfigFromBacktest?: boolean;
2195
+ }
2196
+ type BuildStrategySignalDraft = Omit<BuildStrategySignalParams, 'signalId'> & {
2197
+ signalId?: string;
2198
+ };
2199
+ interface StrategyEntrySignalContext {
2200
+ strategy: Signal['strategy'];
2201
+ symbol: Signal['symbol'];
2202
+ interval: Signal['interval'];
2203
+ direction: Signal['direction'];
2204
+ timestamp: Signal['timestamp'];
2205
+ prices: Signal['prices'];
2206
+ isConfigFromBacktest?: Signal['isConfigFromBacktest'];
2207
+ }
2208
+ interface StrategyAPIEntryParams {
2209
+ code?: string;
2210
+ direction: Direction;
2211
+ figures?: BuildStrategySignalDraft['figures'];
2212
+ indicators?: BuildStrategySignalDraft['indicators'];
2213
+ additionalIndicators?: BuildStrategySignalDraft['additionalIndicators'];
2214
+ signalId?: BuildStrategySignalDraft['signalId'];
2215
+ orderPlan: StrategyEntryOrderPlan;
2216
+ runtime?: StrategyEntryRuntimeOptions;
2217
+ }
2218
+ interface StrategyAPIExitParams {
2219
+ code?: string;
2220
+ direction: Direction;
2221
+ }
2222
+ interface StrategyProtectPlan {
2223
+ direction: Direction;
2224
+ stopLossPrice?: number | null;
2225
+ takeProfits?: Tp[];
2226
+ }
2227
+ interface StrategyAPIProtectParams {
2228
+ code?: string;
2229
+ protectPlan: StrategyProtectPlan;
2230
+ }
2139
2231
  interface StrategyDirectionalTpSlParams {
2140
2232
  price: number;
2141
2233
  direction: Direction;
@@ -2278,6 +2370,7 @@ interface CreateStrategyCoreParams<TConfig extends StrategyConfig, TIndicatorsSt
2278
2370
  }
2279
2371
  type StrategyCoreRunner = (candle: KlineChartItem, btcCandle: KlineChartItem) => Promise<StrategyDecision> | StrategyDecision;
2280
2372
  type CreateStrategyCore<TConfig extends StrategyConfig, TSnapshot extends Record<string, any> | undefined = Record<string, any> | undefined, TNext = unknown> = (params: CreateStrategyCoreParams<TConfig, StrategyIndicatorsState<TNext, TSnapshot>>) => Promise<StrategyCoreRunner> | StrategyCoreRunner;
2373
+
2281
2374
  interface IndicatorPluginComputeParams {
2282
2375
  candle: Candle;
2283
2376
  btcCandle?: Candle;
@@ -2730,6 +2823,7 @@ type StrategyEvidenceMarker = {
2730
2823
  artifactId: string;
2731
2824
  artifactSha256: string;
2732
2825
  compositionId?: string;
2826
+ releaseVersion?: number;
2733
2827
  gitSha?: string;
2734
2828
  gateFingerprint?: string;
2735
2829
  configFingerprint?: string;
@@ -2742,12 +2836,13 @@ type StrategyEvidenceMarker = {
2742
2836
  };
2743
2837
  };
2744
2838
  type StrategyEvidenceTimeline = {
2745
- status: 'verified' | 'missing' | 'invalid';
2839
+ status: 'verified' | 'not_attached' | 'missing' | 'invalid';
2746
2840
  observedFrom: number | null;
2747
2841
  markers: StrategyEvidenceMarker[];
2748
2842
  };
2749
2843
  type StrategyEvidenceTimelineSelector = {
2750
2844
  strategy: string;
2845
+ releaseVersion?: number | null;
2751
2846
  compositionId?: string | null;
2752
2847
  gitSha?: string | null;
2753
2848
  gateFingerprint?: string | null;
@@ -2923,4 +3018,79 @@ type StrategyEvidenceRetentionPlan = {
2923
3018
  bytesReclaimable: number;
2924
3019
  };
2925
3020
 
2926
- 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 StrategyDirectionPolicy, 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 };
3021
+ interface RuntimeStrategyTradeSummary {
3022
+ totalTrades: number;
3023
+ activeTrades: number;
3024
+ closedTrades: number;
3025
+ wins: number;
3026
+ losses: number;
3027
+ activePnl: number;
3028
+ closedPnl: number;
3029
+ totalPnl: number;
3030
+ symbolConcentrationTop1: number | null;
3031
+ symbolConcentrationTop5: number | null;
3032
+ }
3033
+ interface RuntimeStrategyTradeView {
3034
+ orderId: string;
3035
+ symbol: string;
3036
+ direction: RuntimeTradeRecord['direction'];
3037
+ status: RuntimeTradeRecord['status'];
3038
+ qty: number;
3039
+ entryTimestamp: number;
3040
+ entryPrice: number;
3041
+ actualEntryPrice: number | null;
3042
+ exitTimestamp: number | null;
3043
+ exitPrice: number | null;
3044
+ actualExitPrice: number | null;
3045
+ currentPrice: number | null;
3046
+ pnl: number | null;
3047
+ durationHours: number | null;
3048
+ entrySlippagePercent: number | null;
3049
+ exitSlippagePercent: number | null;
3050
+ exitType: RuntimeTradeRecord['exitType'] | null;
3051
+ takeProfitPrice: number | null;
3052
+ stopLossPrice: number | null;
3053
+ takeProfitPercent: number | null;
3054
+ stopLossPercent: number | null;
3055
+ openFee: number | null;
3056
+ closeFee: number | null;
3057
+ fundingFee: number | null;
3058
+ totalFee: number | null;
3059
+ lastSyncedAt: number | null;
3060
+ }
3061
+ interface RuntimeStrategyView {
3062
+ runtimeKey: string;
3063
+ strategyName: string;
3064
+ configId: string;
3065
+ releaseVersion?: number;
3066
+ controlState?: RuntimeStrategyControlState;
3067
+ interval: Interval;
3068
+ universe: MarketUniverse;
3069
+ accountId?: string;
3070
+ accountLabel?: string;
3071
+ deploymentId?: string;
3072
+ policyProfileId?: string;
3073
+ connected: boolean;
3074
+ enabled: boolean;
3075
+ config: StrategyConfig | null;
3076
+ symbols: string[];
3077
+ stat: TestStat;
3078
+ summary: RuntimeStrategyTradeSummary;
3079
+ orderLog: SimpleOrderLogData;
3080
+ evidenceTimeline: StrategyEvidenceTimeline;
3081
+ recentTrades: RuntimeStrategyTradeView[];
3082
+ orders: RuntimeStrategyTradeView[];
3083
+ }
3084
+ interface RuntimeStrategiesResponse {
3085
+ provider: string;
3086
+ hours: number;
3087
+ generatedAt: number;
3088
+ dataSources?: {
3089
+ localTrades: number;
3090
+ exchangeFallbackTrades: number;
3091
+ exchangeErrors: string[];
3092
+ };
3093
+ strategies: RuntimeStrategyView[];
3094
+ }
3095
+
3096
+ 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 ConnectorAccountResolver, type ConnectorCachedKlineFactory, type ConnectorCapabilities, type ConnectorConfig, type ConnectorCreator, type ConnectorLogger, type ConnectorPluginDefinition, type ConnectorRegistryEntry, type ConnectorRuntime, 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 LegacyRuntimeLineage, 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, RUNTIME_STRATEGY_DRAFT_SCHEMA, RUNTIME_STRATEGY_RELEASE_SCHEMA, type RuntimeAiAnalysisSnapshot, type RuntimeDeployment, type RuntimeDeploymentHeartbeat, type RuntimeDeploymentStrategy, type RuntimeLineage, type RuntimeSignalEvaluationRecord, type RuntimeSignalEvaluationStatus, type RuntimeStrategiesResponse, type RuntimeStrategyCloseNotification, type RuntimeStrategyConfigSnapshot, type RuntimeStrategyControlEvent, type RuntimeStrategyControlEventAction, type RuntimeStrategyControlState, type RuntimeStrategyDraft, type RuntimeStrategyRelease, type RuntimeStrategyReleaseRef, type RuntimeStrategyTradeSummary, type RuntimeStrategyTradeView, type RuntimeStrategyView, 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 StrategyDirectionPolicy, 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, type VersionedRuntimeLineage, isMarketUniverse, resolveConnectorUniverse };