backtest-kit 2.2.24 → 2.2.26

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/build/index.cjs CHANGED
@@ -2894,6 +2894,7 @@ const PROCESS_COMMIT_QUEUE_FN = async (self, timestamp) => {
2894
2894
  timestamp,
2895
2895
  position: publicSignal.position,
2896
2896
  priceOpen: publicSignal.priceOpen,
2897
+ signalId: publicSignal.id,
2897
2898
  priceTakeProfit: publicSignal.priceTakeProfit,
2898
2899
  priceStopLoss: publicSignal.priceStopLoss,
2899
2900
  originalPriceTakeProfit: publicSignal.originalPriceTakeProfit,
@@ -2916,6 +2917,7 @@ const PROCESS_COMMIT_QUEUE_FN = async (self, timestamp) => {
2916
2917
  timestamp,
2917
2918
  position: publicSignal.position,
2918
2919
  priceOpen: publicSignal.priceOpen,
2920
+ signalId: publicSignal.id,
2919
2921
  priceTakeProfit: publicSignal.priceTakeProfit,
2920
2922
  priceStopLoss: publicSignal.priceStopLoss,
2921
2923
  originalPriceTakeProfit: publicSignal.originalPriceTakeProfit,
@@ -2935,6 +2937,7 @@ const PROCESS_COMMIT_QUEUE_FN = async (self, timestamp) => {
2935
2937
  backtest: commit.backtest,
2936
2938
  currentPrice: commit.currentPrice,
2937
2939
  timestamp,
2940
+ signalId: publicSignal.id,
2938
2941
  position: publicSignal.position,
2939
2942
  priceOpen: publicSignal.priceOpen,
2940
2943
  priceTakeProfit: publicSignal.priceTakeProfit,
@@ -2957,6 +2960,7 @@ const PROCESS_COMMIT_QUEUE_FN = async (self, timestamp) => {
2957
2960
  percentShift: commit.percentShift,
2958
2961
  currentPrice: commit.currentPrice,
2959
2962
  timestamp,
2963
+ signalId: publicSignal.id,
2960
2964
  position: publicSignal.position,
2961
2965
  priceOpen: publicSignal.priceOpen,
2962
2966
  priceTakeProfit: publicSignal.priceTakeProfit,
@@ -2979,6 +2983,7 @@ const PROCESS_COMMIT_QUEUE_FN = async (self, timestamp) => {
2979
2983
  percentShift: commit.percentShift,
2980
2984
  currentPrice: commit.currentPrice,
2981
2985
  timestamp,
2986
+ signalId: publicSignal.id,
2982
2987
  position: publicSignal.position,
2983
2988
  priceOpen: publicSignal.priceOpen,
2984
2989
  priceTakeProfit: publicSignal.priceTakeProfit,
@@ -5763,6 +5768,7 @@ class ClientStrategy {
5763
5768
  strategyName: this.params.strategyName,
5764
5769
  exchangeName: this.params.exchangeName,
5765
5770
  frameName: this.params.frameName,
5771
+ signalId: this._cancelledSignal.id,
5766
5772
  backtest,
5767
5773
  cancelId,
5768
5774
  timestamp: this.params.execution.context.when.getTime(),
@@ -5779,6 +5785,7 @@ class ClientStrategy {
5779
5785
  strategyName: this.params.strategyName,
5780
5786
  exchangeName: this.params.exchangeName,
5781
5787
  frameName: this.params.frameName,
5788
+ signalId: this._cancelledSignal.id,
5782
5789
  backtest,
5783
5790
  cancelId,
5784
5791
  timestamp: this.params.execution.context.when.getTime(),
@@ -5829,6 +5836,7 @@ class ClientStrategy {
5829
5836
  strategyName: this.params.strategyName,
5830
5837
  exchangeName: this.params.exchangeName,
5831
5838
  frameName: this.params.frameName,
5839
+ signalId: this._closedSignal.id,
5832
5840
  backtest,
5833
5841
  closeId,
5834
5842
  timestamp: this.params.execution.context.when.getTime(),
@@ -5845,6 +5853,7 @@ class ClientStrategy {
5845
5853
  strategyName: this.params.strategyName,
5846
5854
  exchangeName: this.params.exchangeName,
5847
5855
  frameName: this.params.frameName,
5856
+ signalId: this._closedSignal.id,
5848
5857
  backtest,
5849
5858
  closeId,
5850
5859
  timestamp: this.params.execution.context.when.getTime(),
@@ -33931,6 +33940,7 @@ class NotificationInstance {
33931
33940
  exchangeName: data.exchangeName,
33932
33941
  signalId: data.signal.id,
33933
33942
  position: data.signal.position,
33943
+ priceOpen: data.signal.priceOpen,
33934
33944
  priceTakeProfit: data.signal.priceTakeProfit,
33935
33945
  priceStopLoss: data.signal.priceStopLoss,
33936
33946
  originalPriceTakeProfit: data.signal.originalPriceTakeProfit,
@@ -34034,6 +34044,7 @@ class NotificationInstance {
34034
34044
  symbol: data.symbol,
34035
34045
  strategyName: data.strategyName,
34036
34046
  exchangeName: data.exchangeName,
34047
+ signalId: data.signalId,
34037
34048
  percentToClose: data.percentToClose,
34038
34049
  currentPrice: data.currentPrice,
34039
34050
  position: data.position,
@@ -34056,6 +34067,7 @@ class NotificationInstance {
34056
34067
  symbol: data.symbol,
34057
34068
  strategyName: data.strategyName,
34058
34069
  exchangeName: data.exchangeName,
34070
+ signalId: data.signalId,
34059
34071
  percentToClose: data.percentToClose,
34060
34072
  currentPrice: data.currentPrice,
34061
34073
  position: data.position,
@@ -34078,6 +34090,7 @@ class NotificationInstance {
34078
34090
  symbol: data.symbol,
34079
34091
  strategyName: data.strategyName,
34080
34092
  exchangeName: data.exchangeName,
34093
+ signalId: data.signalId,
34081
34094
  currentPrice: data.currentPrice,
34082
34095
  position: data.position,
34083
34096
  priceOpen: data.priceOpen,
@@ -34099,6 +34112,7 @@ class NotificationInstance {
34099
34112
  symbol: data.symbol,
34100
34113
  strategyName: data.strategyName,
34101
34114
  exchangeName: data.exchangeName,
34115
+ signalId: data.signalId,
34102
34116
  percentShift: data.percentShift,
34103
34117
  currentPrice: data.currentPrice,
34104
34118
  position: data.position,
@@ -34121,6 +34135,7 @@ class NotificationInstance {
34121
34135
  symbol: data.symbol,
34122
34136
  strategyName: data.strategyName,
34123
34137
  exchangeName: data.exchangeName,
34138
+ signalId: data.signalId,
34124
34139
  percentShift: data.percentShift,
34125
34140
  currentPrice: data.currentPrice,
34126
34141
  position: data.position,
package/build/index.mjs CHANGED
@@ -2874,6 +2874,7 @@ const PROCESS_COMMIT_QUEUE_FN = async (self, timestamp) => {
2874
2874
  timestamp,
2875
2875
  position: publicSignal.position,
2876
2876
  priceOpen: publicSignal.priceOpen,
2877
+ signalId: publicSignal.id,
2877
2878
  priceTakeProfit: publicSignal.priceTakeProfit,
2878
2879
  priceStopLoss: publicSignal.priceStopLoss,
2879
2880
  originalPriceTakeProfit: publicSignal.originalPriceTakeProfit,
@@ -2896,6 +2897,7 @@ const PROCESS_COMMIT_QUEUE_FN = async (self, timestamp) => {
2896
2897
  timestamp,
2897
2898
  position: publicSignal.position,
2898
2899
  priceOpen: publicSignal.priceOpen,
2900
+ signalId: publicSignal.id,
2899
2901
  priceTakeProfit: publicSignal.priceTakeProfit,
2900
2902
  priceStopLoss: publicSignal.priceStopLoss,
2901
2903
  originalPriceTakeProfit: publicSignal.originalPriceTakeProfit,
@@ -2915,6 +2917,7 @@ const PROCESS_COMMIT_QUEUE_FN = async (self, timestamp) => {
2915
2917
  backtest: commit.backtest,
2916
2918
  currentPrice: commit.currentPrice,
2917
2919
  timestamp,
2920
+ signalId: publicSignal.id,
2918
2921
  position: publicSignal.position,
2919
2922
  priceOpen: publicSignal.priceOpen,
2920
2923
  priceTakeProfit: publicSignal.priceTakeProfit,
@@ -2937,6 +2940,7 @@ const PROCESS_COMMIT_QUEUE_FN = async (self, timestamp) => {
2937
2940
  percentShift: commit.percentShift,
2938
2941
  currentPrice: commit.currentPrice,
2939
2942
  timestamp,
2943
+ signalId: publicSignal.id,
2940
2944
  position: publicSignal.position,
2941
2945
  priceOpen: publicSignal.priceOpen,
2942
2946
  priceTakeProfit: publicSignal.priceTakeProfit,
@@ -2959,6 +2963,7 @@ const PROCESS_COMMIT_QUEUE_FN = async (self, timestamp) => {
2959
2963
  percentShift: commit.percentShift,
2960
2964
  currentPrice: commit.currentPrice,
2961
2965
  timestamp,
2966
+ signalId: publicSignal.id,
2962
2967
  position: publicSignal.position,
2963
2968
  priceOpen: publicSignal.priceOpen,
2964
2969
  priceTakeProfit: publicSignal.priceTakeProfit,
@@ -5743,6 +5748,7 @@ class ClientStrategy {
5743
5748
  strategyName: this.params.strategyName,
5744
5749
  exchangeName: this.params.exchangeName,
5745
5750
  frameName: this.params.frameName,
5751
+ signalId: this._cancelledSignal.id,
5746
5752
  backtest,
5747
5753
  cancelId,
5748
5754
  timestamp: this.params.execution.context.when.getTime(),
@@ -5759,6 +5765,7 @@ class ClientStrategy {
5759
5765
  strategyName: this.params.strategyName,
5760
5766
  exchangeName: this.params.exchangeName,
5761
5767
  frameName: this.params.frameName,
5768
+ signalId: this._cancelledSignal.id,
5762
5769
  backtest,
5763
5770
  cancelId,
5764
5771
  timestamp: this.params.execution.context.when.getTime(),
@@ -5809,6 +5816,7 @@ class ClientStrategy {
5809
5816
  strategyName: this.params.strategyName,
5810
5817
  exchangeName: this.params.exchangeName,
5811
5818
  frameName: this.params.frameName,
5819
+ signalId: this._closedSignal.id,
5812
5820
  backtest,
5813
5821
  closeId,
5814
5822
  timestamp: this.params.execution.context.when.getTime(),
@@ -5825,6 +5833,7 @@ class ClientStrategy {
5825
5833
  strategyName: this.params.strategyName,
5826
5834
  exchangeName: this.params.exchangeName,
5827
5835
  frameName: this.params.frameName,
5836
+ signalId: this._closedSignal.id,
5828
5837
  backtest,
5829
5838
  closeId,
5830
5839
  timestamp: this.params.execution.context.when.getTime(),
@@ -33911,6 +33920,7 @@ class NotificationInstance {
33911
33920
  exchangeName: data.exchangeName,
33912
33921
  signalId: data.signal.id,
33913
33922
  position: data.signal.position,
33923
+ priceOpen: data.signal.priceOpen,
33914
33924
  priceTakeProfit: data.signal.priceTakeProfit,
33915
33925
  priceStopLoss: data.signal.priceStopLoss,
33916
33926
  originalPriceTakeProfit: data.signal.originalPriceTakeProfit,
@@ -34014,6 +34024,7 @@ class NotificationInstance {
34014
34024
  symbol: data.symbol,
34015
34025
  strategyName: data.strategyName,
34016
34026
  exchangeName: data.exchangeName,
34027
+ signalId: data.signalId,
34017
34028
  percentToClose: data.percentToClose,
34018
34029
  currentPrice: data.currentPrice,
34019
34030
  position: data.position,
@@ -34036,6 +34047,7 @@ class NotificationInstance {
34036
34047
  symbol: data.symbol,
34037
34048
  strategyName: data.strategyName,
34038
34049
  exchangeName: data.exchangeName,
34050
+ signalId: data.signalId,
34039
34051
  percentToClose: data.percentToClose,
34040
34052
  currentPrice: data.currentPrice,
34041
34053
  position: data.position,
@@ -34058,6 +34070,7 @@ class NotificationInstance {
34058
34070
  symbol: data.symbol,
34059
34071
  strategyName: data.strategyName,
34060
34072
  exchangeName: data.exchangeName,
34073
+ signalId: data.signalId,
34061
34074
  currentPrice: data.currentPrice,
34062
34075
  position: data.position,
34063
34076
  priceOpen: data.priceOpen,
@@ -34079,6 +34092,7 @@ class NotificationInstance {
34079
34092
  symbol: data.symbol,
34080
34093
  strategyName: data.strategyName,
34081
34094
  exchangeName: data.exchangeName,
34095
+ signalId: data.signalId,
34082
34096
  percentShift: data.percentShift,
34083
34097
  currentPrice: data.currentPrice,
34084
34098
  position: data.position,
@@ -34101,6 +34115,7 @@ class NotificationInstance {
34101
34115
  symbol: data.symbol,
34102
34116
  strategyName: data.strategyName,
34103
34117
  exchangeName: data.exchangeName,
34118
+ signalId: data.signalId,
34104
34119
  percentShift: data.percentShift,
34105
34120
  currentPrice: data.currentPrice,
34106
34121
  position: data.position,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backtest-kit",
3
- "version": "2.2.24",
3
+ "version": "2.2.26",
4
4
  "description": "A TypeScript library for trading system backtest",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
package/types.d.ts CHANGED
@@ -1012,6 +1012,8 @@ interface SignalCommitBase {
1012
1012
  exchangeName: ExchangeName;
1013
1013
  frameName: FrameName;
1014
1014
  backtest: boolean;
1015
+ /** Unique signal identifier (UUID v4) */
1016
+ signalId: string;
1015
1017
  /** Timestamp from execution context (tick's when or backtest candle timestamp) */
1016
1018
  timestamp: number;
1017
1019
  }
@@ -6844,6 +6846,8 @@ interface PartialProfitCommitNotification {
6844
6846
  strategyName: StrategyName;
6845
6847
  /** Exchange name where signal was executed */
6846
6848
  exchangeName: ExchangeName;
6849
+ /** Unique signal identifier (UUID v4) */
6850
+ signalId: string;
6847
6851
  /** Percentage of position closed (0-100) */
6848
6852
  percentToClose: number;
6849
6853
  /** Current market price when partial was executed */
@@ -6886,6 +6890,8 @@ interface PartialLossCommitNotification {
6886
6890
  strategyName: StrategyName;
6887
6891
  /** Exchange name where signal was executed */
6888
6892
  exchangeName: ExchangeName;
6893
+ /** Unique signal identifier (UUID v4) */
6894
+ signalId: string;
6889
6895
  /** Percentage of position closed (0-100) */
6890
6896
  percentToClose: number;
6891
6897
  /** Current market price when partial was executed */
@@ -6928,6 +6934,8 @@ interface BreakevenCommitNotification {
6928
6934
  strategyName: StrategyName;
6929
6935
  /** Exchange name where signal was executed */
6930
6936
  exchangeName: ExchangeName;
6937
+ /** Unique signal identifier (UUID v4) */
6938
+ signalId: string;
6931
6939
  /** Current market price when breakeven was executed */
6932
6940
  currentPrice: number;
6933
6941
  /** Trade direction: "long" (buy) or "short" (sell) */
@@ -6968,6 +6976,8 @@ interface TrailingStopCommitNotification {
6968
6976
  strategyName: StrategyName;
6969
6977
  /** Exchange name where signal was executed */
6970
6978
  exchangeName: ExchangeName;
6979
+ /** Unique signal identifier (UUID v4) */
6980
+ signalId: string;
6971
6981
  /** Percentage shift of original SL distance (-100 to 100) */
6972
6982
  percentShift: number;
6973
6983
  /** Current market price when trailing stop was executed */
@@ -7010,6 +7020,8 @@ interface TrailingTakeCommitNotification {
7010
7020
  strategyName: StrategyName;
7011
7021
  /** Exchange name where signal was executed */
7012
7022
  exchangeName: ExchangeName;
7023
+ /** Unique signal identifier (UUID v4) */
7024
+ signalId: string;
7013
7025
  /** Percentage shift of original TP distance (-100 to 100) */
7014
7026
  percentShift: number;
7015
7027
  /** Current market price when trailing take was executed */
@@ -7144,6 +7156,8 @@ interface SignalCancelledNotification {
7144
7156
  priceTakeProfit: number;
7145
7157
  /** Stop loss exit price */
7146
7158
  priceStopLoss: number;
7159
+ /** Entry price for the position */
7160
+ priceOpen: number;
7147
7161
  /** Original take profit price before any trailing adjustments */
7148
7162
  originalPriceTakeProfit: number;
7149
7163
  /** Original stop loss price before any trailing adjustments */