backtest-kit 9.8.1 → 9.8.3

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.
Files changed (6) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +1898 -1871
  3. package/build/index.cjs +949 -282
  4. package/build/index.mjs +944 -283
  5. package/package.json +86 -86
  6. package/types.d.ts +551 -151
package/types.d.ts CHANGED
@@ -178,6 +178,19 @@ declare class TimeMetaService {
178
178
  * Instances are cached until clear() is called.
179
179
  */
180
180
  private getSource;
181
+ /**
182
+ * Checks if a timestamp exists for the given symbol and context.
183
+ *
184
+ * @param symbol - Trading pair symbol (e.g., "BTCUSDT")
185
+ * @param context - Strategy, exchange, and frame identifiers
186
+ * @param backtest - True if backtest mode, false if live mode
187
+ * @returns True if a timestamp is available, false otherwise
188
+ */
189
+ hasTimestamp: (symbol: string, context: {
190
+ strategyName: string;
191
+ exchangeName: string;
192
+ frameName: string;
193
+ }, backtest: boolean) => boolean;
181
194
  /**
182
195
  * Returns the current candle timestamp (in milliseconds) for the given symbol and context.
183
196
  *
@@ -4393,7 +4406,7 @@ type ExchangeName = string;
4393
4406
  * Parameters for pre-caching candles into persist storage.
4394
4407
  * Used to download historical candle data before running a backtest.
4395
4408
  */
4396
- interface ICacheCandlesParams {
4409
+ interface IWarmCandlesParams {
4397
4410
  /** Trading pair symbol (e.g., "BTCUSDT") */
4398
4411
  symbol: string;
4399
4412
  /** Name of the registered exchange schema */
@@ -4421,6 +4434,17 @@ interface ICheckCandlesParams {
4421
4434
  /** End date of the validation range (inclusive) */
4422
4435
  to: Date;
4423
4436
  }
4437
+ /**
4438
+ * Parameters for the combined check-then-warm caching flow.
4439
+ * Extends both validation and pre-cache parameter sets and adds
4440
+ * lifecycle callbacks invoked before each phase of the flow.
4441
+ */
4442
+ interface ICacheCandlesParams extends IWarmCandlesParams, ICheckCandlesParams {
4443
+ /** Invoked before the cache validation phase starts */
4444
+ onWarmStart?: (symbol: string, interval: CandleInterval, from: Date, to: Date) => void;
4445
+ /** Invoked before the cache warm-up phase starts (after a validation miss) */
4446
+ onCheckStart?: (symbol: string, interval: CandleInterval, from: Date, to: Date) => void;
4447
+ }
4424
4448
  /**
4425
4449
  * Checks cached candle presence via the persist adapter.
4426
4450
  * Issues one ranged read; adapter-side `hasValue` covers each expected timestamp,
@@ -4435,7 +4459,15 @@ declare function checkCandles(params: ICheckCandlesParams): Promise<void>;
4435
4459
  *
4436
4460
  * @param params - Cache parameters
4437
4461
  */
4438
- declare function warmCandles(params: ICacheCandlesParams): Promise<void>;
4462
+ declare function warmCandles(params: IWarmCandlesParams): Promise<void>;
4463
+ /**
4464
+ * Ensures candles for the given range are present in persist storage.
4465
+ * Runs a check-then-warm pipeline with one retry: validates the cache first
4466
+ * and, on a miss, downloads the missing data and re-validates.
4467
+ *
4468
+ * @param params - Combined cache parameters with optional lifecycle callbacks
4469
+ */
4470
+ declare function cacheCandles({ symbol, interval, from, to, exchangeName, onCheckStart, onWarmStart, }: ICacheCandlesParams): Promise<void>;
4439
4471
 
4440
4472
  /**
4441
4473
  * Type alias for enum objects with string key-value pairs
@@ -6633,6 +6665,22 @@ declare const GLOBAL_CONFIG: {
6633
6665
  * Default: true (mutex locking enabled for candle fetching)
6634
6666
  */
6635
6667
  CC_ENABLE_CANDLE_FETCH_MUTEX: boolean;
6668
+ /**
6669
+ * Enables cooperative interleaving of concurrently running backtests after each candle fetch.
6670
+ *
6671
+ * Mechanism (implemented in `Candle.spinLock`):
6672
+ * - After `getNextCandles` resolves, the current backtest awaits
6673
+ * `Promise.race([_spin.toPromise(), sleep(50)])`, where `_spin` is emitted whenever
6674
+ * another caller acquires the candle-fetch mutex.
6675
+ * - This hands the event loop to a peer backtest waiting on the same mutex, so multiple
6676
+ * parallel `Backtest.run` / `Walker` workloads progress in round-robin fashion instead
6677
+ * of one monopolizing the event loop until completion.
6678
+ * - The spin is skipped entirely when `Lookup.isParallel` is `false` (single active workload —
6679
+ * no peer to yield to) or when `CC_ENABLE_CANDLE_FETCH_MUTEX` is disabled.
6680
+ *
6681
+ * Default: true (parallel backtests are interleaved on each candle fetch boundary)
6682
+ */
6683
+ CC_ENABLE_BACKTEST_PARALLEL_SPIN: boolean;
6636
6684
  /**
6637
6685
  * Enables DCA (Dollar-Cost Averaging) logic even if antirecord is not broken.
6638
6686
  * Allows to commitAverageBuy if currentPrice is not the lowest price since entry, but still lower than priceOpen.
@@ -6809,6 +6857,7 @@ declare function getConfig(): {
6809
6857
  CC_MAX_SIGNALS: number;
6810
6858
  CC_MAX_LOG_LINES: number;
6811
6859
  CC_ENABLE_CANDLE_FETCH_MUTEX: boolean;
6860
+ CC_ENABLE_BACKTEST_PARALLEL_SPIN: boolean;
6812
6861
  CC_ENABLE_DCA_EVERYWHERE: boolean;
6813
6862
  CC_ENABLE_PPPL_EVERYWHERE: boolean;
6814
6863
  CC_ENABLE_LONG_SIGNAL: boolean;
@@ -6867,6 +6916,7 @@ declare function getDefaultConfig(): Readonly<{
6867
6916
  CC_MAX_SIGNALS: number;
6868
6917
  CC_MAX_LOG_LINES: number;
6869
6918
  CC_ENABLE_CANDLE_FETCH_MUTEX: boolean;
6919
+ CC_ENABLE_BACKTEST_PARALLEL_SPIN: boolean;
6870
6920
  CC_ENABLE_DCA_EVERYWHERE: boolean;
6871
6921
  CC_ENABLE_PPPL_EVERYWHERE: boolean;
6872
6922
  CC_ENABLE_LONG_SIGNAL: boolean;
@@ -8142,6 +8192,174 @@ interface SignalInfoContract {
8142
8192
  timestamp: number;
8143
8193
  }
8144
8194
 
8195
+ /**
8196
+ * Contract for the beforeStart lifecycle event of strategy execution.
8197
+ *
8198
+ * Emitted by the engine immediately before it begins iterating the strategy
8199
+ * for a given symbol — after validation and context setup, but before the
8200
+ * first candle/tick is processed. Used by subscribers to perform
8201
+ * initialization that should happen exactly once per run: opening log files,
8202
+ * resetting per-run accumulators, sending a "run started" notification,
8203
+ * snapshotting initial state, etc.
8204
+ *
8205
+ * Guarantees:
8206
+ * - Fires exactly once per `run()` invocation, before any signal is yielded.
8207
+ * - Always paired with an `AfterEndContract` event for the same run, even if
8208
+ * the iterator is interrupted, throws, or is cancelled externally. If
8209
+ * beforeStart fires, afterEnd is guaranteed to fire afterwards.
8210
+ * - Listener errors are caught and routed to the global errorEmitter; they
8211
+ * never abort the run.
8212
+ *
8213
+ * Mode differences:
8214
+ * - In backtest mode, `when` is the planned start of the frame (from
8215
+ * FrameSchemaService.startDate, aligned to 1-minute boundary). It is the
8216
+ * intended beginning of the historical replay, not wall-clock time.
8217
+ * - In live mode, `when` is the current wall-clock time aligned to the
8218
+ * 1-minute boundary.
8219
+ *
8220
+ * @see AfterEndContract — the paired completion event.
8221
+ */
8222
+ interface BeforeStartContract {
8223
+ /**
8224
+ * Trading symbol the run is for (e.g., "BTCUSDT", "ETHUSDT").
8225
+ * Same value that was passed to `Backtest.run` / `Live.run`.
8226
+ */
8227
+ symbol: string;
8228
+ /**
8229
+ * Name of the strategy being executed. Use this to demultiplex events when
8230
+ * subscribing globally to runs across multiple strategies on the same
8231
+ * symbol.
8232
+ */
8233
+ strategyName: StrategyName;
8234
+ /**
8235
+ * Name of the exchange providing market data for this run.
8236
+ */
8237
+ exchangeName: ExchangeName;
8238
+ /**
8239
+ * Name of the frame (timeframe / date range) for the run. Empty string in
8240
+ * live mode, where frames are not used.
8241
+ */
8242
+ frameName: FrameName;
8243
+ /**
8244
+ * `true` if this event was emitted from a backtest run, `false` if from a
8245
+ * live trading run. Use this to branch listener logic without inspecting
8246
+ * other fields.
8247
+ */
8248
+ backtest: boolean;
8249
+ /**
8250
+ * Average symbol price observed at the moment the event was emitted,
8251
+ * fetched from `ExchangeConnectionService.getAveragePrice(symbol)`.
8252
+ * Provided as a convenience so subscribers don't need to query the
8253
+ * exchange themselves.
8254
+ */
8255
+ currentPrice: number;
8256
+ /**
8257
+ * Event time as a `Date` instance.
8258
+ *
8259
+ * In backtest: the planned start of the frame (aligned to 1-minute
8260
+ * boundary). Represents intended start time, not the moment of emission.
8261
+ *
8262
+ * In live: wall-clock now, aligned to 1-minute boundary.
8263
+ *
8264
+ * Always equal to `new Date(timestamp)`.
8265
+ */
8266
+ when: Date;
8267
+ /**
8268
+ * Same value as `when`, expressed as milliseconds since the Unix epoch.
8269
+ * Provided so subscribers can avoid calling `.getTime()` and to keep the
8270
+ * payload trivially serialisable (e.g., for forwarding over IPC or
8271
+ * writing to a log).
8272
+ */
8273
+ timestamp: number;
8274
+ }
8275
+
8276
+ /**
8277
+ * Contract for the afterEnd lifecycle event of strategy execution.
8278
+ *
8279
+ * Emitted by the engine after the strategy iterator has finished — whether
8280
+ * by reaching the end of the frame, being stopped via `stopStrategy`,
8281
+ * throwing an error, or being cancelled by the consumer (e.g., breaking out
8282
+ * of `for await`). Used by subscribers to perform teardown that should
8283
+ * happen exactly once per run: flushing buffers, closing files, computing
8284
+ * final aggregates, sending a "run completed" notification, etc.
8285
+ *
8286
+ * Guarantees:
8287
+ * - Fires exactly once per `run()` invocation, paired with the matching
8288
+ * `BeforeStartContract` event. The pairing holds for every termination
8289
+ * path including exceptions and external cancellation (delivered via the
8290
+ * generator's `try/finally` block).
8291
+ * - Listener errors are caught and routed to the global errorEmitter; they
8292
+ * never propagate to the original caller.
8293
+ *
8294
+ * Mode differences:
8295
+ * - In backtest mode, `when` is the cursor position from `TimeMetaService`
8296
+ * at the moment of completion — i.e., the historical time of the last
8297
+ * processed candle. If the run was interrupted before any candle was
8298
+ * processed (e.g., empty frame, immediate cancellation), `when` falls
8299
+ * back to the frame's planned start date so it equals
8300
+ * `BeforeStartContract.when` for the same run. This means
8301
+ * `afterEnd.when - beforeStart.when` is always the real processed
8302
+ * duration, never an inflated planned one.
8303
+ * - In live mode, `when` is the current wall-clock time aligned to the
8304
+ * 1-minute boundary at the moment of emission.
8305
+ *
8306
+ * @see BeforeStartContract — the paired initialization event.
8307
+ */
8308
+ interface AfterEndContract {
8309
+ /**
8310
+ * Trading symbol the run was for (e.g., "BTCUSDT", "ETHUSDT").
8311
+ * Matches the symbol from the paired `BeforeStartContract`.
8312
+ */
8313
+ symbol: string;
8314
+ /**
8315
+ * Name of the strategy that was executed. Use this to demultiplex events
8316
+ * when subscribing globally to runs across multiple strategies on the
8317
+ * same symbol.
8318
+ */
8319
+ strategyName: StrategyName;
8320
+ /**
8321
+ * Name of the exchange that provided market data for this run.
8322
+ */
8323
+ exchangeName: ExchangeName;
8324
+ /**
8325
+ * Name of the frame (timeframe / date range) the run used. Empty string
8326
+ * in live mode, where frames are not used.
8327
+ */
8328
+ frameName: FrameName;
8329
+ /**
8330
+ * `true` if this event was emitted from a backtest run, `false` if from a
8331
+ * live trading run. Use this to branch listener logic without inspecting
8332
+ * other fields.
8333
+ */
8334
+ backtest: boolean;
8335
+ /**
8336
+ * Average symbol price observed at the moment the event was emitted,
8337
+ * fetched from `ExchangeConnectionService.getAveragePrice(symbol)`.
8338
+ * Provided as a convenience so subscribers don't need to query the
8339
+ * exchange themselves.
8340
+ */
8341
+ currentPrice: number;
8342
+ /**
8343
+ * Event time as a `Date` instance.
8344
+ *
8345
+ * In backtest: cursor position from `TimeMetaService` at completion (the
8346
+ * time of the last processed candle), with fallback to the frame's
8347
+ * planned start date if no candle was processed.
8348
+ *
8349
+ * In live: wall-clock now, aligned to 1-minute boundary.
8350
+ *
8351
+ * Always equal to `new Date(timestamp)`.
8352
+ */
8353
+ when: Date;
8354
+ /**
8355
+ * Same value as `when`, expressed as milliseconds since the Unix epoch.
8356
+ * Provided so subscribers can avoid calling `.getTime()` and to keep the
8357
+ * payload trivially serialisable (e.g., for forwarding over IPC or
8358
+ * writing to a log).
8359
+ */
8360
+ timestamp: number;
8361
+ }
8362
+
8145
8363
  /**
8146
8364
  * Subscribes to all signal events with queued async processing.
8147
8365
  *
@@ -9232,6 +9450,42 @@ declare function listenSignalNotify(fn: (event: SignalInfoContract) => void): ()
9232
9450
  * @return Unsubscribe function to cancel the listener before it fires
9233
9451
  */
9234
9452
  declare function listenSignalNotifyOnce(filterFn: (event: SignalInfoContract) => boolean, fn: (event: SignalInfoContract) => void): () => void;
9453
+ /**
9454
+ * Subscribes to before start events with queued async processing.
9455
+ * Emits when the engine is about to start a new strategy execution for a symbol.
9456
+ * Events are processed sequentially in order received, even if callback is async.
9457
+ * Uses queued wrapper to prevent concurrent execution of the callback.
9458
+ * @param fn - Callback function to handle before start events
9459
+ * @return Unsubscribe function to stop listening to events
9460
+ */
9461
+ declare function listenBeforeStart(fn: (event: BeforeStartContract) => void): () => void;
9462
+ /**
9463
+ * Subscribes to filtered before start events with one-time execution.
9464
+ * Listens for events matching the filter predicate, then executes callback once
9465
+ * and automatically unsubscribes.
9466
+ * @param filterFn - Predicate to filter which events trigger the callback
9467
+ * @param fn - Callback function to handle the filtered event (called only once)
9468
+ * @return Unsubscribe function to cancel the listener before it fires
9469
+ */
9470
+ declare function listenBeforeStartOnce(filterFn: (event: BeforeStartContract) => boolean, fn: (event: BeforeStartContract) => void): () => void;
9471
+ /**
9472
+ * Subscribes to after end events with queued async processing.
9473
+ * Emits when the engine has completed processing a strategy execution for a symbol.
9474
+ * Events are processed sequentially in order received, even if callback is async.
9475
+ * Uses queued wrapper to prevent concurrent execution of the callback.
9476
+ * @param fn - Callback function to handle after end events
9477
+ * @return Unsubscribe function to stop listening to events
9478
+ */
9479
+ declare function listenAfterEnd(fn: (event: AfterEndContract) => void): () => void;
9480
+ /**
9481
+ * Subscribes to filtered after end events with one-time execution.
9482
+ * Listens for events matching the filter predicate, then executes callback once
9483
+ * and automatically unsubscribes.
9484
+ * @param filterFn - Predicate to filter which events trigger the callback
9485
+ * @param fn - Callback function to handle the filtered event (called only once)
9486
+ * @return Unsubscribe function to cancel the listener before it fires
9487
+ */
9488
+ declare function listenAfterEndOnce(filterFn: (event: AfterEndContract) => boolean, fn: (event: AfterEndContract) => void): () => void;
9235
9489
 
9236
9490
  /**
9237
9491
  * Checks if trade context is active (execution and method contexts).
@@ -9337,80 +9591,6 @@ declare function formatPrice(symbol: string, price: number): Promise<string>;
9337
9591
  * ```
9338
9592
  */
9339
9593
  declare function formatQuantity(symbol: string, quantity: number): Promise<string>;
9340
- /**
9341
- * Gets the current date from execution context.
9342
- *
9343
- * In backtest mode: returns the current timeframe date being processed
9344
- * In live mode: returns current real-time date
9345
- *
9346
- * @returns Promise resolving to current execution context date
9347
- *
9348
- * @example
9349
- * ```typescript
9350
- * const date = await getDate();
9351
- * console.log(date); // 2024-01-01T12:00:00.000Z
9352
- * ```
9353
- */
9354
- declare function getDate(): Promise<Date>;
9355
- /**
9356
- * Gets the current timestamp from execution context.
9357
- *
9358
- * In backtest mode: returns the current timeframe timestamp being processed
9359
- * In live mode: returns current real-time timestamp
9360
- *
9361
- * @returns Promise resolving to current execution context timestamp in milliseconds
9362
- * @example
9363
- * ```typescript
9364
- * const timestamp = await getTimestamp();
9365
- * console.log(timestamp); // 1700000000000
9366
- * ```
9367
- */
9368
- declare function getTimestamp(): Promise<number>;
9369
- /**
9370
- * Gets the current execution mode.
9371
- *
9372
- * @returns Promise resolving to "backtest" or "live"
9373
- *
9374
- * @example
9375
- * ```typescript
9376
- * const mode = await getMode();
9377
- * if (mode === "backtest") {
9378
- * console.log("Running in backtest mode");
9379
- * } else {
9380
- * console.log("Running in live mode");
9381
- * }
9382
- * ```
9383
- */
9384
- declare function getMode(): Promise<"backtest" | "live">;
9385
- /**
9386
- * Gets the current trading symbol from execution context.
9387
- *
9388
- * @returns Promise resolving to the current trading symbol (e.g., "BTCUSDT")
9389
- * @throws Error if execution context is not active
9390
- *
9391
- * @example
9392
- * ```typescript
9393
- * const symbol = await getSymbol();
9394
- * console.log(symbol); // "BTCUSDT"
9395
- * ```
9396
- */
9397
- declare function getSymbol(): Promise<string>;
9398
- /**
9399
- * Gets the current method context.
9400
- *
9401
- * Returns the context object from the method context service, which contains
9402
- * information about the current method execution environment.
9403
- *
9404
- * @returns Promise resolving to the current method context object
9405
- * @throws Error if method context is not active
9406
- *
9407
- * @example
9408
- * ```typescript
9409
- * const context = await getContext();
9410
- * console.log(context); // { ...method context data... }
9411
- * ```
9412
- */
9413
- declare function getContext(): Promise<IMethodContext>;
9414
9594
  /**
9415
9595
  * Fetches order book for a trading pair from the registered exchange.
9416
9596
  *
@@ -9501,6 +9681,81 @@ declare function getNextCandles(symbol: string, interval: CandleInterval, limit:
9501
9681
  */
9502
9682
  declare function getAggregatedTrades(symbol: string, limit?: number): Promise<IAggregatedTradeData[]>;
9503
9683
 
9684
+ /**
9685
+ * Gets the current date from execution context.
9686
+ *
9687
+ * In backtest mode: returns the current timeframe date being processed
9688
+ * In live mode: returns current real-time date
9689
+ *
9690
+ * @returns Promise resolving to current execution context date
9691
+ *
9692
+ * @example
9693
+ * ```typescript
9694
+ * const date = await getDate();
9695
+ * console.log(date); // 2024-01-01T12:00:00.000Z
9696
+ * ```
9697
+ */
9698
+ declare function getDate(): Promise<Date>;
9699
+ /**
9700
+ * Gets the current timestamp from execution context.
9701
+ *
9702
+ * In backtest mode: returns the current timeframe timestamp being processed
9703
+ * In live mode: returns current real-time timestamp
9704
+ *
9705
+ * @returns Promise resolving to current execution context timestamp in milliseconds
9706
+ * @example
9707
+ * ```typescript
9708
+ * const timestamp = await getTimestamp();
9709
+ * console.log(timestamp); // 1700000000000
9710
+ * ```
9711
+ */
9712
+ declare function getTimestamp(): Promise<number>;
9713
+ /**
9714
+ * Gets the current execution mode.
9715
+ *
9716
+ * @returns Promise resolving to "backtest" or "live"
9717
+ *
9718
+ * @example
9719
+ * ```typescript
9720
+ * const mode = await getMode();
9721
+ * if (mode === "backtest") {
9722
+ * console.log("Running in backtest mode");
9723
+ * } else {
9724
+ * console.log("Running in live mode");
9725
+ * }
9726
+ * ```
9727
+ */
9728
+ declare function getMode(): Promise<"backtest" | "live">;
9729
+ /**
9730
+ * Gets the current trading symbol from execution context.
9731
+ *
9732
+ * @returns Promise resolving to the current trading symbol (e.g., "BTCUSDT")
9733
+ * @throws Error if execution context is not active
9734
+ *
9735
+ * @example
9736
+ * ```typescript
9737
+ * const symbol = await getSymbol();
9738
+ * console.log(symbol); // "BTCUSDT"
9739
+ * ```
9740
+ */
9741
+ declare function getSymbol(): Promise<string>;
9742
+ /**
9743
+ * Gets the current method context.
9744
+ *
9745
+ * Returns the context object from the method context service, which contains
9746
+ * information about the current method execution environment.
9747
+ *
9748
+ * @returns Promise resolving to the current method context object
9749
+ * @throws Error if method context is not active
9750
+ *
9751
+ * @example
9752
+ * ```typescript
9753
+ * const context = await getContext();
9754
+ * console.log(context); // { ...method context data... }
9755
+ * ```
9756
+ */
9757
+ declare function getContext(): Promise<IMethodContext>;
9758
+
9504
9759
  type Dispatch$1<Value extends object = object> = (value: Value) => Value | Promise<Value>;
9505
9760
  /**
9506
9761
  * Returns the latest signal (pending or closed) for the current strategy context.
@@ -20290,6 +20545,89 @@ declare class ScheduleUtils {
20290
20545
  */
20291
20546
  declare const Schedule: ScheduleUtils;
20292
20547
 
20548
+ /**
20549
+ * Single entry tracking one in-flight backtest or live run.
20550
+ *
20551
+ * Registered into the lookup map on activity start (e.g. `INSTANCE_TASK_FN` in
20552
+ * `Backtest`/`Live`, or per-strategy loop in `WalkerLogicPrivateService`) and
20553
+ * removed on completion or failure.
20554
+ *
20555
+ * Used by `Candle.spinLock` to detect parallel workloads via {@link LookupUtils.isParallel}.
20556
+ */
20557
+ interface IActivityEntry {
20558
+ /** Trading pair symbol (e.g. `"BTCUSDT"`). */
20559
+ symbol: string;
20560
+ /** Execution context identifying the running strategy. */
20561
+ context: {
20562
+ /** Strategy schema name driving the activity. */
20563
+ strategyName: StrategyName;
20564
+ /** Exchange schema name providing market data. */
20565
+ exchangeName: ExchangeName;
20566
+ /** Frame schema name (backtest only — live runs leave this `undefined`). */
20567
+ frameName?: FrameName;
20568
+ };
20569
+ /** `true` for backtest activities, `false` for live activities. */
20570
+ backtest: boolean;
20571
+ }
20572
+ /**
20573
+ * In-memory registry of currently running backtest and live activities.
20574
+ *
20575
+ * Purpose:
20576
+ * - Each `Backtest.run` / `Live.run` / per-strategy walker iteration registers an
20577
+ * {@link IActivityEntry} on start and removes it on completion.
20578
+ * - `Candle.spinLock` consults {@link isParallel} to decide whether the event-loop
20579
+ * hand-off (post-candle-fetch spin) is worth performing. With a single active
20580
+ * workload there is no peer to yield to, so the spin is skipped entirely.
20581
+ *
20582
+ * Exposed as the `Lookup` singleton; no constructor parameters.
20583
+ *
20584
+ * @example
20585
+ * ```typescript
20586
+ * Lookup.addActivity({ symbol: "BTCUSDT", context, backtest: true });
20587
+ * try {
20588
+ * for await (const _ of run(symbol, context)) { ... }
20589
+ * } finally {
20590
+ * Lookup.removeActivity({ symbol: "BTCUSDT", context, backtest: true });
20591
+ * }
20592
+ * ```
20593
+ */
20594
+ declare class LookupUtils {
20595
+ /** Active entries keyed by their composite {@link Key}. */
20596
+ private readonly _lookupMap;
20597
+ /**
20598
+ * `true` when more than one activity is currently registered.
20599
+ * Used by `Candle.spinLock` to decide whether yielding the event loop is useful.
20600
+ */
20601
+ get isParallel(): boolean;
20602
+ /**
20603
+ * Registers a backtest or live activity in the lookup map.
20604
+ * Idempotent for identical keys — duplicate calls overwrite the existing entry.
20605
+ *
20606
+ * @param activity - Activity descriptor identifying the running workload.
20607
+ */
20608
+ addActivity: (activity: IActivityEntry) => void;
20609
+ /**
20610
+ * Removes a previously registered activity from the lookup map.
20611
+ * Must be paired with a prior {@link addActivity}, typically in a `finally` block,
20612
+ * so a thrown error in the underlying run does not leave a stale entry behind.
20613
+ *
20614
+ * @param activity - Activity descriptor matching the one passed to {@link addActivity}.
20615
+ */
20616
+ removeActivity: (activity: IActivityEntry) => void;
20617
+ /**
20618
+ * Returns a snapshot of currently active entries.
20619
+ *
20620
+ * @returns Array of all activities present in the lookup map at call time.
20621
+ */
20622
+ listActivity: () => IActivityEntry[];
20623
+ }
20624
+ /**
20625
+ * Process-wide singleton instance of {@link LookupUtils}.
20626
+ * Imported by `Backtest`, `Live`, `WalkerLogicPrivateService` (registration sites)
20627
+ * and by `Candle` (read-only consumer via `isParallel`).
20628
+ */
20629
+ declare const Lookup: LookupUtils;
20630
+
20293
20631
  /**
20294
20632
  * Type alias for column configuration used in performance metrics markdown reports.
20295
20633
  *
@@ -28310,9 +28648,21 @@ declare const maxDrawdownSubject: Subject<MaxDrawdownContract>;
28310
28648
  * Emits when a strategy calls commitSignalInfo() to broadcast a custom annotation.
28311
28649
  */
28312
28650
  declare const signalNotifySubject: Subject<SignalInfoContract>;
28651
+ /**
28652
+ * Before start emitter for strategy initialization events.
28653
+ * Emits when the engine is about to start a new strategy execution.
28654
+ */
28655
+ declare const beforeStartSubject: Subject<BeforeStartContract>;
28656
+ /**
28657
+ * After end emitter for strategy completion events.
28658
+ * Emits when the engine has completed processing a signal.
28659
+ */
28660
+ declare const afterEndSubject: Subject<AfterEndContract>;
28313
28661
 
28314
28662
  declare const emitters_activePingSubject: typeof activePingSubject;
28663
+ declare const emitters_afterEndSubject: typeof afterEndSubject;
28315
28664
  declare const emitters_backtestScheduleOpenSubject: typeof backtestScheduleOpenSubject;
28665
+ declare const emitters_beforeStartSubject: typeof beforeStartSubject;
28316
28666
  declare const emitters_breakevenSubject: typeof breakevenSubject;
28317
28667
  declare const emitters_doneBacktestSubject: typeof doneBacktestSubject;
28318
28668
  declare const emitters_doneLiveSubject: typeof doneLiveSubject;
@@ -28341,7 +28691,7 @@ declare const emitters_walkerCompleteSubject: typeof walkerCompleteSubject;
28341
28691
  declare const emitters_walkerEmitter: typeof walkerEmitter;
28342
28692
  declare const emitters_walkerStopSubject: typeof walkerStopSubject;
28343
28693
  declare namespace emitters {
28344
- export { emitters_activePingSubject as activePingSubject, emitters_backtestScheduleOpenSubject as backtestScheduleOpenSubject, emitters_breakevenSubject as breakevenSubject, emitters_doneBacktestSubject as doneBacktestSubject, emitters_doneLiveSubject as doneLiveSubject, emitters_doneWalkerSubject as doneWalkerSubject, emitters_errorEmitter as errorEmitter, emitters_exitEmitter as exitEmitter, emitters_highestProfitSubject as highestProfitSubject, emitters_idlePingSubject as idlePingSubject, emitters_maxDrawdownSubject as maxDrawdownSubject, emitters_partialLossSubject as partialLossSubject, emitters_partialProfitSubject as partialProfitSubject, emitters_performanceEmitter as performanceEmitter, emitters_progressBacktestEmitter as progressBacktestEmitter, emitters_progressWalkerEmitter as progressWalkerEmitter, emitters_riskSubject as riskSubject, emitters_schedulePingSubject as schedulePingSubject, emitters_shutdownEmitter as shutdownEmitter, emitters_signalBacktestEmitter as signalBacktestEmitter, emitters_signalEmitter as signalEmitter, emitters_signalLiveEmitter as signalLiveEmitter, emitters_signalNotifySubject as signalNotifySubject, emitters_strategyCommitSubject as strategyCommitSubject, emitters_syncSubject as syncSubject, emitters_validationSubject as validationSubject, emitters_walkerCompleteSubject as walkerCompleteSubject, emitters_walkerEmitter as walkerEmitter, emitters_walkerStopSubject as walkerStopSubject };
28694
+ export { emitters_activePingSubject as activePingSubject, emitters_afterEndSubject as afterEndSubject, emitters_backtestScheduleOpenSubject as backtestScheduleOpenSubject, emitters_beforeStartSubject as beforeStartSubject, emitters_breakevenSubject as breakevenSubject, emitters_doneBacktestSubject as doneBacktestSubject, emitters_doneLiveSubject as doneLiveSubject, emitters_doneWalkerSubject as doneWalkerSubject, emitters_errorEmitter as errorEmitter, emitters_exitEmitter as exitEmitter, emitters_highestProfitSubject as highestProfitSubject, emitters_idlePingSubject as idlePingSubject, emitters_maxDrawdownSubject as maxDrawdownSubject, emitters_partialLossSubject as partialLossSubject, emitters_partialProfitSubject as partialProfitSubject, emitters_performanceEmitter as performanceEmitter, emitters_progressBacktestEmitter as progressBacktestEmitter, emitters_progressWalkerEmitter as progressWalkerEmitter, emitters_riskSubject as riskSubject, emitters_schedulePingSubject as schedulePingSubject, emitters_shutdownEmitter as shutdownEmitter, emitters_signalBacktestEmitter as signalBacktestEmitter, emitters_signalEmitter as signalEmitter, emitters_signalLiveEmitter as signalLiveEmitter, emitters_signalNotifySubject as signalNotifySubject, emitters_strategyCommitSubject as strategyCommitSubject, emitters_syncSubject as syncSubject, emitters_validationSubject as validationSubject, emitters_walkerCompleteSubject as walkerCompleteSubject, emitters_walkerEmitter as walkerEmitter, emitters_walkerStopSubject as walkerStopSubject };
28345
28695
  }
28346
28696
 
28347
28697
  /**
@@ -33309,6 +33659,69 @@ declare class BacktestLogicPrivateService {
33309
33659
  run(symbol: string): AsyncGenerator<IStrategyTickResultScheduled | IStrategyTickResultOpened | IStrategyTickResultClosed | IStrategyTickResultCancelled, void, any>;
33310
33660
  }
33311
33661
 
33662
+ /**
33663
+ * Service for managing frame schema registry.
33664
+ *
33665
+ * Uses ToolRegistry from functools-kit for type-safe schema storage.
33666
+ * Frames are registered via addFrame() and retrieved by name.
33667
+ */
33668
+ declare class FrameSchemaService {
33669
+ readonly loggerService: {
33670
+ readonly methodContextService: {
33671
+ readonly context: IMethodContext;
33672
+ };
33673
+ readonly executionContextService: {
33674
+ readonly context: IExecutionContext;
33675
+ };
33676
+ _commonLogger: ILogger;
33677
+ readonly _methodContext: {};
33678
+ readonly _executionContext: {};
33679
+ log: (topic: string, ...args: any[]) => Promise<void>;
33680
+ debug: (topic: string, ...args: any[]) => Promise<void>;
33681
+ info: (topic: string, ...args: any[]) => Promise<void>;
33682
+ warn: (topic: string, ...args: any[]) => Promise<void>;
33683
+ setLogger: (logger: ILogger) => void;
33684
+ };
33685
+ private _registry;
33686
+ /**
33687
+ * Registers a new frame schema.
33688
+ *
33689
+ * @param key - Unique frame name
33690
+ * @param value - Frame schema configuration
33691
+ * @throws Error if frame name already exists
33692
+ */
33693
+ register(key: FrameName, value: IFrameSchema): void;
33694
+ /**
33695
+ * Validates frame schema structure for required properties.
33696
+ *
33697
+ * Performs shallow validation to ensure all required properties exist
33698
+ * and have correct types before registration in the registry.
33699
+ *
33700
+ * @param frameSchema - Frame schema to validate
33701
+ * @throws Error if frameName is missing or not a string
33702
+ * @throws Error if interval is missing or not a valid FrameInterval
33703
+ * @throws Error if startDate is missing or not a Date
33704
+ * @throws Error if endDate is missing or not a Date
33705
+ */
33706
+ private validateShallow;
33707
+ /**
33708
+ * Overrides an existing frame schema with partial updates.
33709
+ *
33710
+ * @param key - Frame name to override
33711
+ * @param value - Partial schema updates
33712
+ * @throws Error if frame name doesn't exist
33713
+ */
33714
+ override(key: FrameName, value: Partial<IFrameSchema>): IFrameSchema;
33715
+ /**
33716
+ * Retrieves a frame schema by name.
33717
+ *
33718
+ * @param key - Frame name
33719
+ * @returns Frame schema configuration
33720
+ * @throws Error if frame name doesn't exist
33721
+ */
33722
+ get(key: FrameName): IFrameSchema;
33723
+ }
33724
+
33312
33725
  /**
33313
33726
  * Type definition for public BacktestLogic service.
33314
33727
  * Omits private dependencies from BacktestLogicPrivateService.
@@ -33353,8 +33766,26 @@ type TBacktestLogicPrivateService = {
33353
33766
  * ```
33354
33767
  */
33355
33768
  declare class BacktestLogicPublicService implements TBacktestLogicPrivateService {
33356
- private readonly loggerService;
33357
- private readonly backtestLogicPrivateService;
33769
+ readonly loggerService: {
33770
+ readonly methodContextService: {
33771
+ readonly context: IMethodContext;
33772
+ };
33773
+ readonly executionContextService: {
33774
+ readonly context: IExecutionContext;
33775
+ };
33776
+ _commonLogger: ILogger;
33777
+ readonly _methodContext: {};
33778
+ readonly _executionContext: {};
33779
+ log: (topic: string, ...args: any[]) => Promise<void>;
33780
+ debug: (topic: string, ...args: any[]) => Promise<void>;
33781
+ info: (topic: string, ...args: any[]) => Promise<void>;
33782
+ warn: (topic: string, ...args: any[]) => Promise<void>;
33783
+ setLogger: (logger: ILogger) => void;
33784
+ };
33785
+ readonly backtestLogicPrivateService: BacktestLogicPrivateService;
33786
+ readonly timeMetaService: TimeMetaService;
33787
+ readonly frameSchemaService: FrameSchemaService;
33788
+ readonly exchangeConnectionService: ExchangeConnectionService;
33358
33789
  /**
33359
33790
  * Runs backtest for a symbol with context propagation.
33360
33791
  *
@@ -33365,11 +33796,11 @@ declare class BacktestLogicPublicService implements TBacktestLogicPrivateService
33365
33796
  * @param context - Execution context with strategy, exchange, and frame names
33366
33797
  * @returns Async generator yielding closed signals with PNL
33367
33798
  */
33368
- run: (symbol: string, context: {
33799
+ run(symbol: string, context: {
33369
33800
  strategyName: StrategyName;
33370
33801
  exchangeName: ExchangeName;
33371
33802
  frameName: FrameName;
33372
- }) => AsyncGenerator<IStrategyTickResultScheduled | IStrategyTickResultOpened | IStrategyTickResultClosed | IStrategyTickResultCancelled, void, any>;
33803
+ }): AsyncGenerator<IStrategyTickResultScheduled | IStrategyTickResultOpened | IStrategyTickResultClosed | IStrategyTickResultCancelled, void, any>;
33373
33804
  }
33374
33805
 
33375
33806
  /**
@@ -33660,69 +34091,6 @@ declare class ExchangeSchemaService {
33660
34091
  get: (key: ExchangeName) => IExchangeSchema;
33661
34092
  }
33662
34093
 
33663
- /**
33664
- * Service for managing frame schema registry.
33665
- *
33666
- * Uses ToolRegistry from functools-kit for type-safe schema storage.
33667
- * Frames are registered via addFrame() and retrieved by name.
33668
- */
33669
- declare class FrameSchemaService {
33670
- readonly loggerService: {
33671
- readonly methodContextService: {
33672
- readonly context: IMethodContext;
33673
- };
33674
- readonly executionContextService: {
33675
- readonly context: IExecutionContext;
33676
- };
33677
- _commonLogger: ILogger;
33678
- readonly _methodContext: {};
33679
- readonly _executionContext: {};
33680
- log: (topic: string, ...args: any[]) => Promise<void>;
33681
- debug: (topic: string, ...args: any[]) => Promise<void>;
33682
- info: (topic: string, ...args: any[]) => Promise<void>;
33683
- warn: (topic: string, ...args: any[]) => Promise<void>;
33684
- setLogger: (logger: ILogger) => void;
33685
- };
33686
- private _registry;
33687
- /**
33688
- * Registers a new frame schema.
33689
- *
33690
- * @param key - Unique frame name
33691
- * @param value - Frame schema configuration
33692
- * @throws Error if frame name already exists
33693
- */
33694
- register(key: FrameName, value: IFrameSchema): void;
33695
- /**
33696
- * Validates frame schema structure for required properties.
33697
- *
33698
- * Performs shallow validation to ensure all required properties exist
33699
- * and have correct types before registration in the registry.
33700
- *
33701
- * @param frameSchema - Frame schema to validate
33702
- * @throws Error if frameName is missing or not a string
33703
- * @throws Error if interval is missing or not a valid FrameInterval
33704
- * @throws Error if startDate is missing or not a Date
33705
- * @throws Error if endDate is missing or not a Date
33706
- */
33707
- private validateShallow;
33708
- /**
33709
- * Overrides an existing frame schema with partial updates.
33710
- *
33711
- * @param key - Frame name to override
33712
- * @param value - Partial schema updates
33713
- * @throws Error if frame name doesn't exist
33714
- */
33715
- override(key: FrameName, value: Partial<IFrameSchema>): IFrameSchema;
33716
- /**
33717
- * Retrieves a frame schema by name.
33718
- *
33719
- * @param key - Frame name
33720
- * @returns Frame schema configuration
33721
- * @throws Error if frame name doesn't exist
33722
- */
33723
- get(key: FrameName): IFrameSchema;
33724
- }
33725
-
33726
34094
  /**
33727
34095
  * Service for managing sizing schema registry.
33728
34096
  *
@@ -33980,8 +34348,24 @@ type TLiveLogicPrivateService = {
33980
34348
  * ```
33981
34349
  */
33982
34350
  declare class LiveLogicPublicService implements TLiveLogicPrivateService {
33983
- private readonly loggerService;
33984
- private readonly liveLogicPrivateService;
34351
+ readonly loggerService: {
34352
+ readonly methodContextService: {
34353
+ readonly context: IMethodContext;
34354
+ };
34355
+ readonly executionContextService: {
34356
+ readonly context: IExecutionContext;
34357
+ };
34358
+ _commonLogger: ILogger;
34359
+ readonly _methodContext: {};
34360
+ readonly _executionContext: {};
34361
+ log: (topic: string, ...args: any[]) => Promise<void>;
34362
+ debug: (topic: string, ...args: any[]) => Promise<void>;
34363
+ info: (topic: string, ...args: any[]) => Promise<void>;
34364
+ warn: (topic: string, ...args: any[]) => Promise<void>;
34365
+ setLogger: (logger: ILogger) => void;
34366
+ };
34367
+ readonly liveLogicPrivateService: LiveLogicPrivateService;
34368
+ readonly exchangeConnectionService: ExchangeConnectionService;
33985
34369
  /**
33986
34370
  * Runs live trading for a symbol with context propagation.
33987
34371
  *
@@ -33993,18 +34377,23 @@ declare class LiveLogicPublicService implements TLiveLogicPrivateService {
33993
34377
  * @param context - Execution context with strategy and exchange names
33994
34378
  * @returns Infinite async generator yielding opened and closed signals
33995
34379
  */
33996
- run: (symbol: string, context: {
34380
+ run(symbol: string, context: {
33997
34381
  strategyName: StrategyName;
33998
34382
  exchangeName: ExchangeName;
33999
- }) => AsyncGenerator<IStrategyTickResultOpened | IStrategyTickResultClosed | IStrategyTickResultCancelled, void, unknown>;
34383
+ }): AsyncGenerator<IStrategyTickResultOpened | IStrategyTickResultClosed | IStrategyTickResultCancelled, void, unknown>;
34000
34384
  }
34001
34385
 
34386
+ type Keys$1 = Omit<LiveLogicPublicService, keyof {
34387
+ loggerService: never;
34388
+ liveLogicPrivateService: never;
34389
+ exchangeConnectionService: never;
34390
+ }>;
34002
34391
  /**
34003
34392
  * Type definition for LiveLogicPublicService.
34004
34393
  * Maps all keys of LiveLogicPublicService to any type.
34005
34394
  */
34006
34395
  type TLiveLogicPublicService = {
34007
- [key in keyof LiveLogicPublicService]: any;
34396
+ [key in keyof Keys$1]: any;
34008
34397
  };
34009
34398
  /**
34010
34399
  * Global service providing access to live trading functionality.
@@ -34035,12 +34424,23 @@ declare class LiveCommandService implements TLiveLogicPublicService {
34035
34424
  }) => AsyncGenerator<IStrategyTickResultOpened | IStrategyTickResultClosed | IStrategyTickResultCancelled, void, unknown>;
34036
34425
  }
34037
34426
 
34427
+ /**
34428
+ * Type definition for keys of BacktestLogicPublicService.
34429
+ * Omits private dependencies. Used for creating a public API surface.
34430
+ */
34431
+ type Keys = Omit<BacktestLogicPublicService, keyof {
34432
+ exchangeConnectionService: never;
34433
+ backtestLogicPrivateService: never;
34434
+ frameSchemaService: never;
34435
+ timeMetaService: never;
34436
+ loggerService: never;
34437
+ }>;
34038
34438
  /**
34039
34439
  * Type definition for BacktestLogicPublicService.
34040
34440
  * Maps all keys of BacktestLogicPublicService to any type.
34041
34441
  */
34042
34442
  type TBacktestLogicPublicService = {
34043
- [key in keyof BacktestLogicPublicService]: any;
34443
+ [key in keyof Keys]: any;
34044
34444
  };
34045
34445
  /**
34046
34446
  * Global service providing access to backtest functionality.
@@ -35959,4 +36359,4 @@ declare const getTotalClosed: (signal: Signal) => {
35959
36359
  remainingCostBasis: number;
35960
36360
  };
35961
36361
 
35962
- export { ActionBase, type ActivateScheduledCommit, type ActivateScheduledCommitNotification, type ActivePingContract, type AverageBuyCommit, type AverageBuyCommitNotification, Backtest, type BacktestStatisticsModel, Breakeven, type BreakevenAvailableNotification, type BreakevenCommit, type BreakevenCommitNotification, type BreakevenContract, type BreakevenData, type BreakevenEvent, type BreakevenStatisticsModel, Broker, type BrokerAverageBuyPayload, BrokerBase, type BrokerBreakevenPayload, type BrokerPartialLossPayload, type BrokerPartialProfitPayload, type BrokerSignalClosePayload, type BrokerSignalOpenPayload, type BrokerTrailingStopPayload, type BrokerTrailingTakePayload, Cache, type CancelScheduledCommit, type CancelScheduledCommitNotification, type CandleData, type CandleInterval, type ClosePendingCommit, type ClosePendingCommitNotification, type ColumnConfig, type ColumnModel, type CommitPayload, Constant, type CriticalErrorNotification, type DoneContract, Dump, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, HighestProfit, type HighestProfitContract, type HighestProfitEvent, type HighestProfitStatisticsModel, type IActionSchema, type IActivateScheduledCommitRow, type IAggregatedTradeData, type IBidData, type IBreakevenCommitRow, type IBroker, type ICandleData, type ICommitRow, type IDumpContext, type IDumpInstance, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type ILog, type ILogEntry, type ILogger, type IMarkdownDumpOptions, type IMemoryInstance, type INotificationUtils, type IOrderBookData, type IPartialLossCommitRow, type IPartialProfitCommitRow, type IPersistBase, type IPersistBreakevenInstance, type IPersistCandleInstance, type IPersistIntervalInstance, type IPersistLogInstance, type IPersistMeasureInstance, type IPersistMemoryInstance, type IPersistNotificationInstance, type IPersistPartialInstance, type IPersistRecentInstance, type IPersistRiskInstance, type IPersistScheduleInstance, type IPersistSessionInstance, type IPersistSignalInstance, type IPersistStateInstance, type IPersistStorageInstance, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicAction, type IPublicCandleData, type IPublicSignalRow, type IRecentUtils, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskSignalRow, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, type IScheduledSignalRow, type ISessionInstance, type ISignalDto, type ISignalIntervalDto, type ISignalRow, type ISizingCalculateParams, type ISizingCalculateParamsATR, type ISizingCalculateParamsFixedPercentage, type ISizingCalculateParamsKelly, type ISizingParams, type ISizingParamsATR, type ISizingParamsFixedPercentage, type ISizingParamsKelly, type ISizingSchema, type ISizingSchemaATR, type ISizingSchemaFixedPercentage, type ISizingSchemaKelly, type IStateInstance, type IStorageSignalRow, type IStorageUtils, type IStrategyPnL, type IStrategyResult, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IStrategyTickResultWaiting, type ITrailingStopCommitRow, type ITrailingTakeCommitRow, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, type IdlePingContract, type InfoErrorNotification, Interval, type IntervalData, Live, type LiveStatisticsModel, Log, type LogData, Markdown, MarkdownFileBase, MarkdownFolderBase, type MarkdownName, MarkdownWriter, MaxDrawdown, type MaxDrawdownContract, type MaxDrawdownEvent, type MaxDrawdownStatisticsModel, type MeasureData, Memory, MemoryBacktest, MemoryBacktestAdapter, type MemoryData, MemoryLive, MemoryLiveAdapter, type MessageModel, type MessageRole, type MessageToolCall, MethodContextService, type MetricStats, Notification, NotificationBacktest, type NotificationData, NotificationLive, type NotificationModel, Partial$1 as Partial, type PartialData, type PartialEvent, type PartialLossAvailableNotification, type PartialLossCommit, type PartialLossCommitNotification, type PartialLossContract, type PartialProfitAvailableNotification, type PartialProfitCommit, type PartialProfitCommitNotification, type PartialProfitContract, type PartialStatisticsModel, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatisticsModel, PersistBase, PersistBreakevenAdapter, PersistBreakevenInstance, PersistCandleAdapter, PersistCandleInstance, PersistIntervalAdapter, PersistIntervalInstance, PersistLogAdapter, PersistLogInstance, PersistMeasureAdapter, PersistMeasureInstance, PersistMemoryAdapter, PersistMemoryInstance, PersistNotificationAdapter, PersistNotificationInstance, PersistPartialAdapter, PersistPartialInstance, PersistRecentAdapter, PersistRecentInstance, PersistRiskAdapter, PersistRiskInstance, PersistScheduleAdapter, PersistScheduleInstance, PersistSessionAdapter, PersistSessionInstance, PersistSignalAdapter, PersistSignalInstance, PersistStateAdapter, PersistStateInstance, PersistStorageAdapter, PersistStorageInstance, Position, PositionSize, type ProgressBacktestContract, type ProgressWalkerContract, Recent, RecentBacktest, type RecentData, RecentLive, Reflect, Report, ReportBase, type ReportName, ReportWriter, Risk, type RiskContract, type RiskData, type RiskEvent, type RiskRejectionNotification, type RiskStatisticsModel, Schedule, type ScheduleData, type SchedulePingContract, type ScheduleStatisticsModel, type ScheduledEvent, Session, SessionBacktest, type SessionData, SessionLive, type SignalCancelledNotification, type SignalCloseContract, type SignalClosedNotification, type SignalData, type SignalInfoContract, type SignalInfoNotification, type SignalInterval, type SignalOpenContract, type SignalOpenedNotification, type SignalScheduledNotification, type SignalSyncCloseNotification, type SignalSyncContract, type SignalSyncOpenNotification, State, StateBacktest, StateBacktestAdapter, type StateData, StateLive, StateLiveAdapter, Storage, StorageBacktest, type StorageData, StorageLive, Strategy, type StrategyActionType, type StrategyCancelReason, type StrategyCloseReason, type StrategyCommitContract, type StrategyEvent, type StrategyStatisticsModel, Sync, type SyncEvent, type SyncStatisticsModel, System, type TBrokerCtor, type TDumpInstanceCtor, type TLogCtor, type TMarkdownBase, type TMemoryInstanceCtor, type TNotificationUtilsCtor, type TPersistBase, type TPersistBaseCtor, type TPersistBreakevenInstanceCtor, type TPersistCandleInstanceCtor, type TPersistIntervalInstanceCtor, type TPersistLogInstanceCtor, type TPersistMeasureInstanceCtor, type TPersistMemoryInstanceCtor, type TPersistNotificationInstanceCtor, type TPersistPartialInstanceCtor, type TPersistRecentInstanceCtor, type TPersistRiskInstanceCtor, type TPersistScheduleInstanceCtor, type TPersistSessionInstanceCtor, type TPersistSignalInstanceCtor, type TPersistStateInstanceCtor, type TPersistStorageInstanceCtor, type TRecentUtilsCtor, type TReportBase, type TSessionInstanceCtor, type TStateInstanceCtor, type TStorageUtilsCtor, type TickEvent, type TrailingStopCommit, type TrailingStopCommitNotification, type TrailingTakeCommit, type TrailingTakeCommitNotification, type ValidationErrorNotification, Walker, type WalkerCompleteContract, type WalkerContract, type WalkerMetric, type SignalData$1 as WalkerSignalData, type WalkerStatisticsModel, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitSignalNotify, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, createSignalState, dumpAgentAnswer, dumpError, dumpJson, dumpRecord, dumpTable, dumpText, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getClosePrice, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getLatestSignal, getMaxDrawdownDistancePnlCost, getMaxDrawdownDistancePnlPercentage, getMinutesSinceLatestSignalCreated, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionActiveMinutes, getPositionCountdownMinutes, getPositionDrawdownMinutes, getPositionEffectivePrice, getPositionEntries, getPositionEntryOverlap, getPositionEstimateMinutes, getPositionHighestMaxDrawdownPnlCost, getPositionHighestMaxDrawdownPnlPercentage, getPositionHighestPnlCost, getPositionHighestPnlPercentage, getPositionHighestProfitBreakeven, getPositionHighestProfitDistancePnlCost, getPositionHighestProfitDistancePnlPercentage, getPositionHighestProfitMinutes, getPositionHighestProfitPrice, getPositionHighestProfitTimestamp, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionMaxDrawdownMinutes, getPositionMaxDrawdownPnlCost, getPositionMaxDrawdownPnlPercentage, getPositionMaxDrawdownPrice, getPositionMaxDrawdownTimestamp, getPositionPartialOverlap, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getPositionWaitingMinutes, getRawCandles, getRiskSchema, getScheduledSignal, getSessionData, getSignalState, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasNoPendingSignal, hasNoScheduledSignal, hasTradeContext, intervalStepMs, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listMemory, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenHighestProfit, listenHighestProfitOnce, listenIdlePing, listenIdlePingOnce, listenMaxDrawdown, listenMaxDrawdownOnce, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalNotify, listenSignalNotifyOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, readMemory, removeMemory, roundTicks, runInMockContext, searchMemory, set, setColumns, setConfig, setLogger, setSessionData, setSignalState, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, validateCommonSignal, validatePendingSignal, validateScheduledSignal, validateSignal, waitForCandle, waitForReady, warmCandles, writeMemory };
36362
+ export { ActionBase, type ActivateScheduledCommit, type ActivateScheduledCommitNotification, type ActivePingContract, type AfterEndContract, type AverageBuyCommit, type AverageBuyCommitNotification, Backtest, type BacktestStatisticsModel, type BeforeStartContract, Breakeven, type BreakevenAvailableNotification, type BreakevenCommit, type BreakevenCommitNotification, type BreakevenContract, type BreakevenData, type BreakevenEvent, type BreakevenStatisticsModel, Broker, type BrokerAverageBuyPayload, BrokerBase, type BrokerBreakevenPayload, type BrokerPartialLossPayload, type BrokerPartialProfitPayload, type BrokerSignalClosePayload, type BrokerSignalOpenPayload, type BrokerTrailingStopPayload, type BrokerTrailingTakePayload, Cache, type CancelScheduledCommit, type CancelScheduledCommitNotification, type CandleData, type CandleInterval, type ClosePendingCommit, type ClosePendingCommitNotification, type ColumnConfig, type ColumnModel, type CommitPayload, Constant, type CriticalErrorNotification, type DoneContract, Dump, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, HighestProfit, type HighestProfitContract, type HighestProfitEvent, type HighestProfitStatisticsModel, type IActionSchema, type IActivateScheduledCommitRow, type IAggregatedTradeData, type IBidData, type IBreakevenCommitRow, type IBroker, type ICandleData, type ICommitRow, type IDumpContext, type IDumpInstance, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type ILog, type ILogEntry, type ILogger, type IMarkdownDumpOptions, type IMemoryInstance, type INotificationUtils, type IOrderBookData, type IPartialLossCommitRow, type IPartialProfitCommitRow, type IPersistBase, type IPersistBreakevenInstance, type IPersistCandleInstance, type IPersistIntervalInstance, type IPersistLogInstance, type IPersistMeasureInstance, type IPersistMemoryInstance, type IPersistNotificationInstance, type IPersistPartialInstance, type IPersistRecentInstance, type IPersistRiskInstance, type IPersistScheduleInstance, type IPersistSessionInstance, type IPersistSignalInstance, type IPersistStateInstance, type IPersistStorageInstance, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicAction, type IPublicCandleData, type IPublicSignalRow, type IRecentUtils, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskSignalRow, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, type IScheduledSignalRow, type ISessionInstance, type ISignalDto, type ISignalIntervalDto, type ISignalRow, type ISizingCalculateParams, type ISizingCalculateParamsATR, type ISizingCalculateParamsFixedPercentage, type ISizingCalculateParamsKelly, type ISizingParams, type ISizingParamsATR, type ISizingParamsFixedPercentage, type ISizingParamsKelly, type ISizingSchema, type ISizingSchemaATR, type ISizingSchemaFixedPercentage, type ISizingSchemaKelly, type IStateInstance, type IStorageSignalRow, type IStorageUtils, type IStrategyPnL, type IStrategyResult, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IStrategyTickResultWaiting, type ITrailingStopCommitRow, type ITrailingTakeCommitRow, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, type IdlePingContract, type InfoErrorNotification, Interval, type IntervalData, Live, type LiveStatisticsModel, Log, type LogData, Lookup, Markdown, MarkdownFileBase, MarkdownFolderBase, type MarkdownName, MarkdownWriter, MaxDrawdown, type MaxDrawdownContract, type MaxDrawdownEvent, type MaxDrawdownStatisticsModel, type MeasureData, Memory, MemoryBacktest, MemoryBacktestAdapter, type MemoryData, MemoryLive, MemoryLiveAdapter, type MessageModel, type MessageRole, type MessageToolCall, MethodContextService, type MetricStats, Notification, NotificationBacktest, type NotificationData, NotificationLive, type NotificationModel, Partial$1 as Partial, type PartialData, type PartialEvent, type PartialLossAvailableNotification, type PartialLossCommit, type PartialLossCommitNotification, type PartialLossContract, type PartialProfitAvailableNotification, type PartialProfitCommit, type PartialProfitCommitNotification, type PartialProfitContract, type PartialStatisticsModel, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatisticsModel, PersistBase, PersistBreakevenAdapter, PersistBreakevenInstance, PersistCandleAdapter, PersistCandleInstance, PersistIntervalAdapter, PersistIntervalInstance, PersistLogAdapter, PersistLogInstance, PersistMeasureAdapter, PersistMeasureInstance, PersistMemoryAdapter, PersistMemoryInstance, PersistNotificationAdapter, PersistNotificationInstance, PersistPartialAdapter, PersistPartialInstance, PersistRecentAdapter, PersistRecentInstance, PersistRiskAdapter, PersistRiskInstance, PersistScheduleAdapter, PersistScheduleInstance, PersistSessionAdapter, PersistSessionInstance, PersistSignalAdapter, PersistSignalInstance, PersistStateAdapter, PersistStateInstance, PersistStorageAdapter, PersistStorageInstance, Position, PositionSize, type ProgressBacktestContract, type ProgressWalkerContract, Recent, RecentBacktest, type RecentData, RecentLive, Reflect, Report, ReportBase, type ReportName, ReportWriter, Risk, type RiskContract, type RiskData, type RiskEvent, type RiskRejectionNotification, type RiskStatisticsModel, Schedule, type ScheduleData, type SchedulePingContract, type ScheduleStatisticsModel, type ScheduledEvent, Session, SessionBacktest, type SessionData, SessionLive, type SignalCancelledNotification, type SignalCloseContract, type SignalClosedNotification, type SignalData, type SignalInfoContract, type SignalInfoNotification, type SignalInterval, type SignalOpenContract, type SignalOpenedNotification, type SignalScheduledNotification, type SignalSyncCloseNotification, type SignalSyncContract, type SignalSyncOpenNotification, State, StateBacktest, StateBacktestAdapter, type StateData, StateLive, StateLiveAdapter, Storage, StorageBacktest, type StorageData, StorageLive, Strategy, type StrategyActionType, type StrategyCancelReason, type StrategyCloseReason, type StrategyCommitContract, type StrategyEvent, type StrategyStatisticsModel, Sync, type SyncEvent, type SyncStatisticsModel, System, type TBrokerCtor, type TDumpInstanceCtor, type TLogCtor, type TMarkdownBase, type TMemoryInstanceCtor, type TNotificationUtilsCtor, type TPersistBase, type TPersistBaseCtor, type TPersistBreakevenInstanceCtor, type TPersistCandleInstanceCtor, type TPersistIntervalInstanceCtor, type TPersistLogInstanceCtor, type TPersistMeasureInstanceCtor, type TPersistMemoryInstanceCtor, type TPersistNotificationInstanceCtor, type TPersistPartialInstanceCtor, type TPersistRecentInstanceCtor, type TPersistRiskInstanceCtor, type TPersistScheduleInstanceCtor, type TPersistSessionInstanceCtor, type TPersistSignalInstanceCtor, type TPersistStateInstanceCtor, type TPersistStorageInstanceCtor, type TRecentUtilsCtor, type TReportBase, type TSessionInstanceCtor, type TStateInstanceCtor, type TStorageUtilsCtor, type TickEvent, type TrailingStopCommit, type TrailingStopCommitNotification, type TrailingTakeCommit, type TrailingTakeCommitNotification, type ValidationErrorNotification, Walker, type WalkerCompleteContract, type WalkerContract, type WalkerMetric, type SignalData$1 as WalkerSignalData, type WalkerStatisticsModel, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, cacheCandles, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitSignalNotify, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, createSignalState, dumpAgentAnswer, dumpError, dumpJson, dumpRecord, dumpTable, dumpText, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getClosePrice, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getLatestSignal, getMaxDrawdownDistancePnlCost, getMaxDrawdownDistancePnlPercentage, getMinutesSinceLatestSignalCreated, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionActiveMinutes, getPositionCountdownMinutes, getPositionDrawdownMinutes, getPositionEffectivePrice, getPositionEntries, getPositionEntryOverlap, getPositionEstimateMinutes, getPositionHighestMaxDrawdownPnlCost, getPositionHighestMaxDrawdownPnlPercentage, getPositionHighestPnlCost, getPositionHighestPnlPercentage, getPositionHighestProfitBreakeven, getPositionHighestProfitDistancePnlCost, getPositionHighestProfitDistancePnlPercentage, getPositionHighestProfitMinutes, getPositionHighestProfitPrice, getPositionHighestProfitTimestamp, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionMaxDrawdownMinutes, getPositionMaxDrawdownPnlCost, getPositionMaxDrawdownPnlPercentage, getPositionMaxDrawdownPrice, getPositionMaxDrawdownTimestamp, getPositionPartialOverlap, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getPositionWaitingMinutes, getRawCandles, getRiskSchema, getScheduledSignal, getSessionData, getSignalState, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasNoPendingSignal, hasNoScheduledSignal, hasTradeContext, intervalStepMs, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listMemory, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenAfterEnd, listenAfterEndOnce, listenBacktestProgress, listenBeforeStart, listenBeforeStartOnce, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenHighestProfit, listenHighestProfitOnce, listenIdlePing, listenIdlePingOnce, listenMaxDrawdown, listenMaxDrawdownOnce, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalNotify, listenSignalNotifyOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, readMemory, removeMemory, roundTicks, runInMockContext, searchMemory, set, setColumns, setConfig, setLogger, setSessionData, setSignalState, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, validateCommonSignal, validatePendingSignal, validateScheduledSignal, validateSignal, waitForCandle, waitForReady, warmCandles, writeMemory };