@tradejs/types 3.0.0 → 3.1.0

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 CHANGED
@@ -113,7 +113,7 @@ interface TradingAccountRef {
113
113
  }
114
114
  interface RuntimeDeploymentStrategy {
115
115
  strategyName: string;
116
- policyProfileId: string;
116
+ policyProfileId?: string;
117
117
  releaseCompositionId?: string;
118
118
  enabled?: boolean;
119
119
  config?: Record<string, unknown>;
@@ -492,13 +492,37 @@ interface PositionPnlSnapshot extends Position {
492
492
  fundingFee?: number | null;
493
493
  }
494
494
  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
495
  interface ConnectorConfig {
497
496
  userName: string;
498
497
  accountId?: string;
499
498
  deploymentId?: string;
500
499
  universe?: MarketUniverse;
501
500
  }
501
+ interface ConnectorLogger {
502
+ log: (level: string, message: string, ...meta: unknown[]) => unknown;
503
+ info: (message: string, ...meta: unknown[]) => unknown;
504
+ warn: (message: string, ...meta: unknown[]) => unknown;
505
+ error: (message: string, ...meta: unknown[]) => unknown;
506
+ }
507
+ type ConnectorAccountResolver = (params: {
508
+ userName: string;
509
+ accountId?: string;
510
+ provider: string;
511
+ universe?: MarketUniverse;
512
+ }) => Promise<TradingAccountRef | null>;
513
+ type ConnectorCachedKlineFactory = (options: {
514
+ provider: string;
515
+ request: Kline;
516
+ intervalToMinutes: (interval: Interval) => number | null;
517
+ limit?: number;
518
+ cacheFallbackWindow?: number;
519
+ }) => Kline;
520
+ interface ConnectorRuntime {
521
+ logger: ConnectorLogger;
522
+ resolveTradingAccount: ConnectorAccountResolver;
523
+ createCachedKline: ConnectorCachedKlineFactory;
524
+ }
525
+ type ConnectorCreator = (config: ConnectorConfig, runtime?: ConnectorRuntime) => Promise<Connector>;
502
526
  interface ConnectorRegistryEntry {
503
527
  name: string;
504
528
  creator: ConnectorCreator;
@@ -1267,83 +1291,6 @@ interface BotStatus {
1267
1291
  type BotResults = BotStatus[];
1268
1292
  type BotConfig = Bot[];
1269
1293
 
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
1294
  interface StrategyIndicatorsContext<TIndicators = unknown> {
1348
1295
  indicators: TIndicators | undefined;
1349
1296
  baseContext?: BaseStrategyContextSnapshot;
@@ -2136,6 +2083,84 @@ interface IndicatorSnapshot {
2136
2083
  spread: number | null;
2137
2084
  baseContext?: BaseStrategyContextSnapshot;
2138
2085
  }
2086
+
2087
+ interface StrategySignalMetaParams {
2088
+ symbol: string;
2089
+ interval: Interval;
2090
+ direction: Direction;
2091
+ timestamp: number;
2092
+ isConfigFromBacktest: boolean;
2093
+ }
2094
+ interface StrategySignalPriceParams {
2095
+ currentPrice: number;
2096
+ takeProfitPrice: number;
2097
+ stopLossPrice: number;
2098
+ riskRatio: number;
2099
+ }
2100
+ interface StrategyEntryBaseParams {
2101
+ qty: number;
2102
+ }
2103
+ interface StrategyEntryTakeProfitsParams {
2104
+ takeProfits: Tp[];
2105
+ }
2106
+ interface StrategyEntryRuntimeBaseParams {
2107
+ symbol: string;
2108
+ direction: Direction;
2109
+ timestamp: number;
2110
+ currentPrice: number;
2111
+ }
2112
+ type StrategyEntryRuntimeBuilderParams<TExtra extends object = {}> = StrategyEntryRuntimeBaseParams & TExtra;
2113
+ type StrategyEntrySignalDecisionBuilderParams<TPriceFields extends object = StrategySignalPriceParams, TExtra extends object = {}> = StrategySignalMetaParams & StrategyEntryBaseParams & TPriceFields & TExtra;
2114
+ type StrategyIndicatorsMap = Signal['indicators'];
2115
+ type StrategyAdditionalIndicatorsMap = NonNullable<Signal['additionalIndicators']>;
2116
+ interface BuildStrategySignalParams {
2117
+ signalId: string;
2118
+ strategy: Signal['strategy'];
2119
+ symbol: string;
2120
+ interval: Signal['interval'];
2121
+ direction: Direction;
2122
+ timestamp: number;
2123
+ prices: Signal['prices'];
2124
+ figures?: Signal['figures'];
2125
+ indicators?: Signal['indicators'];
2126
+ additionalIndicators?: NonNullable<Signal['additionalIndicators']>;
2127
+ isConfigFromBacktest?: boolean;
2128
+ }
2129
+ type BuildStrategySignalDraft = Omit<BuildStrategySignalParams, 'signalId'> & {
2130
+ signalId?: string;
2131
+ };
2132
+ interface StrategyEntrySignalContext {
2133
+ strategy: Signal['strategy'];
2134
+ symbol: Signal['symbol'];
2135
+ interval: Signal['interval'];
2136
+ direction: Signal['direction'];
2137
+ timestamp: Signal['timestamp'];
2138
+ prices: Signal['prices'];
2139
+ isConfigFromBacktest?: Signal['isConfigFromBacktest'];
2140
+ }
2141
+ interface StrategyAPIEntryParams {
2142
+ code?: string;
2143
+ direction: Direction;
2144
+ figures?: BuildStrategySignalDraft['figures'];
2145
+ indicators?: BuildStrategySignalDraft['indicators'];
2146
+ additionalIndicators?: BuildStrategySignalDraft['additionalIndicators'];
2147
+ signalId?: BuildStrategySignalDraft['signalId'];
2148
+ orderPlan: StrategyEntryOrderPlan;
2149
+ runtime?: StrategyEntryRuntimeOptions;
2150
+ }
2151
+ interface StrategyAPIExitParams {
2152
+ code?: string;
2153
+ direction: Direction;
2154
+ }
2155
+ interface StrategyProtectPlan {
2156
+ direction: Direction;
2157
+ stopLossPrice?: number | null;
2158
+ takeProfits?: Tp[];
2159
+ }
2160
+ interface StrategyAPIProtectParams {
2161
+ code?: string;
2162
+ protectPlan: StrategyProtectPlan;
2163
+ }
2139
2164
  interface StrategyDirectionalTpSlParams {
2140
2165
  price: number;
2141
2166
  direction: Direction;
@@ -2278,6 +2303,7 @@ interface CreateStrategyCoreParams<TConfig extends StrategyConfig, TIndicatorsSt
2278
2303
  }
2279
2304
  type StrategyCoreRunner = (candle: KlineChartItem, btcCandle: KlineChartItem) => Promise<StrategyDecision> | StrategyDecision;
2280
2305
  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;
2306
+
2281
2307
  interface IndicatorPluginComputeParams {
2282
2308
  candle: Candle;
2283
2309
  btcCandle?: Candle;
@@ -2923,4 +2949,77 @@ type StrategyEvidenceRetentionPlan = {
2923
2949
  bytesReclaimable: number;
2924
2950
  };
2925
2951
 
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 };
2952
+ interface RuntimeStrategyTradeSummary {
2953
+ totalTrades: number;
2954
+ activeTrades: number;
2955
+ closedTrades: number;
2956
+ wins: number;
2957
+ losses: number;
2958
+ activePnl: number;
2959
+ closedPnl: number;
2960
+ totalPnl: number;
2961
+ symbolConcentrationTop1: number | null;
2962
+ symbolConcentrationTop5: number | null;
2963
+ }
2964
+ interface RuntimeStrategyTradeView {
2965
+ orderId: string;
2966
+ symbol: string;
2967
+ direction: RuntimeTradeRecord['direction'];
2968
+ status: RuntimeTradeRecord['status'];
2969
+ qty: number;
2970
+ entryTimestamp: number;
2971
+ entryPrice: number;
2972
+ actualEntryPrice: number | null;
2973
+ exitTimestamp: number | null;
2974
+ exitPrice: number | null;
2975
+ actualExitPrice: number | null;
2976
+ currentPrice: number | null;
2977
+ pnl: number | null;
2978
+ durationHours: number | null;
2979
+ entrySlippagePercent: number | null;
2980
+ exitSlippagePercent: number | null;
2981
+ exitType: RuntimeTradeRecord['exitType'] | null;
2982
+ takeProfitPrice: number | null;
2983
+ stopLossPrice: number | null;
2984
+ takeProfitPercent: number | null;
2985
+ stopLossPercent: number | null;
2986
+ openFee: number | null;
2987
+ closeFee: number | null;
2988
+ fundingFee: number | null;
2989
+ totalFee: number | null;
2990
+ lastSyncedAt: number | null;
2991
+ }
2992
+ interface RuntimeStrategyView {
2993
+ runtimeKey: string;
2994
+ strategyName: string;
2995
+ configId: string;
2996
+ interval: Interval;
2997
+ universe: MarketUniverse;
2998
+ accountId?: string;
2999
+ accountLabel?: string;
3000
+ deploymentId?: string;
3001
+ policyProfileId?: string;
3002
+ connected: boolean;
3003
+ enabled: boolean;
3004
+ config: StrategyConfig | null;
3005
+ symbols: string[];
3006
+ stat: TestStat;
3007
+ summary: RuntimeStrategyTradeSummary;
3008
+ orderLog: SimpleOrderLogData;
3009
+ evidenceTimeline: StrategyEvidenceTimeline;
3010
+ recentTrades: RuntimeStrategyTradeView[];
3011
+ orders: RuntimeStrategyTradeView[];
3012
+ }
3013
+ interface RuntimeStrategiesResponse {
3014
+ provider: string;
3015
+ hours: number;
3016
+ generatedAt: number;
3017
+ dataSources?: {
3018
+ localTrades: number;
3019
+ exchangeFallbackTrades: number;
3020
+ exchangeErrors: string[];
3021
+ };
3022
+ strategies: RuntimeStrategyView[];
3023
+ }
3024
+
3025
+ 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 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 RuntimeStrategiesResponse, type RuntimeStrategyCloseNotification, type RuntimeStrategyConfigSnapshot, 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, isMarketUniverse, resolveConnectorUniverse };
package/dist/index.d.ts CHANGED
@@ -113,7 +113,7 @@ interface TradingAccountRef {
113
113
  }
114
114
  interface RuntimeDeploymentStrategy {
115
115
  strategyName: string;
116
- policyProfileId: string;
116
+ policyProfileId?: string;
117
117
  releaseCompositionId?: string;
118
118
  enabled?: boolean;
119
119
  config?: Record<string, unknown>;
@@ -492,13 +492,37 @@ interface PositionPnlSnapshot extends Position {
492
492
  fundingFee?: number | null;
493
493
  }
494
494
  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
495
  interface ConnectorConfig {
497
496
  userName: string;
498
497
  accountId?: string;
499
498
  deploymentId?: string;
500
499
  universe?: MarketUniverse;
501
500
  }
501
+ interface ConnectorLogger {
502
+ log: (level: string, message: string, ...meta: unknown[]) => unknown;
503
+ info: (message: string, ...meta: unknown[]) => unknown;
504
+ warn: (message: string, ...meta: unknown[]) => unknown;
505
+ error: (message: string, ...meta: unknown[]) => unknown;
506
+ }
507
+ type ConnectorAccountResolver = (params: {
508
+ userName: string;
509
+ accountId?: string;
510
+ provider: string;
511
+ universe?: MarketUniverse;
512
+ }) => Promise<TradingAccountRef | null>;
513
+ type ConnectorCachedKlineFactory = (options: {
514
+ provider: string;
515
+ request: Kline;
516
+ intervalToMinutes: (interval: Interval) => number | null;
517
+ limit?: number;
518
+ cacheFallbackWindow?: number;
519
+ }) => Kline;
520
+ interface ConnectorRuntime {
521
+ logger: ConnectorLogger;
522
+ resolveTradingAccount: ConnectorAccountResolver;
523
+ createCachedKline: ConnectorCachedKlineFactory;
524
+ }
525
+ type ConnectorCreator = (config: ConnectorConfig, runtime?: ConnectorRuntime) => Promise<Connector>;
502
526
  interface ConnectorRegistryEntry {
503
527
  name: string;
504
528
  creator: ConnectorCreator;
@@ -1267,83 +1291,6 @@ interface BotStatus {
1267
1291
  type BotResults = BotStatus[];
1268
1292
  type BotConfig = Bot[];
1269
1293
 
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
1294
  interface StrategyIndicatorsContext<TIndicators = unknown> {
1348
1295
  indicators: TIndicators | undefined;
1349
1296
  baseContext?: BaseStrategyContextSnapshot;
@@ -2136,6 +2083,84 @@ interface IndicatorSnapshot {
2136
2083
  spread: number | null;
2137
2084
  baseContext?: BaseStrategyContextSnapshot;
2138
2085
  }
2086
+
2087
+ interface StrategySignalMetaParams {
2088
+ symbol: string;
2089
+ interval: Interval;
2090
+ direction: Direction;
2091
+ timestamp: number;
2092
+ isConfigFromBacktest: boolean;
2093
+ }
2094
+ interface StrategySignalPriceParams {
2095
+ currentPrice: number;
2096
+ takeProfitPrice: number;
2097
+ stopLossPrice: number;
2098
+ riskRatio: number;
2099
+ }
2100
+ interface StrategyEntryBaseParams {
2101
+ qty: number;
2102
+ }
2103
+ interface StrategyEntryTakeProfitsParams {
2104
+ takeProfits: Tp[];
2105
+ }
2106
+ interface StrategyEntryRuntimeBaseParams {
2107
+ symbol: string;
2108
+ direction: Direction;
2109
+ timestamp: number;
2110
+ currentPrice: number;
2111
+ }
2112
+ type StrategyEntryRuntimeBuilderParams<TExtra extends object = {}> = StrategyEntryRuntimeBaseParams & TExtra;
2113
+ type StrategyEntrySignalDecisionBuilderParams<TPriceFields extends object = StrategySignalPriceParams, TExtra extends object = {}> = StrategySignalMetaParams & StrategyEntryBaseParams & TPriceFields & TExtra;
2114
+ type StrategyIndicatorsMap = Signal['indicators'];
2115
+ type StrategyAdditionalIndicatorsMap = NonNullable<Signal['additionalIndicators']>;
2116
+ interface BuildStrategySignalParams {
2117
+ signalId: string;
2118
+ strategy: Signal['strategy'];
2119
+ symbol: string;
2120
+ interval: Signal['interval'];
2121
+ direction: Direction;
2122
+ timestamp: number;
2123
+ prices: Signal['prices'];
2124
+ figures?: Signal['figures'];
2125
+ indicators?: Signal['indicators'];
2126
+ additionalIndicators?: NonNullable<Signal['additionalIndicators']>;
2127
+ isConfigFromBacktest?: boolean;
2128
+ }
2129
+ type BuildStrategySignalDraft = Omit<BuildStrategySignalParams, 'signalId'> & {
2130
+ signalId?: string;
2131
+ };
2132
+ interface StrategyEntrySignalContext {
2133
+ strategy: Signal['strategy'];
2134
+ symbol: Signal['symbol'];
2135
+ interval: Signal['interval'];
2136
+ direction: Signal['direction'];
2137
+ timestamp: Signal['timestamp'];
2138
+ prices: Signal['prices'];
2139
+ isConfigFromBacktest?: Signal['isConfigFromBacktest'];
2140
+ }
2141
+ interface StrategyAPIEntryParams {
2142
+ code?: string;
2143
+ direction: Direction;
2144
+ figures?: BuildStrategySignalDraft['figures'];
2145
+ indicators?: BuildStrategySignalDraft['indicators'];
2146
+ additionalIndicators?: BuildStrategySignalDraft['additionalIndicators'];
2147
+ signalId?: BuildStrategySignalDraft['signalId'];
2148
+ orderPlan: StrategyEntryOrderPlan;
2149
+ runtime?: StrategyEntryRuntimeOptions;
2150
+ }
2151
+ interface StrategyAPIExitParams {
2152
+ code?: string;
2153
+ direction: Direction;
2154
+ }
2155
+ interface StrategyProtectPlan {
2156
+ direction: Direction;
2157
+ stopLossPrice?: number | null;
2158
+ takeProfits?: Tp[];
2159
+ }
2160
+ interface StrategyAPIProtectParams {
2161
+ code?: string;
2162
+ protectPlan: StrategyProtectPlan;
2163
+ }
2139
2164
  interface StrategyDirectionalTpSlParams {
2140
2165
  price: number;
2141
2166
  direction: Direction;
@@ -2278,6 +2303,7 @@ interface CreateStrategyCoreParams<TConfig extends StrategyConfig, TIndicatorsSt
2278
2303
  }
2279
2304
  type StrategyCoreRunner = (candle: KlineChartItem, btcCandle: KlineChartItem) => Promise<StrategyDecision> | StrategyDecision;
2280
2305
  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;
2306
+
2281
2307
  interface IndicatorPluginComputeParams {
2282
2308
  candle: Candle;
2283
2309
  btcCandle?: Candle;
@@ -2923,4 +2949,77 @@ type StrategyEvidenceRetentionPlan = {
2923
2949
  bytesReclaimable: number;
2924
2950
  };
2925
2951
 
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 };
2952
+ interface RuntimeStrategyTradeSummary {
2953
+ totalTrades: number;
2954
+ activeTrades: number;
2955
+ closedTrades: number;
2956
+ wins: number;
2957
+ losses: number;
2958
+ activePnl: number;
2959
+ closedPnl: number;
2960
+ totalPnl: number;
2961
+ symbolConcentrationTop1: number | null;
2962
+ symbolConcentrationTop5: number | null;
2963
+ }
2964
+ interface RuntimeStrategyTradeView {
2965
+ orderId: string;
2966
+ symbol: string;
2967
+ direction: RuntimeTradeRecord['direction'];
2968
+ status: RuntimeTradeRecord['status'];
2969
+ qty: number;
2970
+ entryTimestamp: number;
2971
+ entryPrice: number;
2972
+ actualEntryPrice: number | null;
2973
+ exitTimestamp: number | null;
2974
+ exitPrice: number | null;
2975
+ actualExitPrice: number | null;
2976
+ currentPrice: number | null;
2977
+ pnl: number | null;
2978
+ durationHours: number | null;
2979
+ entrySlippagePercent: number | null;
2980
+ exitSlippagePercent: number | null;
2981
+ exitType: RuntimeTradeRecord['exitType'] | null;
2982
+ takeProfitPrice: number | null;
2983
+ stopLossPrice: number | null;
2984
+ takeProfitPercent: number | null;
2985
+ stopLossPercent: number | null;
2986
+ openFee: number | null;
2987
+ closeFee: number | null;
2988
+ fundingFee: number | null;
2989
+ totalFee: number | null;
2990
+ lastSyncedAt: number | null;
2991
+ }
2992
+ interface RuntimeStrategyView {
2993
+ runtimeKey: string;
2994
+ strategyName: string;
2995
+ configId: string;
2996
+ interval: Interval;
2997
+ universe: MarketUniverse;
2998
+ accountId?: string;
2999
+ accountLabel?: string;
3000
+ deploymentId?: string;
3001
+ policyProfileId?: string;
3002
+ connected: boolean;
3003
+ enabled: boolean;
3004
+ config: StrategyConfig | null;
3005
+ symbols: string[];
3006
+ stat: TestStat;
3007
+ summary: RuntimeStrategyTradeSummary;
3008
+ orderLog: SimpleOrderLogData;
3009
+ evidenceTimeline: StrategyEvidenceTimeline;
3010
+ recentTrades: RuntimeStrategyTradeView[];
3011
+ orders: RuntimeStrategyTradeView[];
3012
+ }
3013
+ interface RuntimeStrategiesResponse {
3014
+ provider: string;
3015
+ hours: number;
3016
+ generatedAt: number;
3017
+ dataSources?: {
3018
+ localTrades: number;
3019
+ exchangeFallbackTrades: number;
3020
+ exchangeErrors: string[];
3021
+ };
3022
+ strategies: RuntimeStrategyView[];
3023
+ }
3024
+
3025
+ 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 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 RuntimeStrategiesResponse, type RuntimeStrategyCloseNotification, type RuntimeStrategyConfigSnapshot, 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, isMarketUniverse, resolveConnectorUniverse };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradejs/types",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "MIT-licensed shared TypeScript contracts for the TradeJS framework.",
5
5
  "keywords": [
6
6
  "tradejs",