backtest-kit 15.0.0 → 15.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backtest-kit",
3
- "version": "15.0.0",
3
+ "version": "15.2.0",
4
4
  "description": "A TypeScript library for trading system backtest",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",
@@ -78,7 +78,7 @@
78
78
  "di-scoped": "^1.0.21",
79
79
  "di-singleton": "^1.0.5",
80
80
  "functools-kit": "^4.0.0",
81
- "get-moment-stamp": "^2.0.0"
81
+ "get-moment-stamp": "^3.0.0"
82
82
  },
83
83
  "publishConfig": {
84
84
  "access": "public"
package/types.d.ts CHANGED
@@ -32129,7 +32129,9 @@ declare class ClientExchange implements IExchange {
32129
32129
  * @param symbol - Trading pair symbol
32130
32130
  * @param interval - Candle interval
32131
32131
  * @param limit - Number of candles to fetch
32132
- * @returns Promise resolving to array of candles
32132
+ * @returns Promise resolving to array of candles; an EMPTY array when the
32133
+ * requested range extends beyond Date.now() (those candles have not
32134
+ * closed yet in the real world — the caller decides how to proceed)
32133
32135
  * @throws Error if trying to fetch future candles in live mode
32134
32136
  */
32135
32137
  getNextCandles(symbol: string, interval: CandleInterval, limit: number): Promise<ICandleData[]>;
@@ -32470,10 +32472,20 @@ declare class ClientRisk implements IRisk {
32470
32472
  readonly params: IRiskParams;
32471
32473
  /**
32472
32474
  * Map of active positions tracked across all strategies.
32473
- * Key: `${strategyName}:${exchangeName}:${symbol}`
32475
+ * Key: `${strategyName}_${exchangeName}_${symbol}` (see CREATE_NAME_FN)
32474
32476
  * Starts as POSITION_NEED_FETCH symbol, gets initialized on first use.
32475
32477
  */
32476
32478
  _activePositions: RiskMap | typeof POSITION_NEED_FETCH;
32479
+ /**
32480
+ * Keys of transient reservation placeholders (checkSignalAndReserve) still
32481
+ * awaiting their finalizing addSignal / releasing removeSignal. Excluded from
32482
+ * persisted snapshots in _updatePositions: a reservation is process-transient,
32483
+ * but a CONCURRENT strategy's addSignal persists the whole shared map — flushed
32484
+ * to disk that placeholder would survive a crash as a phantom position and
32485
+ * block the shared concurrency limit for the whole signal lifetime (forever
32486
+ * for minuteEstimatedTime: Infinity, which the expiry pruning never removes).
32487
+ */
32488
+ _reservedKeys: Set<string>;
32477
32489
  constructor(params: IRiskParams);
32478
32490
  /**
32479
32491
  * Initializes active positions by loading from persistence.
@@ -35089,6 +35101,12 @@ declare class ClientAction implements IAction {
35089
35101
  * Starts as null, gets initialized on first use.
35090
35102
  */
35091
35103
  _handlerInstance: ActionProxy | null;
35104
+ /**
35105
+ * Terminal flag set by dispose(). Once true, all event methods become no-ops:
35106
+ * the handler will not be recreated (waitForInit is singleshot), so late
35107
+ * events must not reach the schema callbacks either.
35108
+ */
35109
+ _isDisposed: boolean;
35092
35110
  /**
35093
35111
  * Creates a new ClientAction instance.
35094
35112
  *