@tradejs/types 2.0.6 → 2.0.8

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
@@ -654,10 +654,21 @@ interface StrategyFigureZone {
654
654
  color?: string;
655
655
  borderColor?: string;
656
656
  }
657
+ interface StrategyFigureAnnotation {
658
+ id?: string;
659
+ kind?: string;
660
+ point: StrategyFigurePoint;
661
+ title: string;
662
+ items: string[];
663
+ color?: string;
664
+ textColor?: string;
665
+ backgroundColor?: string;
666
+ }
657
667
  interface StrategyEntryModelFigures {
658
668
  lines?: StrategyFigureLine[];
659
669
  points?: StrategyFigurePoints[];
660
670
  zones?: StrategyFigureZone[];
671
+ annotations?: StrategyFigureAnnotation[];
661
672
  }
662
673
  interface TrendLineOptions {
663
674
  mode: TrendLineMode;
@@ -695,6 +706,7 @@ interface Signal {
695
706
  deploymentId?: string;
696
707
  policyProfileId?: string;
697
708
  runtimeConfigId?: string;
709
+ runtimeLineage?: RuntimeLineage;
698
710
  direction: Direction;
699
711
  timestamp: number;
700
712
  orderStatus?: SignalOrderStatus;
@@ -714,6 +726,7 @@ interface Signal {
714
726
  lines?: StrategyFigureLine[];
715
727
  points?: StrategyFigurePoints[];
716
728
  zones?: StrategyFigureZone[];
729
+ annotations?: StrategyFigureAnnotation[];
717
730
  [key: string]: any;
718
731
  };
719
732
  prices: {
@@ -736,6 +749,7 @@ interface RuntimeSignalEvaluationRecord {
736
749
  deploymentId?: string;
737
750
  policyProfileId?: string;
738
751
  runtimeConfigId?: string;
752
+ runtimeLineage?: RuntimeLineage;
739
753
  symbol: string;
740
754
  interval: Interval;
741
755
  timestamp: number;
@@ -778,6 +792,14 @@ interface RuntimeAiAnalysisSnapshot {
778
792
  analysis: Partial<SignalAnalysis>;
779
793
  }
780
794
  type SignalOrderStatus = 'completed' | 'failed' | 'skipped' | 'canceled';
795
+ interface RuntimeLineage {
796
+ schemaVersion: 1;
797
+ gitSha: string | null;
798
+ gitDirty: boolean | null;
799
+ gateFingerprint: string;
800
+ configFingerprint: string;
801
+ contextFingerprint: string;
802
+ }
781
803
  type RuntimeTradeStatus = 'active' | 'closed';
782
804
  type RuntimeTradeExitType = 'exit' | 'tp' | 'sl' | 'unknown';
783
805
  type RuntimeTradeFillSource = 'exchange_position' | 'requested_price' | 'unknown';
@@ -993,6 +1015,11 @@ interface MinimalStat {
993
1015
  profit: number;
994
1016
  orders: number;
995
1017
  }
1018
+ declare const BACKTEST_WARNING_CODES: {
1019
+ readonly TAKE_PROFIT_CROSSED_BEFORE_ENTRY: "TAKE_PROFIT_CROSSED_BEFORE_ENTRY";
1020
+ };
1021
+ type BacktestWarningCode = (typeof BACKTEST_WARNING_CODES)[keyof typeof BACKTEST_WARNING_CODES];
1022
+ type BacktestWarningCounts = Partial<Record<BacktestWarningCode, number>>;
996
1023
  interface TestingBoxResult {
997
1024
  orderLogId: string;
998
1025
  stat: MinimalStat;
@@ -1000,6 +1027,7 @@ interface TestingBoxResult {
1000
1027
  inlinePositionLog?: PositionLogData;
1001
1028
  inlineReplaySignalEvaluations?: RuntimeSignalEvaluationRecord[];
1002
1029
  executionCostModel?: ExecutionCostModel;
1030
+ warningCounts?: BacktestWarningCounts;
1003
1031
  }
1004
1032
  type TestingBox = (test: Test) => Promise<TestingBoxResult | null>;
1005
1033
  interface TestWorkerResult extends TestingBoxResult {
@@ -1630,6 +1658,31 @@ interface BaseParticipationContext {
1630
1658
  };
1631
1659
  tradeFlow?: BaseMarketTradeFlowContext;
1632
1660
  }
1661
+ type BaseMarketBreadthContext = {
1662
+ source: 'binance_klines';
1663
+ universe: string;
1664
+ interval: MarketFeatureInterval;
1665
+ asOfTs: number | null;
1666
+ ageMs: number | null;
1667
+ stale: boolean;
1668
+ symbolsCount: number | null;
1669
+ advancers: number | null;
1670
+ decliners: number | null;
1671
+ unchanged: number | null;
1672
+ advanceDeclineRatio: number | null;
1673
+ pctAboveMa20: number | null;
1674
+ pctAboveMa50: number | null;
1675
+ equalWeightedReturn: number | null;
1676
+ volumeWeightedReturn: number | null;
1677
+ dispersion: number | null;
1678
+ };
1679
+ type BaseMarketBreadthsContext = {
1680
+ top5?: BaseMarketBreadthContext;
1681
+ top10?: BaseMarketBreadthContext;
1682
+ top30?: BaseMarketBreadthContext;
1683
+ top50?: BaseMarketBreadthContext;
1684
+ top100?: BaseMarketBreadthContext;
1685
+ };
1633
1686
  interface BaseRelativeContext {
1634
1687
  benchmark: {
1635
1688
  maFast: number | null;
@@ -1668,24 +1721,8 @@ interface BaseRelativeContext {
1668
1721
  correlationToEth20: number | null;
1669
1722
  ratioTrend: 'up' | 'down' | 'flat' | 'unknown';
1670
1723
  };
1671
- marketBreadth?: {
1672
- source: 'binance_klines';
1673
- universe: string;
1674
- interval: MarketFeatureInterval;
1675
- asOfTs: number | null;
1676
- ageMs: number | null;
1677
- stale: boolean;
1678
- symbolsCount: number | null;
1679
- advancers: number | null;
1680
- decliners: number | null;
1681
- unchanged: number | null;
1682
- advanceDeclineRatio: number | null;
1683
- pctAboveMa20: number | null;
1684
- pctAboveMa50: number | null;
1685
- equalWeightedReturn: number | null;
1686
- volumeWeightedReturn: number | null;
1687
- dispersion: number | null;
1688
- };
1724
+ marketBreadth?: BaseMarketBreadthContext;
1725
+ marketBreadths?: BaseMarketBreadthsContext;
1689
1726
  btcAltRegime?: {
1690
1727
  source: 'binance_klines';
1691
1728
  universe: string;
@@ -2523,4 +2560,4 @@ interface StrategyChartsSnapshotResponse {
2523
2560
  strategies: StrategyChartSnapshot[];
2524
2561
  }
2525
2562
 
2526
- export { type AIChatHistory, type AIChatMessage, type AggTrade, type AggTradesRequest, type AiDatasetRow, type AiPayload, type AiPromptPair, type AssetClass, type BacktestDetectorOptimizedStrategy, type BacktestPriceMode, type BacktestRunConfig, type BaseContextGateFeatures, type BaseGateFeatureApproveBias, type BaseGateFeatureConfirmation, type BaseGateFeatureConflict, type BaseGateFeatureEntryLocation, type BaseGateFeaturePrimaryIssue, type BaseGateFeatureRiskLevel, type BaseGateFeatureScoreKey, type BaseIndicatorsHistorySnapshot, type BaseMarketTradeFlowContext, type BaseMultiTimeframeContext, type BaseParticipationContext, 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 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 Figure, type Filters, type FundingRateHistoryRequest, type FundingRatePoint, type GetAggTrades, type GetClosedPnlParams, type GetFundingRateHistory, type GetOrderBookDepth, type GetTickers, type GetTopOfBookTicker, type GetTradingFeeRate, 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 OnChangeFilters, 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 RuntimeSignalEvaluationRecord, type RuntimeSignalEvaluationStatus, type RuntimeStrategyCloseNotification, type RuntimeTradeExitType, type RuntimeTradeFillSource, type RuntimeTradeRecord, type RuntimeTradeStatus, type RuntimeTradeTelemetryQuality, type Signal, type SignalAnalysis, type SignalOrderStatus, type SimpleOrderLogData, type Sl, type SpreadRow, type Strategy, type StrategyAPI, type StrategyAPIEntryParams, type StrategyAPIExitParams, type StrategyAPIProtectParams, type StrategyAdditionalIndicatorsMap, type StrategyAiAdapter, type StrategyAiMode, type StrategyChartDetail, type StrategyChartMetric, type StrategyChartMetricTone, type StrategyChartOrder, type StrategyChartSnapshot, type StrategyChartsSnapshotResponse, type StrategyClosePlan, type StrategyConfig, type StrategyConfigGrid, type StrategyCoreRunner, type StrategyCreator, type StrategyCreatorParams, type StrategyDecision, type StrategyDecisionPriceContext, type StrategyDirectionalTpSlParams, type StrategyDirectionalTpSlResult, type StrategyEntryBaseParams, type StrategyEntryModelFigures, type StrategyEntryOrderPlan, type StrategyEntryRuntimeBaseParams, type StrategyEntryRuntimeBuilderParams, type StrategyEntryRuntimeOptions, type StrategyEntrySignalContext, type StrategyEntrySignalDecisionBuilderParams, type StrategyEntryTakeProfitsParams, type 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 StrategyManifest, type StrategyMlAdapter, type StrategyPluginDefinition, type StrategyPolicyProfile, type StrategyProtectPlan, type StrategyRegistryEntry, type StrategyResultConfig, type StrategyResultEntry, type StrategyResults, type StrategyRuntimeAiOptions, type StrategyRuntimeMlOptions, type StrategySharedReplayStateGetter, type StrategySignalMetaParams, type StrategySignalPriceParams, type StrategyStateController, type StrategyStateControllerOptions, type Test, type TestClosedSignalResult, type TestCompare, type TestCompareList, type TestConnector, type TestConnectorContext, type TestConnectorCreator, type TestResult, type TestStat, type TestSuite, type TestThresholds, type TestThresholdsKey, type TestTradeExitReason, type TestTradeResult, type TestWorkerResult, type TestingBox, type TestingBoxResult, type TestingOptions, type ThresholdLevel, type Ticker, type TickerQuery, type TopOfBookTicker, type Tp, type TradingAccountRef, type TradingFeeRate, type Trend, type TrendLine, type TrendLineMode, type TrendLineOptions, type UIFilters, isMarketUniverse, resolveConnectorUniverse };
2563
+ 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 BaseIndicatorsHistorySnapshot, type BaseMarketBreadthContext, type BaseMarketBreadthsContext, type BaseMarketTradeFlowContext, type BaseMultiTimeframeContext, type BaseParticipationContext, 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 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 Figure, type Filters, type FundingRateHistoryRequest, type FundingRatePoint, type GetAggTrades, type GetClosedPnlParams, type GetFundingRateHistory, type GetOrderBookDepth, type GetTickers, type GetTopOfBookTicker, type GetTradingFeeRate, 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 OnChangeFilters, 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 RuntimeTradeExitType, type RuntimeTradeFillSource, type RuntimeTradeRecord, type RuntimeTradeStatus, type RuntimeTradeTelemetryQuality, type Signal, type SignalAnalysis, type SignalOrderStatus, type SimpleOrderLogData, type Sl, type SpreadRow, type Strategy, type StrategyAPI, type StrategyAPIEntryParams, type StrategyAPIExitParams, type StrategyAPIProtectParams, type StrategyAdditionalIndicatorsMap, type StrategyAiAdapter, type StrategyAiMode, type StrategyChartDetail, type StrategyChartMetric, type StrategyChartMetricTone, type StrategyChartOrder, type StrategyChartSnapshot, type StrategyChartsSnapshotResponse, type StrategyClosePlan, type StrategyConfig, type StrategyConfigGrid, type StrategyCoreRunner, type StrategyCreator, type StrategyCreatorParams, type StrategyDecision, type StrategyDecisionPriceContext, type StrategyDirectionalTpSlParams, type StrategyDirectionalTpSlResult, type StrategyEntryBaseParams, type StrategyEntryModelFigures, type StrategyEntryOrderPlan, type StrategyEntryRuntimeBaseParams, type StrategyEntryRuntimeBuilderParams, type StrategyEntryRuntimeOptions, type StrategyEntrySignalContext, type StrategyEntrySignalDecisionBuilderParams, type StrategyEntryTakeProfitsParams, type 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 StrategyManifest, type StrategyMlAdapter, type StrategyPluginDefinition, type StrategyPolicyProfile, type StrategyProtectPlan, type StrategyRegistryEntry, type StrategyResultConfig, type StrategyResultEntry, type StrategyResults, type StrategyRuntimeAiOptions, type StrategyRuntimeMlOptions, type StrategySharedReplayStateGetter, type StrategySignalMetaParams, type StrategySignalPriceParams, type StrategyStateController, type StrategyStateControllerOptions, type Test, type TestClosedSignalResult, type TestCompare, type TestCompareList, type TestConnector, type TestConnectorContext, type TestConnectorCreator, type TestResult, type TestStat, type TestSuite, type TestThresholds, type TestThresholdsKey, type TestTradeExitReason, type TestTradeResult, type TestWorkerResult, type TestingBox, type TestingBoxResult, type TestingOptions, type ThresholdLevel, type Ticker, type TickerQuery, type TopOfBookTicker, type Tp, type TradingAccountRef, type TradingFeeRate, type Trend, type TrendLine, type TrendLineMode, type TrendLineOptions, type UIFilters, isMarketUniverse, resolveConnectorUniverse };
package/dist/index.d.ts CHANGED
@@ -654,10 +654,21 @@ interface StrategyFigureZone {
654
654
  color?: string;
655
655
  borderColor?: string;
656
656
  }
657
+ interface StrategyFigureAnnotation {
658
+ id?: string;
659
+ kind?: string;
660
+ point: StrategyFigurePoint;
661
+ title: string;
662
+ items: string[];
663
+ color?: string;
664
+ textColor?: string;
665
+ backgroundColor?: string;
666
+ }
657
667
  interface StrategyEntryModelFigures {
658
668
  lines?: StrategyFigureLine[];
659
669
  points?: StrategyFigurePoints[];
660
670
  zones?: StrategyFigureZone[];
671
+ annotations?: StrategyFigureAnnotation[];
661
672
  }
662
673
  interface TrendLineOptions {
663
674
  mode: TrendLineMode;
@@ -695,6 +706,7 @@ interface Signal {
695
706
  deploymentId?: string;
696
707
  policyProfileId?: string;
697
708
  runtimeConfigId?: string;
709
+ runtimeLineage?: RuntimeLineage;
698
710
  direction: Direction;
699
711
  timestamp: number;
700
712
  orderStatus?: SignalOrderStatus;
@@ -714,6 +726,7 @@ interface Signal {
714
726
  lines?: StrategyFigureLine[];
715
727
  points?: StrategyFigurePoints[];
716
728
  zones?: StrategyFigureZone[];
729
+ annotations?: StrategyFigureAnnotation[];
717
730
  [key: string]: any;
718
731
  };
719
732
  prices: {
@@ -736,6 +749,7 @@ interface RuntimeSignalEvaluationRecord {
736
749
  deploymentId?: string;
737
750
  policyProfileId?: string;
738
751
  runtimeConfigId?: string;
752
+ runtimeLineage?: RuntimeLineage;
739
753
  symbol: string;
740
754
  interval: Interval;
741
755
  timestamp: number;
@@ -778,6 +792,14 @@ interface RuntimeAiAnalysisSnapshot {
778
792
  analysis: Partial<SignalAnalysis>;
779
793
  }
780
794
  type SignalOrderStatus = 'completed' | 'failed' | 'skipped' | 'canceled';
795
+ interface RuntimeLineage {
796
+ schemaVersion: 1;
797
+ gitSha: string | null;
798
+ gitDirty: boolean | null;
799
+ gateFingerprint: string;
800
+ configFingerprint: string;
801
+ contextFingerprint: string;
802
+ }
781
803
  type RuntimeTradeStatus = 'active' | 'closed';
782
804
  type RuntimeTradeExitType = 'exit' | 'tp' | 'sl' | 'unknown';
783
805
  type RuntimeTradeFillSource = 'exchange_position' | 'requested_price' | 'unknown';
@@ -993,6 +1015,11 @@ interface MinimalStat {
993
1015
  profit: number;
994
1016
  orders: number;
995
1017
  }
1018
+ declare const BACKTEST_WARNING_CODES: {
1019
+ readonly TAKE_PROFIT_CROSSED_BEFORE_ENTRY: "TAKE_PROFIT_CROSSED_BEFORE_ENTRY";
1020
+ };
1021
+ type BacktestWarningCode = (typeof BACKTEST_WARNING_CODES)[keyof typeof BACKTEST_WARNING_CODES];
1022
+ type BacktestWarningCounts = Partial<Record<BacktestWarningCode, number>>;
996
1023
  interface TestingBoxResult {
997
1024
  orderLogId: string;
998
1025
  stat: MinimalStat;
@@ -1000,6 +1027,7 @@ interface TestingBoxResult {
1000
1027
  inlinePositionLog?: PositionLogData;
1001
1028
  inlineReplaySignalEvaluations?: RuntimeSignalEvaluationRecord[];
1002
1029
  executionCostModel?: ExecutionCostModel;
1030
+ warningCounts?: BacktestWarningCounts;
1003
1031
  }
1004
1032
  type TestingBox = (test: Test) => Promise<TestingBoxResult | null>;
1005
1033
  interface TestWorkerResult extends TestingBoxResult {
@@ -1630,6 +1658,31 @@ interface BaseParticipationContext {
1630
1658
  };
1631
1659
  tradeFlow?: BaseMarketTradeFlowContext;
1632
1660
  }
1661
+ type BaseMarketBreadthContext = {
1662
+ source: 'binance_klines';
1663
+ universe: string;
1664
+ interval: MarketFeatureInterval;
1665
+ asOfTs: number | null;
1666
+ ageMs: number | null;
1667
+ stale: boolean;
1668
+ symbolsCount: number | null;
1669
+ advancers: number | null;
1670
+ decliners: number | null;
1671
+ unchanged: number | null;
1672
+ advanceDeclineRatio: number | null;
1673
+ pctAboveMa20: number | null;
1674
+ pctAboveMa50: number | null;
1675
+ equalWeightedReturn: number | null;
1676
+ volumeWeightedReturn: number | null;
1677
+ dispersion: number | null;
1678
+ };
1679
+ type BaseMarketBreadthsContext = {
1680
+ top5?: BaseMarketBreadthContext;
1681
+ top10?: BaseMarketBreadthContext;
1682
+ top30?: BaseMarketBreadthContext;
1683
+ top50?: BaseMarketBreadthContext;
1684
+ top100?: BaseMarketBreadthContext;
1685
+ };
1633
1686
  interface BaseRelativeContext {
1634
1687
  benchmark: {
1635
1688
  maFast: number | null;
@@ -1668,24 +1721,8 @@ interface BaseRelativeContext {
1668
1721
  correlationToEth20: number | null;
1669
1722
  ratioTrend: 'up' | 'down' | 'flat' | 'unknown';
1670
1723
  };
1671
- marketBreadth?: {
1672
- source: 'binance_klines';
1673
- universe: string;
1674
- interval: MarketFeatureInterval;
1675
- asOfTs: number | null;
1676
- ageMs: number | null;
1677
- stale: boolean;
1678
- symbolsCount: number | null;
1679
- advancers: number | null;
1680
- decliners: number | null;
1681
- unchanged: number | null;
1682
- advanceDeclineRatio: number | null;
1683
- pctAboveMa20: number | null;
1684
- pctAboveMa50: number | null;
1685
- equalWeightedReturn: number | null;
1686
- volumeWeightedReturn: number | null;
1687
- dispersion: number | null;
1688
- };
1724
+ marketBreadth?: BaseMarketBreadthContext;
1725
+ marketBreadths?: BaseMarketBreadthsContext;
1689
1726
  btcAltRegime?: {
1690
1727
  source: 'binance_klines';
1691
1728
  universe: string;
@@ -2523,4 +2560,4 @@ interface StrategyChartsSnapshotResponse {
2523
2560
  strategies: StrategyChartSnapshot[];
2524
2561
  }
2525
2562
 
2526
- export { type AIChatHistory, type AIChatMessage, type AggTrade, type AggTradesRequest, type AiDatasetRow, type AiPayload, type AiPromptPair, type AssetClass, type BacktestDetectorOptimizedStrategy, type BacktestPriceMode, type BacktestRunConfig, type BaseContextGateFeatures, type BaseGateFeatureApproveBias, type BaseGateFeatureConfirmation, type BaseGateFeatureConflict, type BaseGateFeatureEntryLocation, type BaseGateFeaturePrimaryIssue, type BaseGateFeatureRiskLevel, type BaseGateFeatureScoreKey, type BaseIndicatorsHistorySnapshot, type BaseMarketTradeFlowContext, type BaseMultiTimeframeContext, type BaseParticipationContext, 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 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 Figure, type Filters, type FundingRateHistoryRequest, type FundingRatePoint, type GetAggTrades, type GetClosedPnlParams, type GetFundingRateHistory, type GetOrderBookDepth, type GetTickers, type GetTopOfBookTicker, type GetTradingFeeRate, 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 OnChangeFilters, 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 RuntimeSignalEvaluationRecord, type RuntimeSignalEvaluationStatus, type RuntimeStrategyCloseNotification, type RuntimeTradeExitType, type RuntimeTradeFillSource, type RuntimeTradeRecord, type RuntimeTradeStatus, type RuntimeTradeTelemetryQuality, type Signal, type SignalAnalysis, type SignalOrderStatus, type SimpleOrderLogData, type Sl, type SpreadRow, type Strategy, type StrategyAPI, type StrategyAPIEntryParams, type StrategyAPIExitParams, type StrategyAPIProtectParams, type StrategyAdditionalIndicatorsMap, type StrategyAiAdapter, type StrategyAiMode, type StrategyChartDetail, type StrategyChartMetric, type StrategyChartMetricTone, type StrategyChartOrder, type StrategyChartSnapshot, type StrategyChartsSnapshotResponse, type StrategyClosePlan, type StrategyConfig, type StrategyConfigGrid, type StrategyCoreRunner, type StrategyCreator, type StrategyCreatorParams, type StrategyDecision, type StrategyDecisionPriceContext, type StrategyDirectionalTpSlParams, type StrategyDirectionalTpSlResult, type StrategyEntryBaseParams, type StrategyEntryModelFigures, type StrategyEntryOrderPlan, type StrategyEntryRuntimeBaseParams, type StrategyEntryRuntimeBuilderParams, type StrategyEntryRuntimeOptions, type StrategyEntrySignalContext, type StrategyEntrySignalDecisionBuilderParams, type StrategyEntryTakeProfitsParams, type 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 StrategyManifest, type StrategyMlAdapter, type StrategyPluginDefinition, type StrategyPolicyProfile, type StrategyProtectPlan, type StrategyRegistryEntry, type StrategyResultConfig, type StrategyResultEntry, type StrategyResults, type StrategyRuntimeAiOptions, type StrategyRuntimeMlOptions, type StrategySharedReplayStateGetter, type StrategySignalMetaParams, type StrategySignalPriceParams, type StrategyStateController, type StrategyStateControllerOptions, type Test, type TestClosedSignalResult, type TestCompare, type TestCompareList, type TestConnector, type TestConnectorContext, type TestConnectorCreator, type TestResult, type TestStat, type TestSuite, type TestThresholds, type TestThresholdsKey, type TestTradeExitReason, type TestTradeResult, type TestWorkerResult, type TestingBox, type TestingBoxResult, type TestingOptions, type ThresholdLevel, type Ticker, type TickerQuery, type TopOfBookTicker, type Tp, type TradingAccountRef, type TradingFeeRate, type Trend, type TrendLine, type TrendLineMode, type TrendLineOptions, type UIFilters, isMarketUniverse, resolveConnectorUniverse };
2563
+ 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 BaseIndicatorsHistorySnapshot, type BaseMarketBreadthContext, type BaseMarketBreadthsContext, type BaseMarketTradeFlowContext, type BaseMultiTimeframeContext, type BaseParticipationContext, 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 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 Figure, type Filters, type FundingRateHistoryRequest, type FundingRatePoint, type GetAggTrades, type GetClosedPnlParams, type GetFundingRateHistory, type GetOrderBookDepth, type GetTickers, type GetTopOfBookTicker, type GetTradingFeeRate, 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 OnChangeFilters, 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 RuntimeTradeExitType, type RuntimeTradeFillSource, type RuntimeTradeRecord, type RuntimeTradeStatus, type RuntimeTradeTelemetryQuality, type Signal, type SignalAnalysis, type SignalOrderStatus, type SimpleOrderLogData, type Sl, type SpreadRow, type Strategy, type StrategyAPI, type StrategyAPIEntryParams, type StrategyAPIExitParams, type StrategyAPIProtectParams, type StrategyAdditionalIndicatorsMap, type StrategyAiAdapter, type StrategyAiMode, type StrategyChartDetail, type StrategyChartMetric, type StrategyChartMetricTone, type StrategyChartOrder, type StrategyChartSnapshot, type StrategyChartsSnapshotResponse, type StrategyClosePlan, type StrategyConfig, type StrategyConfigGrid, type StrategyCoreRunner, type StrategyCreator, type StrategyCreatorParams, type StrategyDecision, type StrategyDecisionPriceContext, type StrategyDirectionalTpSlParams, type StrategyDirectionalTpSlResult, type StrategyEntryBaseParams, type StrategyEntryModelFigures, type StrategyEntryOrderPlan, type StrategyEntryRuntimeBaseParams, type StrategyEntryRuntimeBuilderParams, type StrategyEntryRuntimeOptions, type StrategyEntrySignalContext, type StrategyEntrySignalDecisionBuilderParams, type StrategyEntryTakeProfitsParams, type 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 StrategyManifest, type StrategyMlAdapter, type StrategyPluginDefinition, type StrategyPolicyProfile, type StrategyProtectPlan, type StrategyRegistryEntry, type StrategyResultConfig, type StrategyResultEntry, type StrategyResults, type StrategyRuntimeAiOptions, type StrategyRuntimeMlOptions, type StrategySharedReplayStateGetter, type StrategySignalMetaParams, type StrategySignalPriceParams, type StrategyStateController, type StrategyStateControllerOptions, type Test, type TestClosedSignalResult, type TestCompare, type TestCompareList, type TestConnector, type TestConnectorContext, type TestConnectorCreator, type TestResult, type TestStat, type TestSuite, type TestThresholds, type TestThresholdsKey, type TestTradeExitReason, type TestTradeResult, type TestWorkerResult, type TestingBox, type TestingBoxResult, type TestingOptions, type ThresholdLevel, type Ticker, type TickerQuery, type TopOfBookTicker, type Tp, type TradingAccountRef, type TradingFeeRate, type Trend, type TrendLine, type TrendLineMode, type TrendLineOptions, type UIFilters, isMarketUniverse, resolveConnectorUniverse };
package/dist/index.js CHANGED
@@ -20,12 +20,18 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ BACKTEST_WARNING_CODES: () => BACKTEST_WARNING_CODES,
23
24
  DEFAULT_MARKET_UNIVERSE: () => DEFAULT_MARKET_UNIVERSE,
24
25
  isMarketUniverse: () => isMarketUniverse,
25
26
  resolveConnectorUniverse: () => resolveConnectorUniverse
26
27
  });
27
28
  module.exports = __toCommonJS(index_exports);
28
29
 
30
+ // src/backtest.ts
31
+ var BACKTEST_WARNING_CODES = {
32
+ TAKE_PROFIT_CROSSED_BEFORE_ENTRY: "TAKE_PROFIT_CROSSED_BEFORE_ENTRY"
33
+ };
34
+
29
35
  // src/market.ts
30
36
  var DEFAULT_MARKET_UNIVERSE = "crypto";
31
37
  var isMarketUniverse = (value) => value === "crypto" || value === "tradfi";
@@ -43,6 +49,7 @@ var resolveConnectorUniverse = (capabilities, requested) => {
43
49
  };
44
50
  // Annotate the CommonJS export names for ESM import in node:
45
51
  0 && (module.exports = {
52
+ BACKTEST_WARNING_CODES,
46
53
  DEFAULT_MARKET_UNIVERSE,
47
54
  isMarketUniverse,
48
55
  resolveConnectorUniverse
package/dist/index.mjs CHANGED
@@ -1,3 +1,8 @@
1
+ // src/backtest.ts
2
+ var BACKTEST_WARNING_CODES = {
3
+ TAKE_PROFIT_CROSSED_BEFORE_ENTRY: "TAKE_PROFIT_CROSSED_BEFORE_ENTRY"
4
+ };
5
+
1
6
  // src/market.ts
2
7
  var DEFAULT_MARKET_UNIVERSE = "crypto";
3
8
  var isMarketUniverse = (value) => value === "crypto" || value === "tradfi";
@@ -14,6 +19,7 @@ var resolveConnectorUniverse = (capabilities, requested) => {
14
19
  return requested;
15
20
  };
16
21
  export {
22
+ BACKTEST_WARNING_CODES,
17
23
  DEFAULT_MARKET_UNIVERSE,
18
24
  isMarketUniverse,
19
25
  resolveConnectorUniverse
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tradejs/types",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "MIT-licensed shared TypeScript contracts for the TradeJS framework.",
5
5
  "keywords": [
6
6
  "tradejs",