backtest-kit 4.0.1 → 4.0.2

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
@@ -6630,6 +6630,18 @@ class ClientStrategy {
6630
6630
  }
6631
6631
  return entries.map((e) => e.price);
6632
6632
  }
6633
+ /**
6634
+ * Returns the list of partial closes for the current pending signal.
6635
+ *
6636
+ * Each entry records a partial profit or loss close event with its type,
6637
+ * percent closed, price at close, cost basis snapshot, and entry count at close.
6638
+ *
6639
+ * Returns null if no pending signal exists.
6640
+ * Returns an empty array if no partial closes have been executed.
6641
+ *
6642
+ * @param symbol - Trading pair symbol
6643
+ * @returns Promise resolving to array of partial close records or null
6644
+ */
6633
6645
  async getPositionPartials(symbol) {
6634
6646
  this.params.logger.debug("ClientStrategy getPositionPartials", { symbol });
6635
6647
  if (!this._pendingSignal) {
@@ -6637,6 +6649,34 @@ class ClientStrategy {
6637
6649
  }
6638
6650
  return this._pendingSignal._partial ?? [];
6639
6651
  }
6652
+ /**
6653
+ * Returns the list of DCA entry prices and costs for the current pending signal.
6654
+ *
6655
+ * Each entry records the price and cost of a single position entry.
6656
+ * The first element is always the original priceOpen (initial entry).
6657
+ * Each subsequent element is an entry added by averageBuy().
6658
+ *
6659
+ * Returns null if no pending signal exists.
6660
+ * Returns a single-element array [{ price: priceOpen, cost }] if no DCA entries were made.
6661
+ *
6662
+ * @param symbol - Trading pair symbol
6663
+ * @returns Promise resolving to array of entry records or null
6664
+ *
6665
+ * @example
6666
+ * // No DCA: [{ price: 43000, cost: 100 }]
6667
+ * // One DCA: [{ price: 43000, cost: 100 }, { price: 42000, cost: 100 }]
6668
+ */
6669
+ async getPositionEntries(symbol) {
6670
+ this.params.logger.debug("ClientStrategy getPositionEntries", { symbol });
6671
+ if (!this._pendingSignal) {
6672
+ return null;
6673
+ }
6674
+ const entries = this._pendingSignal._entry;
6675
+ if (!entries || entries.length === 0) {
6676
+ return [{ price: this._pendingSignal.priceOpen, cost: GLOBAL_CONFIG.CC_POSITION_ENTRY_COST }];
6677
+ }
6678
+ return entries.map(({ price, cost }) => ({ price, cost }));
6679
+ }
6640
6680
  /**
6641
6681
  * Performs a single tick of strategy execution.
6642
6682
  *
@@ -9291,6 +9331,15 @@ class StrategyConnectionService {
9291
9331
  const strategy = this.getStrategy(symbol, context.strategyName, context.exchangeName, context.frameName, backtest);
9292
9332
  return await strategy.getPositionPartials(symbol);
9293
9333
  };
9334
+ this.getPositionEntries = async (backtest, symbol, context) => {
9335
+ this.loggerService.log("strategyConnectionService getPositionEntries", {
9336
+ symbol,
9337
+ context,
9338
+ backtest,
9339
+ });
9340
+ const strategy = this.getStrategy(symbol, context.strategyName, context.exchangeName, context.frameName, backtest);
9341
+ return await strategy.getPositionEntries(symbol);
9342
+ };
9294
9343
  /**
9295
9344
  * Retrieves the currently active scheduled signal for the strategy.
9296
9345
  * If no scheduled signal exists, returns null.
@@ -12980,6 +13029,14 @@ class StrategyCoreService {
12980
13029
  await this.validate(context);
12981
13030
  return await this.strategyConnectionService.getPositionPartials(backtest, symbol, context);
12982
13031
  };
13032
+ this.getPositionEntries = async (backtest, symbol, context) => {
13033
+ this.loggerService.log("strategyCoreService getPositionEntries", {
13034
+ symbol,
13035
+ context,
13036
+ });
13037
+ await this.validate(context);
13038
+ return await this.strategyConnectionService.getPositionEntries(backtest, symbol, context);
13039
+ };
12983
13040
  /**
12984
13041
  * Retrieves the currently active scheduled signal for the symbol.
12985
13042
  * If no scheduled signal exists, returns null.
@@ -34032,6 +34089,7 @@ const BACKTEST_METHOD_NAME_GET_POSITION_PNL_PERCENT = "BacktestUtils.getPosition
34032
34089
  const BACKTEST_METHOD_NAME_GET_POSITION_PNL_COST = "BacktestUtils.getPositionPnlCost";
34033
34090
  const BACKTEST_METHOD_NAME_GET_POSITION_LEVELS = "BacktestUtils.getPositionLevels";
34034
34091
  const BACKTEST_METHOD_NAME_GET_POSITION_PARTIALS = "BacktestUtils.getPositionPartials";
34092
+ const BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES = "BacktestUtils.getPositionEntries";
34035
34093
  const BACKTEST_METHOD_NAME_BREAKEVEN = "Backtest.commitBreakeven";
34036
34094
  const BACKTEST_METHOD_NAME_CANCEL_SCHEDULED = "Backtest.commitCancelScheduled";
34037
34095
  const BACKTEST_METHOD_NAME_CLOSE_PENDING = "Backtest.commitClosePending";
@@ -34787,6 +34845,41 @@ class BacktestUtils {
34787
34845
  }
34788
34846
  return await bt.strategyCoreService.getPositionPartials(true, symbol, context);
34789
34847
  };
34848
+ /**
34849
+ * Returns the list of DCA entry prices and costs for the current pending signal.
34850
+ *
34851
+ * Each element represents a single position entry — the initial open or a subsequent
34852
+ * DCA entry added via commitAverageBuy.
34853
+ *
34854
+ * Returns null if no pending signal exists.
34855
+ * Returns a single-element array if no DCA entries were made.
34856
+ *
34857
+ * Each entry contains:
34858
+ * - `price` — execution price of this entry
34859
+ * - `cost` — dollar cost allocated to this entry (e.g. 100 for $100)
34860
+ *
34861
+ * @param symbol - Trading pair symbol
34862
+ * @param context - Execution context with strategyName, exchangeName, and frameName
34863
+ * @returns Array of entry records, or null if no active position
34864
+ */
34865
+ this.getPositionEntries = async (symbol, context) => {
34866
+ bt.loggerService.info(BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES, {
34867
+ symbol,
34868
+ context,
34869
+ });
34870
+ bt.strategyValidationService.validate(context.strategyName, BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES);
34871
+ bt.exchangeValidationService.validate(context.exchangeName, BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES);
34872
+ {
34873
+ const { riskName, riskList, actions } = bt.strategySchemaService.get(context.strategyName);
34874
+ riskName &&
34875
+ bt.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES);
34876
+ riskList &&
34877
+ riskList.forEach((riskName) => bt.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES));
34878
+ actions &&
34879
+ actions.forEach((actionName) => bt.actionValidationService.validate(actionName, BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES));
34880
+ }
34881
+ return await bt.strategyCoreService.getPositionEntries(true, symbol, context);
34882
+ };
34790
34883
  /**
34791
34884
  * Stops the strategy from generating new signals.
34792
34885
  *
@@ -35809,6 +35902,7 @@ const LIVE_METHOD_NAME_GET_POSITION_PNL_PERCENT = "LiveUtils.getPositionPnlPerce
35809
35902
  const LIVE_METHOD_NAME_GET_POSITION_PNL_COST = "LiveUtils.getPositionPnlCost";
35810
35903
  const LIVE_METHOD_NAME_GET_POSITION_LEVELS = "LiveUtils.getPositionLevels";
35811
35904
  const LIVE_METHOD_NAME_GET_POSITION_PARTIALS = "LiveUtils.getPositionPartials";
35905
+ const LIVE_METHOD_NAME_GET_POSITION_ENTRIES = "LiveUtils.getPositionEntries";
35812
35906
  const LIVE_METHOD_NAME_BREAKEVEN = "Live.commitBreakeven";
35813
35907
  const LIVE_METHOD_NAME_CANCEL_SCHEDULED = "Live.cancelScheduled";
35814
35908
  const LIVE_METHOD_NAME_CLOSE_PENDING = "Live.closePending";
@@ -36623,6 +36717,45 @@ class LiveUtils {
36623
36717
  frameName: "",
36624
36718
  });
36625
36719
  };
36720
+ /**
36721
+ * Returns the list of DCA entry prices and costs for the current pending signal.
36722
+ *
36723
+ * Each element represents a single position entry — the initial open or a subsequent
36724
+ * DCA entry added via commitAverageBuy.
36725
+ *
36726
+ * Returns null if no pending signal exists.
36727
+ * Returns a single-element array if no DCA entries were made.
36728
+ *
36729
+ * Each entry contains:
36730
+ * - `price` — execution price of this entry
36731
+ * - `cost` — dollar cost allocated to this entry (e.g. 100 for $100)
36732
+ *
36733
+ * @param symbol - Trading pair symbol
36734
+ * @param context - Execution context with strategyName and exchangeName
36735
+ * @returns Array of entry records, or null if no active position
36736
+ */
36737
+ this.getPositionEntries = async (symbol, context) => {
36738
+ bt.loggerService.info(LIVE_METHOD_NAME_GET_POSITION_ENTRIES, {
36739
+ symbol,
36740
+ context,
36741
+ });
36742
+ bt.strategyValidationService.validate(context.strategyName, LIVE_METHOD_NAME_GET_POSITION_ENTRIES);
36743
+ bt.exchangeValidationService.validate(context.exchangeName, LIVE_METHOD_NAME_GET_POSITION_ENTRIES);
36744
+ {
36745
+ const { riskName, riskList, actions } = bt.strategySchemaService.get(context.strategyName);
36746
+ riskName &&
36747
+ bt.riskValidationService.validate(riskName, LIVE_METHOD_NAME_GET_POSITION_ENTRIES);
36748
+ riskList &&
36749
+ riskList.forEach((riskName) => bt.riskValidationService.validate(riskName, LIVE_METHOD_NAME_GET_POSITION_ENTRIES));
36750
+ actions &&
36751
+ actions.forEach((actionName) => bt.actionValidationService.validate(actionName, LIVE_METHOD_NAME_GET_POSITION_ENTRIES));
36752
+ }
36753
+ return await bt.strategyCoreService.getPositionEntries(false, symbol, {
36754
+ strategyName: context.strategyName,
36755
+ exchangeName: context.exchangeName,
36756
+ frameName: "",
36757
+ });
36758
+ };
36626
36759
  /**
36627
36760
  * Stops the strategy from generating new signals.
36628
36761
  *
package/build/index.mjs CHANGED
@@ -6610,6 +6610,18 @@ class ClientStrategy {
6610
6610
  }
6611
6611
  return entries.map((e) => e.price);
6612
6612
  }
6613
+ /**
6614
+ * Returns the list of partial closes for the current pending signal.
6615
+ *
6616
+ * Each entry records a partial profit or loss close event with its type,
6617
+ * percent closed, price at close, cost basis snapshot, and entry count at close.
6618
+ *
6619
+ * Returns null if no pending signal exists.
6620
+ * Returns an empty array if no partial closes have been executed.
6621
+ *
6622
+ * @param symbol - Trading pair symbol
6623
+ * @returns Promise resolving to array of partial close records or null
6624
+ */
6613
6625
  async getPositionPartials(symbol) {
6614
6626
  this.params.logger.debug("ClientStrategy getPositionPartials", { symbol });
6615
6627
  if (!this._pendingSignal) {
@@ -6617,6 +6629,34 @@ class ClientStrategy {
6617
6629
  }
6618
6630
  return this._pendingSignal._partial ?? [];
6619
6631
  }
6632
+ /**
6633
+ * Returns the list of DCA entry prices and costs for the current pending signal.
6634
+ *
6635
+ * Each entry records the price and cost of a single position entry.
6636
+ * The first element is always the original priceOpen (initial entry).
6637
+ * Each subsequent element is an entry added by averageBuy().
6638
+ *
6639
+ * Returns null if no pending signal exists.
6640
+ * Returns a single-element array [{ price: priceOpen, cost }] if no DCA entries were made.
6641
+ *
6642
+ * @param symbol - Trading pair symbol
6643
+ * @returns Promise resolving to array of entry records or null
6644
+ *
6645
+ * @example
6646
+ * // No DCA: [{ price: 43000, cost: 100 }]
6647
+ * // One DCA: [{ price: 43000, cost: 100 }, { price: 42000, cost: 100 }]
6648
+ */
6649
+ async getPositionEntries(symbol) {
6650
+ this.params.logger.debug("ClientStrategy getPositionEntries", { symbol });
6651
+ if (!this._pendingSignal) {
6652
+ return null;
6653
+ }
6654
+ const entries = this._pendingSignal._entry;
6655
+ if (!entries || entries.length === 0) {
6656
+ return [{ price: this._pendingSignal.priceOpen, cost: GLOBAL_CONFIG.CC_POSITION_ENTRY_COST }];
6657
+ }
6658
+ return entries.map(({ price, cost }) => ({ price, cost }));
6659
+ }
6620
6660
  /**
6621
6661
  * Performs a single tick of strategy execution.
6622
6662
  *
@@ -9271,6 +9311,15 @@ class StrategyConnectionService {
9271
9311
  const strategy = this.getStrategy(symbol, context.strategyName, context.exchangeName, context.frameName, backtest);
9272
9312
  return await strategy.getPositionPartials(symbol);
9273
9313
  };
9314
+ this.getPositionEntries = async (backtest, symbol, context) => {
9315
+ this.loggerService.log("strategyConnectionService getPositionEntries", {
9316
+ symbol,
9317
+ context,
9318
+ backtest,
9319
+ });
9320
+ const strategy = this.getStrategy(symbol, context.strategyName, context.exchangeName, context.frameName, backtest);
9321
+ return await strategy.getPositionEntries(symbol);
9322
+ };
9274
9323
  /**
9275
9324
  * Retrieves the currently active scheduled signal for the strategy.
9276
9325
  * If no scheduled signal exists, returns null.
@@ -12960,6 +13009,14 @@ class StrategyCoreService {
12960
13009
  await this.validate(context);
12961
13010
  return await this.strategyConnectionService.getPositionPartials(backtest, symbol, context);
12962
13011
  };
13012
+ this.getPositionEntries = async (backtest, symbol, context) => {
13013
+ this.loggerService.log("strategyCoreService getPositionEntries", {
13014
+ symbol,
13015
+ context,
13016
+ });
13017
+ await this.validate(context);
13018
+ return await this.strategyConnectionService.getPositionEntries(backtest, symbol, context);
13019
+ };
12963
13020
  /**
12964
13021
  * Retrieves the currently active scheduled signal for the symbol.
12965
13022
  * If no scheduled signal exists, returns null.
@@ -34012,6 +34069,7 @@ const BACKTEST_METHOD_NAME_GET_POSITION_PNL_PERCENT = "BacktestUtils.getPosition
34012
34069
  const BACKTEST_METHOD_NAME_GET_POSITION_PNL_COST = "BacktestUtils.getPositionPnlCost";
34013
34070
  const BACKTEST_METHOD_NAME_GET_POSITION_LEVELS = "BacktestUtils.getPositionLevels";
34014
34071
  const BACKTEST_METHOD_NAME_GET_POSITION_PARTIALS = "BacktestUtils.getPositionPartials";
34072
+ const BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES = "BacktestUtils.getPositionEntries";
34015
34073
  const BACKTEST_METHOD_NAME_BREAKEVEN = "Backtest.commitBreakeven";
34016
34074
  const BACKTEST_METHOD_NAME_CANCEL_SCHEDULED = "Backtest.commitCancelScheduled";
34017
34075
  const BACKTEST_METHOD_NAME_CLOSE_PENDING = "Backtest.commitClosePending";
@@ -34767,6 +34825,41 @@ class BacktestUtils {
34767
34825
  }
34768
34826
  return await bt.strategyCoreService.getPositionPartials(true, symbol, context);
34769
34827
  };
34828
+ /**
34829
+ * Returns the list of DCA entry prices and costs for the current pending signal.
34830
+ *
34831
+ * Each element represents a single position entry — the initial open or a subsequent
34832
+ * DCA entry added via commitAverageBuy.
34833
+ *
34834
+ * Returns null if no pending signal exists.
34835
+ * Returns a single-element array if no DCA entries were made.
34836
+ *
34837
+ * Each entry contains:
34838
+ * - `price` — execution price of this entry
34839
+ * - `cost` — dollar cost allocated to this entry (e.g. 100 for $100)
34840
+ *
34841
+ * @param symbol - Trading pair symbol
34842
+ * @param context - Execution context with strategyName, exchangeName, and frameName
34843
+ * @returns Array of entry records, or null if no active position
34844
+ */
34845
+ this.getPositionEntries = async (symbol, context) => {
34846
+ bt.loggerService.info(BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES, {
34847
+ symbol,
34848
+ context,
34849
+ });
34850
+ bt.strategyValidationService.validate(context.strategyName, BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES);
34851
+ bt.exchangeValidationService.validate(context.exchangeName, BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES);
34852
+ {
34853
+ const { riskName, riskList, actions } = bt.strategySchemaService.get(context.strategyName);
34854
+ riskName &&
34855
+ bt.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES);
34856
+ riskList &&
34857
+ riskList.forEach((riskName) => bt.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES));
34858
+ actions &&
34859
+ actions.forEach((actionName) => bt.actionValidationService.validate(actionName, BACKTEST_METHOD_NAME_GET_POSITION_ENTRIES));
34860
+ }
34861
+ return await bt.strategyCoreService.getPositionEntries(true, symbol, context);
34862
+ };
34770
34863
  /**
34771
34864
  * Stops the strategy from generating new signals.
34772
34865
  *
@@ -35789,6 +35882,7 @@ const LIVE_METHOD_NAME_GET_POSITION_PNL_PERCENT = "LiveUtils.getPositionPnlPerce
35789
35882
  const LIVE_METHOD_NAME_GET_POSITION_PNL_COST = "LiveUtils.getPositionPnlCost";
35790
35883
  const LIVE_METHOD_NAME_GET_POSITION_LEVELS = "LiveUtils.getPositionLevels";
35791
35884
  const LIVE_METHOD_NAME_GET_POSITION_PARTIALS = "LiveUtils.getPositionPartials";
35885
+ const LIVE_METHOD_NAME_GET_POSITION_ENTRIES = "LiveUtils.getPositionEntries";
35792
35886
  const LIVE_METHOD_NAME_BREAKEVEN = "Live.commitBreakeven";
35793
35887
  const LIVE_METHOD_NAME_CANCEL_SCHEDULED = "Live.cancelScheduled";
35794
35888
  const LIVE_METHOD_NAME_CLOSE_PENDING = "Live.closePending";
@@ -36603,6 +36697,45 @@ class LiveUtils {
36603
36697
  frameName: "",
36604
36698
  });
36605
36699
  };
36700
+ /**
36701
+ * Returns the list of DCA entry prices and costs for the current pending signal.
36702
+ *
36703
+ * Each element represents a single position entry — the initial open or a subsequent
36704
+ * DCA entry added via commitAverageBuy.
36705
+ *
36706
+ * Returns null if no pending signal exists.
36707
+ * Returns a single-element array if no DCA entries were made.
36708
+ *
36709
+ * Each entry contains:
36710
+ * - `price` — execution price of this entry
36711
+ * - `cost` — dollar cost allocated to this entry (e.g. 100 for $100)
36712
+ *
36713
+ * @param symbol - Trading pair symbol
36714
+ * @param context - Execution context with strategyName and exchangeName
36715
+ * @returns Array of entry records, or null if no active position
36716
+ */
36717
+ this.getPositionEntries = async (symbol, context) => {
36718
+ bt.loggerService.info(LIVE_METHOD_NAME_GET_POSITION_ENTRIES, {
36719
+ symbol,
36720
+ context,
36721
+ });
36722
+ bt.strategyValidationService.validate(context.strategyName, LIVE_METHOD_NAME_GET_POSITION_ENTRIES);
36723
+ bt.exchangeValidationService.validate(context.exchangeName, LIVE_METHOD_NAME_GET_POSITION_ENTRIES);
36724
+ {
36725
+ const { riskName, riskList, actions } = bt.strategySchemaService.get(context.strategyName);
36726
+ riskName &&
36727
+ bt.riskValidationService.validate(riskName, LIVE_METHOD_NAME_GET_POSITION_ENTRIES);
36728
+ riskList &&
36729
+ riskList.forEach((riskName) => bt.riskValidationService.validate(riskName, LIVE_METHOD_NAME_GET_POSITION_ENTRIES));
36730
+ actions &&
36731
+ actions.forEach((actionName) => bt.actionValidationService.validate(actionName, LIVE_METHOD_NAME_GET_POSITION_ENTRIES));
36732
+ }
36733
+ return await bt.strategyCoreService.getPositionEntries(false, symbol, {
36734
+ strategyName: context.strategyName,
36735
+ exchangeName: context.exchangeName,
36736
+ frameName: "",
36737
+ });
36738
+ };
36606
36739
  /**
36607
36740
  * Stops the strategy from generating new signals.
36608
36741
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backtest-kit",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "A TypeScript library for trading system backtest",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
package/types.d.ts CHANGED
@@ -2850,6 +2850,23 @@ interface IStrategy {
2850
2850
  * Returns null if no pending signal exists.
2851
2851
  */
2852
2852
  getPositionPnlCost: (symbol: string, currentPrice: number) => Promise<number | null>;
2853
+ /**
2854
+ * Returns the list of DCA entry prices and costs for the current pending signal.
2855
+ *
2856
+ * Each entry records the price and cost of a single position entry.
2857
+ * The first element is always the original priceOpen (initial entry).
2858
+ * Each subsequent element is an entry added by averageBuy().
2859
+ *
2860
+ * Returns null if no pending signal exists.
2861
+ * Returns a single-element array [{ price: priceOpen, cost }] if no DCA entries were made.
2862
+ *
2863
+ * @param symbol - Trading pair symbol
2864
+ * @returns Promise resolving to array of entry records or null
2865
+ */
2866
+ getPositionEntries: (symbol: string) => Promise<Array<{
2867
+ price: number;
2868
+ cost: number;
2869
+ }> | null>;
2853
2870
  /**
2854
2871
  * Fast backtest using historical candles.
2855
2872
  * Iterates through candles, calculates VWAP, checks TP/SL on each candle.
@@ -4698,7 +4715,7 @@ declare function getTotalCostClosed(symbol: string): Promise<number>;
4698
4715
  * }
4699
4716
  * ```
4700
4717
  */
4701
- declare function getPendingSignal(symbol: string): Promise<ISignalRow>;
4718
+ declare function getPendingSignal(symbol: string): Promise<IPublicSignalRow>;
4702
4719
  /**
4703
4720
  * Returns the currently active scheduled signal for the strategy.
4704
4721
  * If no scheduled signal exists, returns null.
@@ -11418,7 +11435,7 @@ declare class BacktestUtils {
11418
11435
  strategyName: StrategyName;
11419
11436
  exchangeName: ExchangeName;
11420
11437
  frameName: FrameName;
11421
- }) => Promise<ISignalRow>;
11438
+ }) => Promise<IPublicSignalRow>;
11422
11439
  /**
11423
11440
  * Returns the percentage of the position currently held (not closed).
11424
11441
  * 100 = nothing has been closed (full position), 0 = fully closed.
@@ -11631,6 +11648,31 @@ declare class BacktestUtils {
11631
11648
  entryCountAtClose: number;
11632
11649
  debugTimestamp?: number;
11633
11650
  }[]>;
11651
+ /**
11652
+ * Returns the list of DCA entry prices and costs for the current pending signal.
11653
+ *
11654
+ * Each element represents a single position entry — the initial open or a subsequent
11655
+ * DCA entry added via commitAverageBuy.
11656
+ *
11657
+ * Returns null if no pending signal exists.
11658
+ * Returns a single-element array if no DCA entries were made.
11659
+ *
11660
+ * Each entry contains:
11661
+ * - `price` — execution price of this entry
11662
+ * - `cost` — dollar cost allocated to this entry (e.g. 100 for $100)
11663
+ *
11664
+ * @param symbol - Trading pair symbol
11665
+ * @param context - Execution context with strategyName, exchangeName, and frameName
11666
+ * @returns Array of entry records, or null if no active position
11667
+ */
11668
+ getPositionEntries: (symbol: string, context: {
11669
+ strategyName: StrategyName;
11670
+ exchangeName: ExchangeName;
11671
+ frameName: FrameName;
11672
+ }) => Promise<{
11673
+ price: number;
11674
+ cost: number;
11675
+ }[]>;
11634
11676
  /**
11635
11677
  * Stops the strategy from generating new signals.
11636
11678
  *
@@ -12488,7 +12530,7 @@ declare class LiveUtils {
12488
12530
  getPendingSignal: (symbol: string, currentPrice: number, context: {
12489
12531
  strategyName: StrategyName;
12490
12532
  exchangeName: ExchangeName;
12491
- }) => Promise<ISignalRow>;
12533
+ }) => Promise<IPublicSignalRow>;
12492
12534
  /**
12493
12535
  * Returns the percentage of the position currently held (not closed).
12494
12536
  * 100 = nothing has been closed (full position), 0 = fully closed.
@@ -12689,6 +12731,30 @@ declare class LiveUtils {
12689
12731
  entryCountAtClose: number;
12690
12732
  debugTimestamp?: number;
12691
12733
  }[]>;
12734
+ /**
12735
+ * Returns the list of DCA entry prices and costs for the current pending signal.
12736
+ *
12737
+ * Each element represents a single position entry — the initial open or a subsequent
12738
+ * DCA entry added via commitAverageBuy.
12739
+ *
12740
+ * Returns null if no pending signal exists.
12741
+ * Returns a single-element array if no DCA entries were made.
12742
+ *
12743
+ * Each entry contains:
12744
+ * - `price` — execution price of this entry
12745
+ * - `cost` — dollar cost allocated to this entry (e.g. 100 for $100)
12746
+ *
12747
+ * @param symbol - Trading pair symbol
12748
+ * @param context - Execution context with strategyName and exchangeName
12749
+ * @returns Array of entry records, or null if no active position
12750
+ */
12751
+ getPositionEntries: (symbol: string, context: {
12752
+ strategyName: StrategyName;
12753
+ exchangeName: ExchangeName;
12754
+ }) => Promise<{
12755
+ price: number;
12756
+ cost: number;
12757
+ }[]>;
12692
12758
  /**
12693
12759
  * Stops the strategy from generating new signals.
12694
12760
  *
@@ -20652,7 +20718,7 @@ declare class StrategyConnectionService implements TStrategy$1 {
20652
20718
  strategyName: StrategyName;
20653
20719
  exchangeName: ExchangeName;
20654
20720
  frameName: FrameName;
20655
- }) => Promise<ISignalRow | null>;
20721
+ }) => Promise<IPublicSignalRow | null>;
20656
20722
  /**
20657
20723
  * Returns the percentage of the position currently held (not closed).
20658
20724
  * 100 = nothing has been closed (full position), 0 = fully closed.
@@ -20724,6 +20790,14 @@ declare class StrategyConnectionService implements TStrategy$1 {
20724
20790
  entryCountAtClose: number;
20725
20791
  debugTimestamp?: number;
20726
20792
  }[]>;
20793
+ getPositionEntries: (backtest: boolean, symbol: string, context: {
20794
+ strategyName: StrategyName;
20795
+ exchangeName: ExchangeName;
20796
+ frameName: FrameName;
20797
+ }) => Promise<{
20798
+ price: number;
20799
+ cost: number;
20800
+ }[]>;
20727
20801
  /**
20728
20802
  * Retrieves the currently active scheduled signal for the strategy.
20729
20803
  * If no scheduled signal exists, returns null.
@@ -21897,7 +21971,7 @@ declare class StrategyCoreService implements TStrategy {
21897
21971
  strategyName: StrategyName;
21898
21972
  exchangeName: ExchangeName;
21899
21973
  frameName: FrameName;
21900
- }) => Promise<ISignalRow | null>;
21974
+ }) => Promise<IPublicSignalRow | null>;
21901
21975
  /**
21902
21976
  * Returns the percentage of the position currently held (not closed).
21903
21977
  * 100 = nothing has been closed (full position), 0 = fully closed.
@@ -21969,6 +22043,14 @@ declare class StrategyCoreService implements TStrategy {
21969
22043
  entryCountAtClose: number;
21970
22044
  debugTimestamp?: number;
21971
22045
  }[]>;
22046
+ getPositionEntries: (backtest: boolean, symbol: string, context: {
22047
+ strategyName: StrategyName;
22048
+ exchangeName: ExchangeName;
22049
+ frameName: FrameName;
22050
+ }) => Promise<{
22051
+ price: number;
22052
+ cost: number;
22053
+ }[]>;
21972
22054
  /**
21973
22055
  * Retrieves the currently active scheduled signal for the symbol.
21974
22056
  * If no scheduled signal exists, returns null.