backtest-kit 6.10.0 → 6.11.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/build/index.cjs +212 -103
- package/build/index.mjs +212 -103
- package/package.json +1 -1
- package/types.d.ts +117 -32
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -1900,6 +1900,8 @@ interface SignalCommitBase {
|
|
|
1900
1900
|
totalPartials: number;
|
|
1901
1901
|
/** Original entry price at signal creation (unchanged by DCA averaging). */
|
|
1902
1902
|
originalPriceOpen: number;
|
|
1903
|
+
/** Optional human-readable description of signal reason */
|
|
1904
|
+
note?: string;
|
|
1903
1905
|
}
|
|
1904
1906
|
/**
|
|
1905
1907
|
* Cancel scheduled signal event.
|
|
@@ -2577,14 +2579,18 @@ interface IStrategySchema {
|
|
|
2577
2579
|
strategyName: StrategyName;
|
|
2578
2580
|
/** Optional developer note for documentation */
|
|
2579
2581
|
note?: string;
|
|
2580
|
-
/**
|
|
2581
|
-
|
|
2582
|
+
/**
|
|
2583
|
+
* Minimum interval between getSignal calls (throttling)
|
|
2584
|
+
*
|
|
2585
|
+
* Default: 1m
|
|
2586
|
+
*/
|
|
2587
|
+
interval?: SignalInterval;
|
|
2582
2588
|
/**
|
|
2583
2589
|
* Signal generation function (returns null if no signal, validated DTO if signal).
|
|
2584
2590
|
* If priceOpen is provided - becomes scheduled signal waiting for price to reach entry point.
|
|
2585
2591
|
* If priceOpen is omitted - opens immediately at current price.
|
|
2586
2592
|
*/
|
|
2587
|
-
getSignal: (symbol: string, when: Date) => Promise<ISignalDto | null>;
|
|
2593
|
+
getSignal: (symbol: string, when: Date, currentPrice: number) => Promise<ISignalDto | null>;
|
|
2588
2594
|
/** Optional lifecycle event callbacks (onOpen, onClose) */
|
|
2589
2595
|
callbacks?: Partial<IStrategyCallbacks>;
|
|
2590
2596
|
/** Optional risk profile identifier for risk management */
|
|
@@ -9173,7 +9179,7 @@ interface IRunContext extends IMethodContext, IExecutionContext {
|
|
|
9173
9179
|
*
|
|
9174
9180
|
* @template T - Return type of the function.
|
|
9175
9181
|
*/
|
|
9176
|
-
type Function$
|
|
9182
|
+
type Function$2<T extends unknown = any> = () => T | Promise<T>;
|
|
9177
9183
|
/**
|
|
9178
9184
|
* Runs a function inside a mock method and execution context.
|
|
9179
9185
|
*
|
|
@@ -9201,7 +9207,7 @@ type Function$1<T extends unknown = any> = () => T | Promise<T>;
|
|
|
9201
9207
|
* );
|
|
9202
9208
|
* ```
|
|
9203
9209
|
*/
|
|
9204
|
-
declare function runInMockContext<T extends unknown = any>(run: Function$
|
|
9210
|
+
declare function runInMockContext<T extends unknown = any>(run: Function$2<T>, { exchangeName, frameName, strategyName, symbol, backtest: isBacktest, when, }: Partial<IRunContext>): Promise<T>;
|
|
9205
9211
|
|
|
9206
9212
|
/**
|
|
9207
9213
|
* Portfolio heatmap statistics for a single symbol.
|
|
@@ -9465,6 +9471,8 @@ interface PartialProfitAvailableNotification {
|
|
|
9465
9471
|
pnlCost: number;
|
|
9466
9472
|
/** Total invested capital in USD */
|
|
9467
9473
|
pnlEntries: number;
|
|
9474
|
+
/** Optional human-readable description of signal reason */
|
|
9475
|
+
note?: string;
|
|
9468
9476
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9469
9477
|
scheduledAt: number;
|
|
9470
9478
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9527,6 +9535,8 @@ interface PartialLossAvailableNotification {
|
|
|
9527
9535
|
pnlCost: number;
|
|
9528
9536
|
/** Total invested capital in USD */
|
|
9529
9537
|
pnlEntries: number;
|
|
9538
|
+
/** Optional human-readable description of signal reason */
|
|
9539
|
+
note?: string;
|
|
9530
9540
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9531
9541
|
scheduledAt: number;
|
|
9532
9542
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9587,6 +9597,8 @@ interface BreakevenAvailableNotification {
|
|
|
9587
9597
|
pnlCost: number;
|
|
9588
9598
|
/** Total invested capital in USD */
|
|
9589
9599
|
pnlEntries: number;
|
|
9600
|
+
/** Optional human-readable description of signal reason */
|
|
9601
|
+
note?: string;
|
|
9590
9602
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9591
9603
|
scheduledAt: number;
|
|
9592
9604
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9649,6 +9661,8 @@ interface PartialProfitCommitNotification {
|
|
|
9649
9661
|
pnlCost: number;
|
|
9650
9662
|
/** Total invested capital in USD */
|
|
9651
9663
|
pnlEntries: number;
|
|
9664
|
+
/** Optional human-readable description of signal reason */
|
|
9665
|
+
note?: string;
|
|
9652
9666
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9653
9667
|
scheduledAt: number;
|
|
9654
9668
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9711,6 +9725,8 @@ interface PartialLossCommitNotification {
|
|
|
9711
9725
|
pnlCost: number;
|
|
9712
9726
|
/** Total invested capital in USD */
|
|
9713
9727
|
pnlEntries: number;
|
|
9728
|
+
/** Optional human-readable description of signal reason */
|
|
9729
|
+
note?: string;
|
|
9714
9730
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9715
9731
|
scheduledAt: number;
|
|
9716
9732
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9771,6 +9787,8 @@ interface BreakevenCommitNotification {
|
|
|
9771
9787
|
pnlCost: number;
|
|
9772
9788
|
/** Total invested capital in USD */
|
|
9773
9789
|
pnlEntries: number;
|
|
9790
|
+
/** Optional human-readable description of signal reason */
|
|
9791
|
+
note?: string;
|
|
9774
9792
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9775
9793
|
scheduledAt: number;
|
|
9776
9794
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9835,6 +9853,8 @@ interface AverageBuyCommitNotification {
|
|
|
9835
9853
|
pnlCost: number;
|
|
9836
9854
|
/** Total invested capital in USD */
|
|
9837
9855
|
pnlEntries: number;
|
|
9856
|
+
/** Optional human-readable description of signal reason */
|
|
9857
|
+
note?: string;
|
|
9838
9858
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9839
9859
|
scheduledAt: number;
|
|
9840
9860
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9901,6 +9921,8 @@ interface ActivateScheduledCommitNotification {
|
|
|
9901
9921
|
pendingAt: number;
|
|
9902
9922
|
/** Current market price when activation was executed */
|
|
9903
9923
|
currentPrice: number;
|
|
9924
|
+
/** Optional human-readable description of signal reason */
|
|
9925
|
+
note?: string;
|
|
9904
9926
|
/** Unix timestamp in milliseconds when the notification was created */
|
|
9905
9927
|
createdAt: number;
|
|
9906
9928
|
}
|
|
@@ -9959,6 +9981,8 @@ interface TrailingStopCommitNotification {
|
|
|
9959
9981
|
pnlCost: number;
|
|
9960
9982
|
/** Total invested capital in USD */
|
|
9961
9983
|
pnlEntries: number;
|
|
9984
|
+
/** Optional human-readable description of signal reason */
|
|
9985
|
+
note?: string;
|
|
9962
9986
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9963
9987
|
scheduledAt: number;
|
|
9964
9988
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -10021,6 +10045,8 @@ interface TrailingTakeCommitNotification {
|
|
|
10021
10045
|
pnlCost: number;
|
|
10022
10046
|
/** Total invested capital in USD */
|
|
10023
10047
|
pnlEntries: number;
|
|
10048
|
+
/** Optional human-readable description of signal reason */
|
|
10049
|
+
note?: string;
|
|
10024
10050
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
10025
10051
|
scheduledAt: number;
|
|
10026
10052
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -10087,6 +10113,8 @@ interface SignalSyncOpenNotification {
|
|
|
10087
10113
|
scheduledAt: number;
|
|
10088
10114
|
/** Position activation timestamp in milliseconds */
|
|
10089
10115
|
pendingAt: number;
|
|
10116
|
+
/** Optional human-readable description of signal reason */
|
|
10117
|
+
note?: string;
|
|
10090
10118
|
/** Unix timestamp in milliseconds when the notification was created */
|
|
10091
10119
|
createdAt: number;
|
|
10092
10120
|
}
|
|
@@ -10149,6 +10177,8 @@ interface SignalSyncCloseNotification {
|
|
|
10149
10177
|
pendingAt: number;
|
|
10150
10178
|
/** Why the signal was closed (take_profit | stop_loss | time_expired | closed) */
|
|
10151
10179
|
closeReason: string;
|
|
10180
|
+
/** Optional human-readable description of signal reason */
|
|
10181
|
+
note?: string;
|
|
10152
10182
|
/** Unix timestamp in milliseconds when the notification was created */
|
|
10153
10183
|
createdAt: number;
|
|
10154
10184
|
}
|
|
@@ -10253,6 +10283,8 @@ interface SignalScheduledNotification {
|
|
|
10253
10283
|
scheduledAt: number;
|
|
10254
10284
|
/** Current market price when signal was scheduled */
|
|
10255
10285
|
currentPrice: number;
|
|
10286
|
+
/** Optional human-readable description of signal reason */
|
|
10287
|
+
note?: string;
|
|
10256
10288
|
/** Unix timestamp in milliseconds when the tick result was created (from candle timestamp in backtest or execution context when in live) */
|
|
10257
10289
|
createdAt: number;
|
|
10258
10290
|
}
|
|
@@ -10305,6 +10337,8 @@ interface SignalCancelledNotification {
|
|
|
10305
10337
|
scheduledAt: number;
|
|
10306
10338
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
10307
10339
|
pendingAt: number;
|
|
10340
|
+
/** Optional human-readable description of signal reason */
|
|
10341
|
+
note?: string;
|
|
10308
10342
|
/** Unix timestamp in milliseconds when the tick result was created (from candle timestamp in backtest or execution context when in live) */
|
|
10309
10343
|
createdAt: number;
|
|
10310
10344
|
}
|
|
@@ -10397,6 +10431,8 @@ interface CancelScheduledCommitNotification {
|
|
|
10397
10431
|
pnlCost: number;
|
|
10398
10432
|
/** Total invested capital in USD */
|
|
10399
10433
|
pnlEntries: number;
|
|
10434
|
+
/** Optional human-readable description of signal reason */
|
|
10435
|
+
note?: string;
|
|
10400
10436
|
/** Unix timestamp in milliseconds when the notification was created */
|
|
10401
10437
|
createdAt: number;
|
|
10402
10438
|
}
|
|
@@ -10441,6 +10477,8 @@ interface ClosePendingCommitNotification {
|
|
|
10441
10477
|
pnlCost: number;
|
|
10442
10478
|
/** Total invested capital in USD */
|
|
10443
10479
|
pnlEntries: number;
|
|
10480
|
+
/** Optional human-readable description of signal reason */
|
|
10481
|
+
note?: string;
|
|
10444
10482
|
/** Unix timestamp in milliseconds when the notification was created */
|
|
10445
10483
|
createdAt: number;
|
|
10446
10484
|
}
|
|
@@ -20217,7 +20255,7 @@ declare const Exchange: ExchangeUtils;
|
|
|
20217
20255
|
* Generic function type that accepts any arguments and returns any value.
|
|
20218
20256
|
* Used as a constraint for cached functions.
|
|
20219
20257
|
*/
|
|
20220
|
-
type Function = (...args: any[]) => any;
|
|
20258
|
+
type Function$1 = (...args: any[]) => any;
|
|
20221
20259
|
/**
|
|
20222
20260
|
* Async function type for file-cached functions.
|
|
20223
20261
|
* First argument is always `symbol: string`, followed by optional spread args.
|
|
@@ -20228,7 +20266,7 @@ type CacheFileFunction = (symbol: string, ...args: any[]) => Promise<any>;
|
|
|
20228
20266
|
* For example, for a function type `(symbol: string, arg1: number, arg2: string) => Promise<void>`,
|
|
20229
20267
|
* this type will infer the rest of the arguments as `[arg1: number, arg2: string]`.
|
|
20230
20268
|
*/
|
|
20231
|
-
type DropFirst<T extends (...args: any) => any> = T extends (first: any, ...rest: infer R) => any ? R : never;
|
|
20269
|
+
type DropFirst$1<T extends (...args: any) => any> = T extends (first: any, ...rest: infer R) => any ? R : never;
|
|
20232
20270
|
/**
|
|
20233
20271
|
* Extracts the `key` generator argument tuple from a `CacheFileFunction`.
|
|
20234
20272
|
* The first two arguments are always `symbol: string` and `alignMs: number` (aligned timestamp),
|
|
@@ -20240,7 +20278,7 @@ type DropFirst<T extends (...args: any) => any> = T extends (first: any, ...rest
|
|
|
20240
20278
|
type CacheFileKeyArgs<T extends CacheFileFunction> = [
|
|
20241
20279
|
symbol: string,
|
|
20242
20280
|
alignMs: number,
|
|
20243
|
-
...rest: DropFirst<T>
|
|
20281
|
+
...rest: DropFirst$1<T>
|
|
20244
20282
|
];
|
|
20245
20283
|
/**
|
|
20246
20284
|
* Utility class for function caching with timeframe-based invalidation.
|
|
@@ -20301,7 +20339,7 @@ declare class CacheUtils {
|
|
|
20301
20339
|
* const result3 = cachedCalculate("BTCUSDT", 14); // Cached (same key, same interval)
|
|
20302
20340
|
* ```
|
|
20303
20341
|
*/
|
|
20304
|
-
fn: <T extends Function, K = symbol>(run: T, context: {
|
|
20342
|
+
fn: <T extends Function$1, K = symbol>(run: T, context: {
|
|
20305
20343
|
interval: CandleInterval;
|
|
20306
20344
|
key?: (args: Parameters<T>) => K;
|
|
20307
20345
|
}) => T & {
|
|
@@ -20371,13 +20409,19 @@ declare class CacheUtils {
|
|
|
20371
20409
|
* Cache.dispose(calculateIndicator);
|
|
20372
20410
|
* ```
|
|
20373
20411
|
*/
|
|
20374
|
-
dispose: <T extends Function>(run: T) => void;
|
|
20412
|
+
dispose: <T extends Function$1>(run: T) => void;
|
|
20375
20413
|
/**
|
|
20376
20414
|
* Clears all memoized CacheFnInstance and CacheFileInstance objects.
|
|
20377
20415
|
* Call this when process.cwd() changes between strategy iterations
|
|
20378
20416
|
* so new instances are created with the updated base path.
|
|
20379
20417
|
*/
|
|
20380
20418
|
clear: () => void;
|
|
20419
|
+
/**
|
|
20420
|
+
* Resets the CacheFileInstance index counter to zero.
|
|
20421
|
+
* This is useful when process.cwd() changes between strategy iterations to ensure
|
|
20422
|
+
* that new CacheFileInstance objects start with index 0 and do not collide with old instances.
|
|
20423
|
+
*/
|
|
20424
|
+
resetCounter: () => void;
|
|
20381
20425
|
}
|
|
20382
20426
|
/**
|
|
20383
20427
|
* Singleton instance of CacheUtils for convenient function caching.
|
|
@@ -20396,15 +20440,34 @@ declare class CacheUtils {
|
|
|
20396
20440
|
declare const Cache: CacheUtils;
|
|
20397
20441
|
|
|
20398
20442
|
/**
|
|
20399
|
-
*
|
|
20400
|
-
*
|
|
20443
|
+
* Generic function type that accepts any arguments and returns any value.
|
|
20444
|
+
* Used as a constraint for interval functions.
|
|
20401
20445
|
*/
|
|
20402
|
-
type
|
|
20446
|
+
type Function = (...args: any[]) => any;
|
|
20403
20447
|
/**
|
|
20404
|
-
*
|
|
20405
|
-
*
|
|
20448
|
+
* Async function type for file-interval functions.
|
|
20449
|
+
* First argument is always `symbol: string`, followed by optional spread args.
|
|
20450
|
+
*/
|
|
20451
|
+
type IntervalFileFunction = (symbol: string, ...args: any[]) => Promise<any>;
|
|
20452
|
+
/**
|
|
20453
|
+
* Utility type to drop the first argument from a function type.
|
|
20454
|
+
* For example, for `(symbol: string, arg1: number, arg2: string) => Promise<void>`,
|
|
20455
|
+
* this will infer `[arg1: number, arg2: string]`.
|
|
20456
|
+
*/
|
|
20457
|
+
type DropFirst<T extends (...args: any) => any> = T extends (first: any, ...rest: infer R) => any ? R : never;
|
|
20458
|
+
/**
|
|
20459
|
+
* Extracts the `key` generator argument tuple from an `IntervalFileFunction`.
|
|
20460
|
+
* The first two arguments are always `symbol: string` and `alignMs: number` (aligned timestamp),
|
|
20461
|
+
* followed by the rest of the original function's arguments.
|
|
20462
|
+
*
|
|
20463
|
+
* For example, for `(symbol: string, arg1: number) => Promise<void>`,
|
|
20464
|
+
* this will produce `[symbol: string, alignMs: number, arg1: number]`.
|
|
20406
20465
|
*/
|
|
20407
|
-
type
|
|
20466
|
+
type IntervalFileKeyArgs<T extends IntervalFileFunction> = [
|
|
20467
|
+
symbol: string,
|
|
20468
|
+
alignMs: number,
|
|
20469
|
+
...rest: DropFirst<T>
|
|
20470
|
+
];
|
|
20408
20471
|
/**
|
|
20409
20472
|
* Utility class for wrapping signal functions with once-per-interval firing.
|
|
20410
20473
|
* Provides two modes: in-memory (`fn`) and persistent file-based (`file`).
|
|
@@ -20441,20 +20504,31 @@ declare class IntervalUtils {
|
|
|
20441
20504
|
*
|
|
20442
20505
|
* @param run - Signal function to wrap
|
|
20443
20506
|
* @param context.interval - Candle interval that controls the firing boundary
|
|
20444
|
-
* @
|
|
20507
|
+
* @param context.key - Optional key generator for argument-based state separation
|
|
20508
|
+
* @returns Wrapped function with the same signature as `F`, plus a `clear()` method
|
|
20445
20509
|
*
|
|
20446
20510
|
* @example
|
|
20447
20511
|
* ```typescript
|
|
20512
|
+
* // Without extra args
|
|
20448
20513
|
* const fireOnce = Interval.fn(mySignalFn, { interval: "15m" });
|
|
20449
|
-
*
|
|
20450
20514
|
* await fireOnce("BTCUSDT"); // → T or null (fn called)
|
|
20451
20515
|
* await fireOnce("BTCUSDT"); // → null (same interval, skipped)
|
|
20516
|
+
*
|
|
20517
|
+
* // With extra args and key
|
|
20518
|
+
* const fireOnce = Interval.fn(mySignalFn, {
|
|
20519
|
+
* interval: "15m",
|
|
20520
|
+
* key: ([symbol, period]) => `${symbol}_${period}`,
|
|
20521
|
+
* });
|
|
20522
|
+
* await fireOnce("BTCUSDT", 14); // → T or null
|
|
20523
|
+
* await fireOnce("BTCUSDT", 28); // → T or null (separate state)
|
|
20452
20524
|
* ```
|
|
20453
20525
|
*/
|
|
20454
|
-
fn: <
|
|
20526
|
+
fn: <F extends Function>(run: F, context: {
|
|
20455
20527
|
interval: CandleInterval;
|
|
20456
|
-
|
|
20528
|
+
key?: (args: Parameters<F>) => string;
|
|
20529
|
+
}) => F & {
|
|
20457
20530
|
clear(): void;
|
|
20531
|
+
gc(): number | undefined;
|
|
20458
20532
|
};
|
|
20459
20533
|
/**
|
|
20460
20534
|
* Wrap an async signal function with persistent file-based once-per-interval firing.
|
|
@@ -20466,24 +20540,30 @@ declare class IntervalUtils {
|
|
|
20466
20540
|
* The `run` function reference is used as the memoization key for the underlying
|
|
20467
20541
|
* `IntervalFileInstance`, so each unique function reference gets its own isolated instance.
|
|
20468
20542
|
*
|
|
20469
|
-
* @template
|
|
20543
|
+
* @template F - Concrete async function type
|
|
20470
20544
|
* @param run - Async signal function to wrap with persistent once-per-interval firing
|
|
20471
20545
|
* @param context.interval - Candle interval that controls the firing boundary
|
|
20472
20546
|
* @param context.name - Human-readable bucket name; becomes the directory prefix
|
|
20473
|
-
* @
|
|
20474
|
-
*
|
|
20547
|
+
* @param context.key - Optional entity key generator. Receives `[symbol, alignMs, ...rest]`.
|
|
20548
|
+
* Default: `([symbol, alignMs]) => \`${symbol}_${alignMs}\``
|
|
20549
|
+
* @returns Wrapped function with the same signature as `F`, plus an async `clear()` method
|
|
20475
20550
|
*
|
|
20476
20551
|
* @example
|
|
20477
20552
|
* ```typescript
|
|
20478
|
-
* const fetchSignal = async (symbol: string,
|
|
20479
|
-
* const fireOnce = Interval.file(fetchSignal, {
|
|
20480
|
-
*
|
|
20553
|
+
* const fetchSignal = async (symbol: string, period: number) => { ... };
|
|
20554
|
+
* const fireOnce = Interval.file(fetchSignal, {
|
|
20555
|
+
* interval: "1h",
|
|
20556
|
+
* name: "fetchSignal",
|
|
20557
|
+
* key: ([symbol, alignMs, period]) => `${symbol}_${alignMs}_${period}`,
|
|
20558
|
+
* });
|
|
20559
|
+
* await fireOnce("BTCUSDT", 14);
|
|
20481
20560
|
* ```
|
|
20482
20561
|
*/
|
|
20483
|
-
file: <
|
|
20562
|
+
file: <F extends IntervalFileFunction>(run: F, context: {
|
|
20484
20563
|
interval: CandleInterval;
|
|
20485
20564
|
name: string;
|
|
20486
|
-
|
|
20565
|
+
key?: (args: IntervalFileKeyArgs<F>) => string;
|
|
20566
|
+
}) => F & {
|
|
20487
20567
|
clear(): Promise<void>;
|
|
20488
20568
|
};
|
|
20489
20569
|
/**
|
|
@@ -20501,14 +20581,19 @@ declare class IntervalUtils {
|
|
|
20501
20581
|
* Interval.dispose(mySignalFn);
|
|
20502
20582
|
* ```
|
|
20503
20583
|
*/
|
|
20504
|
-
dispose: (run:
|
|
20584
|
+
dispose: (run: Function) => void;
|
|
20505
20585
|
/**
|
|
20506
|
-
* Clears all memoized `IntervalFnInstance` and `IntervalFileInstance` objects
|
|
20507
|
-
* resets the `IntervalFileInstance` index counter.
|
|
20586
|
+
* Clears all memoized `IntervalFnInstance` and `IntervalFileInstance` objects.
|
|
20508
20587
|
* Call this when `process.cwd()` changes between strategy iterations
|
|
20509
20588
|
* so new instances are created with the updated base path.
|
|
20510
20589
|
*/
|
|
20511
20590
|
clear: () => void;
|
|
20591
|
+
/**
|
|
20592
|
+
* Resets the IntervalFileInstance index counter to zero.
|
|
20593
|
+
* This is useful when process.cwd() changes between strategy iterations to ensure
|
|
20594
|
+
* that new IntervalFileInstance objects start with index 0 and do not collide with old instances.
|
|
20595
|
+
*/
|
|
20596
|
+
resetCounter: () => void;
|
|
20512
20597
|
}
|
|
20513
20598
|
/**
|
|
20514
20599
|
* Singleton instance of `IntervalUtils` for convenient once-per-interval signal firing.
|
|
@@ -30443,4 +30528,4 @@ declare const getTotalClosed: (signal: Signal) => {
|
|
|
30443
30528
|
remainingCostBasis: number;
|
|
30444
30529
|
};
|
|
30445
30530
|
|
|
30446
|
-
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, 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 IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicAction, type IPublicCandleData, type IPublicSignalRow, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskSignalRow, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, type IScheduledSignalRow, 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 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 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, type MemoryData, 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, PersistCandleAdapter, PersistIntervalAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistMemoryAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PersistStorageAdapter, Position, PositionSize, type ProgressBacktestContract, type ProgressWalkerContract, 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, type SignalCancelledNotification, type SignalCloseContract, type SignalClosedNotification, type SignalData, type SignalInterval, type SignalOpenContract, type SignalOpenedNotification, type SignalScheduledNotification, type SignalSyncCloseNotification, type SignalSyncContract, type SignalSyncOpenNotification, Storage, StorageBacktest, type StorageData, StorageLive, Strategy, type StrategyActionType, type StrategyCancelReason, type StrategyCloseReason, type StrategyCommitContract, type StrategyEvent, type StrategyStatisticsModel, Sync, type SyncEvent, type SyncStatisticsModel, type TBrokerCtor, type TDumpInstanceCtor, type
|
|
30531
|
+
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, 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 IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicAction, type IPublicCandleData, type IPublicSignalRow, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskSignalRow, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, type IScheduledSignalRow, 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 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 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, type MemoryData, 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, PersistCandleAdapter, PersistIntervalAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistMemoryAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PersistStorageAdapter, Position, PositionSize, type ProgressBacktestContract, type ProgressWalkerContract, 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, type SignalCancelledNotification, type SignalCloseContract, type SignalClosedNotification, type SignalData, type SignalInterval, type SignalOpenContract, type SignalOpenedNotification, type SignalScheduledNotification, type SignalSyncCloseNotification, type SignalSyncContract, type SignalSyncOpenNotification, Storage, StorageBacktest, type StorageData, StorageLive, Strategy, type StrategyActionType, type StrategyCancelReason, type StrategyCloseReason, type StrategyCommitContract, type StrategyEvent, type StrategyStatisticsModel, Sync, type SyncEvent, type SyncStatisticsModel, type TBrokerCtor, type TDumpInstanceCtor, type TLogCtor, type TMarkdownBase, type TMemoryInstanceCtor, type TNotificationUtilsCtor, type TPersistBase, type TPersistBaseCtor, type TReportBase, 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, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, dumpAgentAnswer, dumpError, dumpJson, dumpRecord, dumpTable, dumpText, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getMode, getNextCandles, getOrderBook, getPendingSignal, 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, getRawCandles, getRiskSchema, getScheduledSignal, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasNoPendingSignal, hasNoScheduledSignal, hasTradeContext, 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, listenMaxDrawdown, listenMaxDrawdownOnce, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, 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, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, validateCommonSignal, validatePendingSignal, validateScheduledSignal, validateSignal, waitForCandle, warmCandles, writeMemory };
|