@tradejs/types 3.1.29-beta.289 → 3.1.29-beta.291

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
@@ -82,6 +82,94 @@ type ResearchEntryDecision = {
82
82
  }>;
83
83
  };
84
84
 
85
+ /** Explicitly opt in. R is frozen for the policy, not the sum of open risks. */
86
+ interface PortfolioPolicyConfig {
87
+ id: string;
88
+ scope: 'strategy' | 'account' | {
89
+ strategies: string[];
90
+ };
91
+ riskUnit: number;
92
+ observationIntervalMs: number;
93
+ maxPriceAgeMs: number;
94
+ maxPositions?: number;
95
+ profitExit?: {
96
+ scope: 'position' | 'basket';
97
+ multiple: number;
98
+ minPositions?: number;
99
+ };
100
+ closeOppositeOnFill?: boolean;
101
+ }
102
+ interface PortfolioPosition {
103
+ id: string;
104
+ strategy: string | null;
105
+ symbol: string;
106
+ direction: Direction;
107
+ qty: number;
108
+ entryPrice: number;
109
+ markPrice: number | null;
110
+ markedAt: number | null;
111
+ stopLossPrice?: number | null;
112
+ }
113
+ interface PortfolioOrderObservation {
114
+ id: string;
115
+ status: 'pending' | 'partial' | 'filled' | 'cancelled' | 'rejected';
116
+ filledQty: number;
117
+ positionId?: string;
118
+ }
119
+ interface PortfolioObservation {
120
+ asOf: number;
121
+ positions: PortfolioPosition[];
122
+ orders: PortfolioOrderObservation[];
123
+ }
124
+ interface PortfolioReservation {
125
+ id: string;
126
+ signalId: string;
127
+ strategy: string;
128
+ symbol: string;
129
+ direction: Direction;
130
+ qty: number;
131
+ timestamp: number;
132
+ /** A reservation exists before any request can leave the process. */
133
+ submitted: boolean;
134
+ oppositeHandled: boolean;
135
+ }
136
+ interface PortfolioCloseIntent {
137
+ positionId: string;
138
+ position: PortfolioPosition;
139
+ reason: 'PORTFOLIO_PROFIT_POSITION' | 'PORTFOLIO_PROFIT_BASKET' | 'PORTFOLIO_OPPOSITE_FILL';
140
+ createdAt: number;
141
+ lastAttemptAt: number | null;
142
+ }
143
+ interface PortfolioState {
144
+ schema: 'tradejs-portfolio/v1';
145
+ revision: number;
146
+ fingerprint: string;
147
+ reservations: PortfolioReservation[];
148
+ closing: PortfolioCloseIntent[];
149
+ completedSignals: Record<string, number>;
150
+ observedAt: number;
151
+ evaluatedAt: number;
152
+ blockedThrough: number;
153
+ }
154
+ interface PortfolioContext {
155
+ schema: 'tradejs-portfolio-context/v1';
156
+ asOf: number;
157
+ policyId: string;
158
+ positionCount: number;
159
+ pendingEntryCount: number;
160
+ longCount: number;
161
+ shortCount: number;
162
+ grossUnrealizedPnlR: number | null;
163
+ openStopRiskR: number | null;
164
+ largestPositionShare: number | null;
165
+ pricesComplete: boolean;
166
+ unknownOwnershipCount: number;
167
+ }
168
+ interface PortfolioStateStore {
169
+ read(): Promise<PortfolioState | null>;
170
+ compare(expected: PortfolioState | null, next: PortfolioState): Promise<boolean>;
171
+ }
172
+
85
173
  type JevDimension = 'trend' | 'swing' | 'participation' | 'setupParticipation' | 'extension' | 'confirmation' | 'setupStrength' | 'geometry' | 'signalStrength';
86
174
  /** Internal scores stay normalized; signalStrength is exported on a 1–10 scale. */
87
175
  type JevScores = Record<JevDimension, number | null>;
@@ -268,6 +356,7 @@ type BacktestDetectorOptimizedStrategy = Strategy & {
268
356
  };
269
357
  type BacktestPriceMode = 'mid' | 'close' | 'open';
270
358
  interface StrategyConfig {
359
+ PORTFOLIO_POLICY?: PortfolioPolicyConfig;
271
360
  RESEARCH_ENTRY_POLICY?: ResearchEntryPolicy;
272
361
  JEV?: JevConfig;
273
362
  ENABLE?: boolean;
@@ -725,6 +814,30 @@ declare const DEFAULT_MARKET_UNIVERSE: MarketUniverse;
725
814
  declare const isMarketUniverse: (value: unknown) => value is MarketUniverse;
726
815
  declare const resolveConnectorUniverse: (capabilities: ConnectorCapabilities, requested?: unknown) => MarketUniverse;
727
816
 
817
+ type AiFeatureRole = 'input' | 'data-quality' | 'metadata' | 'outcome' | 'policy';
818
+ type AiFeaturePrimitive = number | string | boolean | null;
819
+ /** Explicit strategy extensions use paths in the untrimmed signal projection. */
820
+ interface AiFeatureDefinition {
821
+ id: string;
822
+ version: number;
823
+ path: string;
824
+ source?: 'signal' | 'payload';
825
+ stationary?: boolean;
826
+ role: AiFeatureRole;
827
+ scope: 'target' | 'benchmark' | 'global' | 'setup';
828
+ unit: string;
829
+ description: string;
830
+ /** Arrays require an explicit causal reduction, never implicit truncation. */
831
+ reduction?: 'last' | 'mean' | 'min' | 'max' | 'count';
832
+ /** Source field used for a ratio; division by zero or missing returns null. */
833
+ divideBy?: string;
834
+ }
835
+ interface AiFeatureSnapshot {
836
+ schema: 'tradejs-ai-features/v1';
837
+ definitions: readonly AiFeatureDefinition[];
838
+ values: Record<string, AiFeaturePrimitive>;
839
+ }
840
+
728
841
  type Interval = '1' | '3' | '5' | '15' | '30' | '60' | '120' | '240' | '360' | '720' | 'D' | 'W' | 'M';
729
842
  type Provider = 'bybit' | 'binance' | 'coinbase';
730
843
  interface Candle {
@@ -1056,6 +1169,8 @@ type Order = {
1056
1169
  leverage?: number;
1057
1170
  orderId?: string;
1058
1171
  signal?: Signal;
1172
+ /** Only an authoritative rejection; never call for a timeout or ambiguous response. */
1173
+ onRejected?: () => Promise<void>;
1059
1174
  /** Await after preparation/quantity normalization, immediately before submission. */
1060
1175
  beforeSubmit?: (context: {
1061
1176
  qty: number;
@@ -1072,6 +1187,7 @@ type Position = {
1072
1187
  tpPrice?: number;
1073
1188
  };
1074
1189
  interface PositionPnlSnapshot extends Position {
1190
+ observedAt?: number;
1075
1191
  currentPrice: number;
1076
1192
  unrealizedPnl: number;
1077
1193
  takeProfitPrice?: number | null;
@@ -1192,6 +1308,8 @@ type GetTopOfBookTicker = (symbol: string) => Promise<TopOfBookTicker | null>;
1192
1308
  type GetAggTrades = (request: AggTradesRequest) => Promise<AggTrade[]>;
1193
1309
  type GetOrderBookDepth = (request: OrderBookDepthRequest) => Promise<OrderBookDepth | null>;
1194
1310
  interface Connector {
1311
+ /** Coherent simulation observation; live ownership is resolved by the runtime journal. */
1312
+ getPortfolioObservation?: (asOf: number, reservations: readonly PortfolioReservation[]) => Promise<PortfolioObservation>;
1195
1313
  capabilities: ConnectorCapabilities;
1196
1314
  universe: MarketUniverse;
1197
1315
  accountId?: string;
@@ -1205,6 +1323,11 @@ interface Connector {
1205
1323
  getOpenPositionPnl?: GetOpenPositionPnl;
1206
1324
  getClosedPnl?: GetClosedPnl;
1207
1325
  getEntryExecutions?: GetEntryExecutions;
1326
+ /** Authoritative order status; null means unknown, never a rejection. */
1327
+ getEntryOrderObservation?: (params: {
1328
+ symbol: string;
1329
+ orderId: string;
1330
+ }) => Promise<PortfolioOrderObservation | null>;
1208
1331
  placeOrder: PlaceOrder;
1209
1332
  setPositionProtection?: SetPositionProtection;
1210
1333
  setTakeProfits: SetTakeProfits;
@@ -1385,6 +1508,10 @@ interface OrderLeverage {
1385
1508
  verifiedAt: number;
1386
1509
  }
1387
1510
  interface Signal {
1511
+ /** Dataset reconstruction must use frozen features; null identifies a legacy export. */
1512
+ aiFeatureReplay?: {
1513
+ snapshot: AiFeatureSnapshot | null;
1514
+ };
1388
1515
  assessment?: SignalAssessment;
1389
1516
  jevEvidence?: JevEvidence;
1390
1517
  signalId: string;
@@ -1470,7 +1597,7 @@ interface RuntimeAllocatorDecision {
1470
1597
  }
1471
1598
  interface RuntimeRiskDecision {
1472
1599
  stage: 'order_plan';
1473
- status: 'approved' | 'rejected' | 'unavailable';
1600
+ status: 'approved' | 'rejected' | 'warning' | 'unavailable';
1474
1601
  reason: string;
1475
1602
  plannedLossValue: number | null;
1476
1603
  maxLossValue: number | null;
@@ -1608,6 +1735,48 @@ interface BotStatus {
1608
1735
  type BotResults = BotStatus[];
1609
1736
  type BotConfig = Bot[];
1610
1737
 
1738
+ /** Closed hourly candles, trailing 30 calendar days, monthly UTC assignments. */
1739
+ interface TickerProfile {
1740
+ symbol: string;
1741
+ asOf: number;
1742
+ validUntil: number;
1743
+ windowStart: number;
1744
+ hours: number;
1745
+ returnHours: number;
1746
+ btcAlignedHours: number;
1747
+ ethAlignedHours: number;
1748
+ turnoverSource: 'quote' | 'estimated' | 'mixed' | 'unknown';
1749
+ dailyTurnoverUSDT: number | null;
1750
+ dailyVolatilityPct: number | null;
1751
+ correlationBTC: number | null;
1752
+ correlationETH: number | null;
1753
+ moneyGroup: 'low' | 'middle' | 'high' | 'unknown';
1754
+ volatilityGroup: 'low' | 'middle' | 'high' | 'unknown';
1755
+ btcCorrelationGroup: 'weak' | 'medium' | 'strong' | 'unknown';
1756
+ ethCorrelationGroup: 'weak' | 'medium' | 'strong' | 'unknown';
1757
+ }
1758
+ interface TickerProfileSnapshot {
1759
+ schema: 'tradejs-ticker-profiles/v1';
1760
+ definition: 'hourly-30d-monthly-terciles/v1';
1761
+ provider: string;
1762
+ universeId: string;
1763
+ /** Describes the known membership; never infer historical listings from candles. */
1764
+ membership: 'frozen-list' | 'point-in-time';
1765
+ asOf: number;
1766
+ validUntil: number;
1767
+ thresholds: {
1768
+ money: [number | null, number | null];
1769
+ volatility: [number | null, number | null];
1770
+ };
1771
+ profiles: TickerProfile[];
1772
+ }
1773
+ interface TickerProfileContext extends TickerProfile {
1774
+ definition: TickerProfileSnapshot['definition'];
1775
+ provider: string;
1776
+ universeId: string;
1777
+ snapshotId: string;
1778
+ }
1779
+
1611
1780
  interface StrategyIndicatorsContext<TIndicators = unknown> {
1612
1781
  indicators: TIndicators | undefined;
1613
1782
  baseContext?: BaseStrategyContextSnapshot;
@@ -2328,6 +2497,7 @@ interface BaseContextGateFeatures {
2328
2497
  };
2329
2498
  }
2330
2499
  interface BaseStrategyContextSnapshot {
2500
+ tickerProfile?: TickerProfileContext;
2331
2501
  candle: Candle;
2332
2502
  prevCandle: Candle | null;
2333
2503
  raw: BaseRawIndicatorSnapshot;
@@ -2667,6 +2837,7 @@ interface IndicatorPluginRenderer {
2667
2837
  figures: IndicatorPluginFigureRenderer[];
2668
2838
  }
2669
2839
  interface IndicatorPluginEntry {
2840
+ aiFeatures?: readonly AiFeatureDefinition[];
2670
2841
  indicator: Indicator;
2671
2842
  historyKey?: string;
2672
2843
  compute?: (params: IndicatorPluginComputeParams) => number | null | undefined;
@@ -2677,6 +2848,7 @@ interface IndicatorPluginDefinition {
2677
2848
  }
2678
2849
 
2679
2850
  interface AiPayload {
2851
+ featureSnapshot?: AiFeatureSnapshot;
2680
2852
  signal: {
2681
2853
  symbol: Signal['symbol'];
2682
2854
  signalId: Signal['signalId'];
@@ -2871,8 +3043,13 @@ interface StrategyHookAfterPlaceOrderContext {
2871
3043
  }
2872
3044
  type StrategyMarketContextSource = 'binance' | 'coinmarketcap' | 'derivatives' | 'hyperliquidWhales';
2873
3045
  interface StrategyManifest {
3046
+ aiFeatures?: readonly AiFeatureDefinition[];
2874
3047
  name: string;
2875
3048
  contextRequirements?: {
3049
+ tickerProfiles?: {
3050
+ provider: string;
3051
+ universeId: string;
3052
+ };
2876
3053
  /** Market context that must be available before strategy core evaluation. */
2877
3054
  core?: readonly StrategyMarketContextSource[];
2878
3055
  };
@@ -3426,4 +3603,4 @@ interface McpJob {
3426
3603
  packageManifestSha256: string;
3427
3604
  }
3428
3605
 
3429
- export { type AggTrade, type AggTradesRequest, type AiDatasetRow, type AiPayload, type AiPromptPair, type AssetClass, BACKTEST_WARNING_CODES, type BacktestDetectorOptimizedStrategy, type BacktestExecutionCosts, 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 JevConfig, type JevDimension, type JevEvidence, type JevFactProvenance, type JevFeature, type JevGateModel, type JevInput, type JevProviderConfig, type JevQuestionSet, type JevRecord, type JevResponse, type JevScoreAnswer, type JevScoreQuestion, type JevScores, type JevStudyRow, type JevTree, type Kline, type KlineChartData, type KlineChartItem, type KlineRequest, type ListInstruments, MCP_SCOPES, 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 McpJob, type McpPrincipal, type McpScope, type MetricThreshold, type Metrics, type MinimalStat, type MlCandleIndicatorsSnapshot, type MonthlyEquityStats, type OnChangeCompare, type Order, type OrderBookDepth, type OrderBookDepthRequest, type OrderLeverage, type OrderLog, type OrderLogData, type OrderPositionIntent, type OrderType, type Position, type PositionLog, type PositionLogData, type PositionPnlSnapshot, type Provider, RUNTIME_CONTROLS_SCHEMA, RUNTIME_DEPLOYMENT_COMPOSITION_EVENT_SCHEMA, type ResearchEntryDecision, type ResearchEntryPolicy, type ResearchEntryPredicate, type RuntimeAiAnalysisSnapshot, type RuntimeAllocatorDecision, type RuntimeControls, type RuntimeDeployment, type RuntimeDeploymentCompositionEvent, type RuntimeDeploymentCompositionEventStrategy, type RuntimeDeploymentDeclaration, type RuntimeDeploymentHeartbeat, type RuntimeDeploymentStrategy, type RuntimeLineage, type RuntimeRiskDecision, type RuntimeSignalEvaluationRecord, type RuntimeSignalEvaluationStatus, type RuntimeStrategiesResponse, type RuntimeStrategyCloseNotification, type RuntimeStrategyConfigSnapshot, type RuntimeStrategyControlEvent, type RuntimeStrategyControlEventAction, type RuntimeStrategyControlState, type RuntimeStrategyDeclaration, type RuntimeStrategyPauseOverride, type RuntimeStrategyRevisionChange, type RuntimeStrategySelection, 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 SignalAssessment, 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 StrategyClosedCandlesRequest, type StrategyClosedCandlesSnapshot, 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 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 StrategyResearchRetention, 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 TradejsRuntimeDeclaration, type TradingAccountRef, type TradingFeeRate, type Trend, type TrendLine, type TrendLineMode, type TrendLineOptions, isMarketUniverse, resolveConnectorUniverse };
3606
+ export { type AggTrade, type AggTradesRequest, type AiDatasetRow, type AiFeatureDefinition, type AiFeaturePrimitive, type AiFeatureRole, type AiFeatureSnapshot, type AiPayload, type AiPromptPair, type AssetClass, BACKTEST_WARNING_CODES, type BacktestDetectorOptimizedStrategy, type BacktestExecutionCosts, 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 JevConfig, type JevDimension, type JevEvidence, type JevFactProvenance, type JevFeature, type JevGateModel, type JevInput, type JevProviderConfig, type JevQuestionSet, type JevRecord, type JevResponse, type JevScoreAnswer, type JevScoreQuestion, type JevScores, type JevStudyRow, type JevTree, type Kline, type KlineChartData, type KlineChartItem, type KlineRequest, type ListInstruments, MCP_SCOPES, 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 McpJob, type McpPrincipal, type McpScope, type MetricThreshold, type Metrics, type MinimalStat, type MlCandleIndicatorsSnapshot, type MonthlyEquityStats, type OnChangeCompare, type Order, type OrderBookDepth, type OrderBookDepthRequest, type OrderLeverage, type OrderLog, type OrderLogData, type OrderPositionIntent, type OrderType, type PortfolioCloseIntent, type PortfolioContext, type PortfolioObservation, type PortfolioOrderObservation, type PortfolioPolicyConfig, type PortfolioPosition, type PortfolioReservation, type PortfolioState, type PortfolioStateStore, type Position, type PositionLog, type PositionLogData, type PositionPnlSnapshot, type Provider, RUNTIME_CONTROLS_SCHEMA, RUNTIME_DEPLOYMENT_COMPOSITION_EVENT_SCHEMA, type ResearchEntryDecision, type ResearchEntryPolicy, type ResearchEntryPredicate, type RuntimeAiAnalysisSnapshot, type RuntimeAllocatorDecision, type RuntimeControls, type RuntimeDeployment, type RuntimeDeploymentCompositionEvent, type RuntimeDeploymentCompositionEventStrategy, type RuntimeDeploymentDeclaration, type RuntimeDeploymentHeartbeat, type RuntimeDeploymentStrategy, type RuntimeLineage, type RuntimeRiskDecision, type RuntimeSignalEvaluationRecord, type RuntimeSignalEvaluationStatus, type RuntimeStrategiesResponse, type RuntimeStrategyCloseNotification, type RuntimeStrategyConfigSnapshot, type RuntimeStrategyControlEvent, type RuntimeStrategyControlEventAction, type RuntimeStrategyControlState, type RuntimeStrategyDeclaration, type RuntimeStrategyPauseOverride, type RuntimeStrategyRevisionChange, type RuntimeStrategySelection, 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 SignalAssessment, 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 StrategyClosedCandlesRequest, type StrategyClosedCandlesSnapshot, 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 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 StrategyResearchRetention, 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 TickerProfile, type TickerProfileContext, type TickerProfileSnapshot, type TickerQuery, type TopOfBookTicker, type Tp, type TradejsRuntimeDeclaration, type TradingAccountRef, type TradingFeeRate, type Trend, type TrendLine, type TrendLineMode, type TrendLineOptions, isMarketUniverse, resolveConnectorUniverse };
package/dist/index.d.ts CHANGED
@@ -82,6 +82,94 @@ type ResearchEntryDecision = {
82
82
  }>;
83
83
  };
84
84
 
85
+ /** Explicitly opt in. R is frozen for the policy, not the sum of open risks. */
86
+ interface PortfolioPolicyConfig {
87
+ id: string;
88
+ scope: 'strategy' | 'account' | {
89
+ strategies: string[];
90
+ };
91
+ riskUnit: number;
92
+ observationIntervalMs: number;
93
+ maxPriceAgeMs: number;
94
+ maxPositions?: number;
95
+ profitExit?: {
96
+ scope: 'position' | 'basket';
97
+ multiple: number;
98
+ minPositions?: number;
99
+ };
100
+ closeOppositeOnFill?: boolean;
101
+ }
102
+ interface PortfolioPosition {
103
+ id: string;
104
+ strategy: string | null;
105
+ symbol: string;
106
+ direction: Direction;
107
+ qty: number;
108
+ entryPrice: number;
109
+ markPrice: number | null;
110
+ markedAt: number | null;
111
+ stopLossPrice?: number | null;
112
+ }
113
+ interface PortfolioOrderObservation {
114
+ id: string;
115
+ status: 'pending' | 'partial' | 'filled' | 'cancelled' | 'rejected';
116
+ filledQty: number;
117
+ positionId?: string;
118
+ }
119
+ interface PortfolioObservation {
120
+ asOf: number;
121
+ positions: PortfolioPosition[];
122
+ orders: PortfolioOrderObservation[];
123
+ }
124
+ interface PortfolioReservation {
125
+ id: string;
126
+ signalId: string;
127
+ strategy: string;
128
+ symbol: string;
129
+ direction: Direction;
130
+ qty: number;
131
+ timestamp: number;
132
+ /** A reservation exists before any request can leave the process. */
133
+ submitted: boolean;
134
+ oppositeHandled: boolean;
135
+ }
136
+ interface PortfolioCloseIntent {
137
+ positionId: string;
138
+ position: PortfolioPosition;
139
+ reason: 'PORTFOLIO_PROFIT_POSITION' | 'PORTFOLIO_PROFIT_BASKET' | 'PORTFOLIO_OPPOSITE_FILL';
140
+ createdAt: number;
141
+ lastAttemptAt: number | null;
142
+ }
143
+ interface PortfolioState {
144
+ schema: 'tradejs-portfolio/v1';
145
+ revision: number;
146
+ fingerprint: string;
147
+ reservations: PortfolioReservation[];
148
+ closing: PortfolioCloseIntent[];
149
+ completedSignals: Record<string, number>;
150
+ observedAt: number;
151
+ evaluatedAt: number;
152
+ blockedThrough: number;
153
+ }
154
+ interface PortfolioContext {
155
+ schema: 'tradejs-portfolio-context/v1';
156
+ asOf: number;
157
+ policyId: string;
158
+ positionCount: number;
159
+ pendingEntryCount: number;
160
+ longCount: number;
161
+ shortCount: number;
162
+ grossUnrealizedPnlR: number | null;
163
+ openStopRiskR: number | null;
164
+ largestPositionShare: number | null;
165
+ pricesComplete: boolean;
166
+ unknownOwnershipCount: number;
167
+ }
168
+ interface PortfolioStateStore {
169
+ read(): Promise<PortfolioState | null>;
170
+ compare(expected: PortfolioState | null, next: PortfolioState): Promise<boolean>;
171
+ }
172
+
85
173
  type JevDimension = 'trend' | 'swing' | 'participation' | 'setupParticipation' | 'extension' | 'confirmation' | 'setupStrength' | 'geometry' | 'signalStrength';
86
174
  /** Internal scores stay normalized; signalStrength is exported on a 1–10 scale. */
87
175
  type JevScores = Record<JevDimension, number | null>;
@@ -268,6 +356,7 @@ type BacktestDetectorOptimizedStrategy = Strategy & {
268
356
  };
269
357
  type BacktestPriceMode = 'mid' | 'close' | 'open';
270
358
  interface StrategyConfig {
359
+ PORTFOLIO_POLICY?: PortfolioPolicyConfig;
271
360
  RESEARCH_ENTRY_POLICY?: ResearchEntryPolicy;
272
361
  JEV?: JevConfig;
273
362
  ENABLE?: boolean;
@@ -725,6 +814,30 @@ declare const DEFAULT_MARKET_UNIVERSE: MarketUniverse;
725
814
  declare const isMarketUniverse: (value: unknown) => value is MarketUniverse;
726
815
  declare const resolveConnectorUniverse: (capabilities: ConnectorCapabilities, requested?: unknown) => MarketUniverse;
727
816
 
817
+ type AiFeatureRole = 'input' | 'data-quality' | 'metadata' | 'outcome' | 'policy';
818
+ type AiFeaturePrimitive = number | string | boolean | null;
819
+ /** Explicit strategy extensions use paths in the untrimmed signal projection. */
820
+ interface AiFeatureDefinition {
821
+ id: string;
822
+ version: number;
823
+ path: string;
824
+ source?: 'signal' | 'payload';
825
+ stationary?: boolean;
826
+ role: AiFeatureRole;
827
+ scope: 'target' | 'benchmark' | 'global' | 'setup';
828
+ unit: string;
829
+ description: string;
830
+ /** Arrays require an explicit causal reduction, never implicit truncation. */
831
+ reduction?: 'last' | 'mean' | 'min' | 'max' | 'count';
832
+ /** Source field used for a ratio; division by zero or missing returns null. */
833
+ divideBy?: string;
834
+ }
835
+ interface AiFeatureSnapshot {
836
+ schema: 'tradejs-ai-features/v1';
837
+ definitions: readonly AiFeatureDefinition[];
838
+ values: Record<string, AiFeaturePrimitive>;
839
+ }
840
+
728
841
  type Interval = '1' | '3' | '5' | '15' | '30' | '60' | '120' | '240' | '360' | '720' | 'D' | 'W' | 'M';
729
842
  type Provider = 'bybit' | 'binance' | 'coinbase';
730
843
  interface Candle {
@@ -1056,6 +1169,8 @@ type Order = {
1056
1169
  leverage?: number;
1057
1170
  orderId?: string;
1058
1171
  signal?: Signal;
1172
+ /** Only an authoritative rejection; never call for a timeout or ambiguous response. */
1173
+ onRejected?: () => Promise<void>;
1059
1174
  /** Await after preparation/quantity normalization, immediately before submission. */
1060
1175
  beforeSubmit?: (context: {
1061
1176
  qty: number;
@@ -1072,6 +1187,7 @@ type Position = {
1072
1187
  tpPrice?: number;
1073
1188
  };
1074
1189
  interface PositionPnlSnapshot extends Position {
1190
+ observedAt?: number;
1075
1191
  currentPrice: number;
1076
1192
  unrealizedPnl: number;
1077
1193
  takeProfitPrice?: number | null;
@@ -1192,6 +1308,8 @@ type GetTopOfBookTicker = (symbol: string) => Promise<TopOfBookTicker | null>;
1192
1308
  type GetAggTrades = (request: AggTradesRequest) => Promise<AggTrade[]>;
1193
1309
  type GetOrderBookDepth = (request: OrderBookDepthRequest) => Promise<OrderBookDepth | null>;
1194
1310
  interface Connector {
1311
+ /** Coherent simulation observation; live ownership is resolved by the runtime journal. */
1312
+ getPortfolioObservation?: (asOf: number, reservations: readonly PortfolioReservation[]) => Promise<PortfolioObservation>;
1195
1313
  capabilities: ConnectorCapabilities;
1196
1314
  universe: MarketUniverse;
1197
1315
  accountId?: string;
@@ -1205,6 +1323,11 @@ interface Connector {
1205
1323
  getOpenPositionPnl?: GetOpenPositionPnl;
1206
1324
  getClosedPnl?: GetClosedPnl;
1207
1325
  getEntryExecutions?: GetEntryExecutions;
1326
+ /** Authoritative order status; null means unknown, never a rejection. */
1327
+ getEntryOrderObservation?: (params: {
1328
+ symbol: string;
1329
+ orderId: string;
1330
+ }) => Promise<PortfolioOrderObservation | null>;
1208
1331
  placeOrder: PlaceOrder;
1209
1332
  setPositionProtection?: SetPositionProtection;
1210
1333
  setTakeProfits: SetTakeProfits;
@@ -1385,6 +1508,10 @@ interface OrderLeverage {
1385
1508
  verifiedAt: number;
1386
1509
  }
1387
1510
  interface Signal {
1511
+ /** Dataset reconstruction must use frozen features; null identifies a legacy export. */
1512
+ aiFeatureReplay?: {
1513
+ snapshot: AiFeatureSnapshot | null;
1514
+ };
1388
1515
  assessment?: SignalAssessment;
1389
1516
  jevEvidence?: JevEvidence;
1390
1517
  signalId: string;
@@ -1470,7 +1597,7 @@ interface RuntimeAllocatorDecision {
1470
1597
  }
1471
1598
  interface RuntimeRiskDecision {
1472
1599
  stage: 'order_plan';
1473
- status: 'approved' | 'rejected' | 'unavailable';
1600
+ status: 'approved' | 'rejected' | 'warning' | 'unavailable';
1474
1601
  reason: string;
1475
1602
  plannedLossValue: number | null;
1476
1603
  maxLossValue: number | null;
@@ -1608,6 +1735,48 @@ interface BotStatus {
1608
1735
  type BotResults = BotStatus[];
1609
1736
  type BotConfig = Bot[];
1610
1737
 
1738
+ /** Closed hourly candles, trailing 30 calendar days, monthly UTC assignments. */
1739
+ interface TickerProfile {
1740
+ symbol: string;
1741
+ asOf: number;
1742
+ validUntil: number;
1743
+ windowStart: number;
1744
+ hours: number;
1745
+ returnHours: number;
1746
+ btcAlignedHours: number;
1747
+ ethAlignedHours: number;
1748
+ turnoverSource: 'quote' | 'estimated' | 'mixed' | 'unknown';
1749
+ dailyTurnoverUSDT: number | null;
1750
+ dailyVolatilityPct: number | null;
1751
+ correlationBTC: number | null;
1752
+ correlationETH: number | null;
1753
+ moneyGroup: 'low' | 'middle' | 'high' | 'unknown';
1754
+ volatilityGroup: 'low' | 'middle' | 'high' | 'unknown';
1755
+ btcCorrelationGroup: 'weak' | 'medium' | 'strong' | 'unknown';
1756
+ ethCorrelationGroup: 'weak' | 'medium' | 'strong' | 'unknown';
1757
+ }
1758
+ interface TickerProfileSnapshot {
1759
+ schema: 'tradejs-ticker-profiles/v1';
1760
+ definition: 'hourly-30d-monthly-terciles/v1';
1761
+ provider: string;
1762
+ universeId: string;
1763
+ /** Describes the known membership; never infer historical listings from candles. */
1764
+ membership: 'frozen-list' | 'point-in-time';
1765
+ asOf: number;
1766
+ validUntil: number;
1767
+ thresholds: {
1768
+ money: [number | null, number | null];
1769
+ volatility: [number | null, number | null];
1770
+ };
1771
+ profiles: TickerProfile[];
1772
+ }
1773
+ interface TickerProfileContext extends TickerProfile {
1774
+ definition: TickerProfileSnapshot['definition'];
1775
+ provider: string;
1776
+ universeId: string;
1777
+ snapshotId: string;
1778
+ }
1779
+
1611
1780
  interface StrategyIndicatorsContext<TIndicators = unknown> {
1612
1781
  indicators: TIndicators | undefined;
1613
1782
  baseContext?: BaseStrategyContextSnapshot;
@@ -2328,6 +2497,7 @@ interface BaseContextGateFeatures {
2328
2497
  };
2329
2498
  }
2330
2499
  interface BaseStrategyContextSnapshot {
2500
+ tickerProfile?: TickerProfileContext;
2331
2501
  candle: Candle;
2332
2502
  prevCandle: Candle | null;
2333
2503
  raw: BaseRawIndicatorSnapshot;
@@ -2667,6 +2837,7 @@ interface IndicatorPluginRenderer {
2667
2837
  figures: IndicatorPluginFigureRenderer[];
2668
2838
  }
2669
2839
  interface IndicatorPluginEntry {
2840
+ aiFeatures?: readonly AiFeatureDefinition[];
2670
2841
  indicator: Indicator;
2671
2842
  historyKey?: string;
2672
2843
  compute?: (params: IndicatorPluginComputeParams) => number | null | undefined;
@@ -2677,6 +2848,7 @@ interface IndicatorPluginDefinition {
2677
2848
  }
2678
2849
 
2679
2850
  interface AiPayload {
2851
+ featureSnapshot?: AiFeatureSnapshot;
2680
2852
  signal: {
2681
2853
  symbol: Signal['symbol'];
2682
2854
  signalId: Signal['signalId'];
@@ -2871,8 +3043,13 @@ interface StrategyHookAfterPlaceOrderContext {
2871
3043
  }
2872
3044
  type StrategyMarketContextSource = 'binance' | 'coinmarketcap' | 'derivatives' | 'hyperliquidWhales';
2873
3045
  interface StrategyManifest {
3046
+ aiFeatures?: readonly AiFeatureDefinition[];
2874
3047
  name: string;
2875
3048
  contextRequirements?: {
3049
+ tickerProfiles?: {
3050
+ provider: string;
3051
+ universeId: string;
3052
+ };
2876
3053
  /** Market context that must be available before strategy core evaluation. */
2877
3054
  core?: readonly StrategyMarketContextSource[];
2878
3055
  };
@@ -3426,4 +3603,4 @@ interface McpJob {
3426
3603
  packageManifestSha256: string;
3427
3604
  }
3428
3605
 
3429
- export { type AggTrade, type AggTradesRequest, type AiDatasetRow, type AiPayload, type AiPromptPair, type AssetClass, BACKTEST_WARNING_CODES, type BacktestDetectorOptimizedStrategy, type BacktestExecutionCosts, 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 JevConfig, type JevDimension, type JevEvidence, type JevFactProvenance, type JevFeature, type JevGateModel, type JevInput, type JevProviderConfig, type JevQuestionSet, type JevRecord, type JevResponse, type JevScoreAnswer, type JevScoreQuestion, type JevScores, type JevStudyRow, type JevTree, type Kline, type KlineChartData, type KlineChartItem, type KlineRequest, type ListInstruments, MCP_SCOPES, 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 McpJob, type McpPrincipal, type McpScope, type MetricThreshold, type Metrics, type MinimalStat, type MlCandleIndicatorsSnapshot, type MonthlyEquityStats, type OnChangeCompare, type Order, type OrderBookDepth, type OrderBookDepthRequest, type OrderLeverage, type OrderLog, type OrderLogData, type OrderPositionIntent, type OrderType, type Position, type PositionLog, type PositionLogData, type PositionPnlSnapshot, type Provider, RUNTIME_CONTROLS_SCHEMA, RUNTIME_DEPLOYMENT_COMPOSITION_EVENT_SCHEMA, type ResearchEntryDecision, type ResearchEntryPolicy, type ResearchEntryPredicate, type RuntimeAiAnalysisSnapshot, type RuntimeAllocatorDecision, type RuntimeControls, type RuntimeDeployment, type RuntimeDeploymentCompositionEvent, type RuntimeDeploymentCompositionEventStrategy, type RuntimeDeploymentDeclaration, type RuntimeDeploymentHeartbeat, type RuntimeDeploymentStrategy, type RuntimeLineage, type RuntimeRiskDecision, type RuntimeSignalEvaluationRecord, type RuntimeSignalEvaluationStatus, type RuntimeStrategiesResponse, type RuntimeStrategyCloseNotification, type RuntimeStrategyConfigSnapshot, type RuntimeStrategyControlEvent, type RuntimeStrategyControlEventAction, type RuntimeStrategyControlState, type RuntimeStrategyDeclaration, type RuntimeStrategyPauseOverride, type RuntimeStrategyRevisionChange, type RuntimeStrategySelection, 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 SignalAssessment, 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 StrategyClosedCandlesRequest, type StrategyClosedCandlesSnapshot, 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 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 StrategyResearchRetention, 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 TradejsRuntimeDeclaration, type TradingAccountRef, type TradingFeeRate, type Trend, type TrendLine, type TrendLineMode, type TrendLineOptions, isMarketUniverse, resolveConnectorUniverse };
3606
+ export { type AggTrade, type AggTradesRequest, type AiDatasetRow, type AiFeatureDefinition, type AiFeaturePrimitive, type AiFeatureRole, type AiFeatureSnapshot, type AiPayload, type AiPromptPair, type AssetClass, BACKTEST_WARNING_CODES, type BacktestDetectorOptimizedStrategy, type BacktestExecutionCosts, 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 JevConfig, type JevDimension, type JevEvidence, type JevFactProvenance, type JevFeature, type JevGateModel, type JevInput, type JevProviderConfig, type JevQuestionSet, type JevRecord, type JevResponse, type JevScoreAnswer, type JevScoreQuestion, type JevScores, type JevStudyRow, type JevTree, type Kline, type KlineChartData, type KlineChartItem, type KlineRequest, type ListInstruments, MCP_SCOPES, 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 McpJob, type McpPrincipal, type McpScope, type MetricThreshold, type Metrics, type MinimalStat, type MlCandleIndicatorsSnapshot, type MonthlyEquityStats, type OnChangeCompare, type Order, type OrderBookDepth, type OrderBookDepthRequest, type OrderLeverage, type OrderLog, type OrderLogData, type OrderPositionIntent, type OrderType, type PortfolioCloseIntent, type PortfolioContext, type PortfolioObservation, type PortfolioOrderObservation, type PortfolioPolicyConfig, type PortfolioPosition, type PortfolioReservation, type PortfolioState, type PortfolioStateStore, type Position, type PositionLog, type PositionLogData, type PositionPnlSnapshot, type Provider, RUNTIME_CONTROLS_SCHEMA, RUNTIME_DEPLOYMENT_COMPOSITION_EVENT_SCHEMA, type ResearchEntryDecision, type ResearchEntryPolicy, type ResearchEntryPredicate, type RuntimeAiAnalysisSnapshot, type RuntimeAllocatorDecision, type RuntimeControls, type RuntimeDeployment, type RuntimeDeploymentCompositionEvent, type RuntimeDeploymentCompositionEventStrategy, type RuntimeDeploymentDeclaration, type RuntimeDeploymentHeartbeat, type RuntimeDeploymentStrategy, type RuntimeLineage, type RuntimeRiskDecision, type RuntimeSignalEvaluationRecord, type RuntimeSignalEvaluationStatus, type RuntimeStrategiesResponse, type RuntimeStrategyCloseNotification, type RuntimeStrategyConfigSnapshot, type RuntimeStrategyControlEvent, type RuntimeStrategyControlEventAction, type RuntimeStrategyControlState, type RuntimeStrategyDeclaration, type RuntimeStrategyPauseOverride, type RuntimeStrategyRevisionChange, type RuntimeStrategySelection, 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 SignalAssessment, 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 StrategyClosedCandlesRequest, type StrategyClosedCandlesSnapshot, 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 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 StrategyResearchRetention, 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 TickerProfile, type TickerProfileContext, type TickerProfileSnapshot, type TickerQuery, type TopOfBookTicker, type Tp, type TradejsRuntimeDeclaration, 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.1.29-beta.289",
3
+ "version": "3.1.29-beta.291",
4
4
  "description": "MIT-licensed shared TypeScript contracts for the TradeJS framework.",
5
5
  "keywords": [
6
6
  "tradejs",