backtest-kit 6.8.1 → 6.10.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 +1469 -188
- package/build/index.mjs +1463 -189
- package/package.json +3 -3
- package/types.d.ts +645 -9
package/types.d.ts
CHANGED
|
@@ -2173,6 +2173,14 @@ interface ISignalDto {
|
|
|
2173
2173
|
/** Cost of this entry in USD. Default: GLOBAL_CONFIG.CC_POSITION_ENTRY_COST */
|
|
2174
2174
|
cost?: number;
|
|
2175
2175
|
}
|
|
2176
|
+
/**
|
|
2177
|
+
* Signal dto for IntervalUtils.fn which allows returning multiple signals in one getSignal call.
|
|
2178
|
+
* This will pause the next signal untill interval elapses
|
|
2179
|
+
*/
|
|
2180
|
+
interface ISignalIntervalDto extends ISignalDto {
|
|
2181
|
+
/** Unique signal identifier (UUID v4 auto-generated) */
|
|
2182
|
+
id: string;
|
|
2183
|
+
}
|
|
2176
2184
|
/**
|
|
2177
2185
|
* Complete signal with auto-generated id.
|
|
2178
2186
|
* Used throughout the system after validation.
|
|
@@ -3622,6 +3630,46 @@ interface IStrategy {
|
|
|
3622
3630
|
* @returns Promise resolving to PnL cost or null
|
|
3623
3631
|
*/
|
|
3624
3632
|
getPositionMaxDrawdownPnlCost: (symbol: string) => Promise<number | null>;
|
|
3633
|
+
/**
|
|
3634
|
+
* Returns the distance in PnL percentage between the current price and the highest profit peak.
|
|
3635
|
+
*
|
|
3636
|
+
* Computed as: max(0, peakPnlPercentage - currentPnlPercentage).
|
|
3637
|
+
*
|
|
3638
|
+
* @param symbol - Trading pair symbol
|
|
3639
|
+
* @param currentPrice - Current market price
|
|
3640
|
+
* @returns Promise resolving to drawdown distance in PnL% (≥ 0) or null
|
|
3641
|
+
*/
|
|
3642
|
+
getPositionHighestProfitDistancePnlPercentage: (symbol: string, currentPrice: number) => Promise<number | null>;
|
|
3643
|
+
/**
|
|
3644
|
+
* Returns the distance in PnL cost between the current price and the highest profit peak.
|
|
3645
|
+
*
|
|
3646
|
+
* Computed as: max(0, peakPnlCost - currentPnlCost).
|
|
3647
|
+
*
|
|
3648
|
+
* @param symbol - Trading pair symbol
|
|
3649
|
+
* @param currentPrice - Current market price
|
|
3650
|
+
* @returns Promise resolving to drawdown distance in PnL cost (≥ 0) or null
|
|
3651
|
+
*/
|
|
3652
|
+
getPositionHighestProfitDistancePnlCost: (symbol: string, currentPrice: number) => Promise<number | null>;
|
|
3653
|
+
/**
|
|
3654
|
+
* Returns the distance in PnL percentage between the current price and the worst drawdown trough.
|
|
3655
|
+
*
|
|
3656
|
+
* Computed as: max(0, currentPnlPercentage - fallPnlPercentage).
|
|
3657
|
+
*
|
|
3658
|
+
* @param symbol - Trading pair symbol
|
|
3659
|
+
* @param currentPrice - Current market price
|
|
3660
|
+
* @returns Promise resolving to recovery distance in PnL% (≥ 0) or null
|
|
3661
|
+
*/
|
|
3662
|
+
getPositionHighestMaxDrawdownPnlPercentage: (symbol: string, currentPrice: number) => Promise<number | null>;
|
|
3663
|
+
/**
|
|
3664
|
+
* Returns the distance in PnL cost between the current price and the worst drawdown trough.
|
|
3665
|
+
*
|
|
3666
|
+
* Computed as: max(0, currentPnlCost - fallPnlCost).
|
|
3667
|
+
*
|
|
3668
|
+
* @param symbol - Trading pair symbol
|
|
3669
|
+
* @param currentPrice - Current market price
|
|
3670
|
+
* @returns Promise resolving to recovery distance in PnL cost (≥ 0) or null
|
|
3671
|
+
*/
|
|
3672
|
+
getPositionHighestMaxDrawdownPnlCost: (symbol: string, currentPrice: number) => Promise<number | null>;
|
|
3625
3673
|
/**
|
|
3626
3674
|
* Disposes the strategy instance and cleans up resources.
|
|
3627
3675
|
*
|
|
@@ -5582,6 +5630,78 @@ declare function getPositionMaxDrawdownPnlPercentage(symbol: string): Promise<nu
|
|
|
5582
5630
|
* ```
|
|
5583
5631
|
*/
|
|
5584
5632
|
declare function getPositionMaxDrawdownPnlCost(symbol: string): Promise<number>;
|
|
5633
|
+
/**
|
|
5634
|
+
* Returns the distance in PnL percentage between the current price and the highest profit peak.
|
|
5635
|
+
*
|
|
5636
|
+
* Computed as: max(0, peakPnlPercentage - currentPnlPercentage).
|
|
5637
|
+
* Returns null if no pending signal exists.
|
|
5638
|
+
*
|
|
5639
|
+
* @param symbol - Trading pair symbol
|
|
5640
|
+
* @returns Promise resolving to drawdown distance in PnL% (≥ 0) or null
|
|
5641
|
+
*
|
|
5642
|
+
* @example
|
|
5643
|
+
* ```typescript
|
|
5644
|
+
* import { getPositionHighestProfitDistancePnlPercentage } from "backtest-kit";
|
|
5645
|
+
*
|
|
5646
|
+
* const dist = await getPositionHighestProfitDistancePnlPercentage("BTCUSDT");
|
|
5647
|
+
* // e.g. 1.5 (gave back 1.5% from peak)
|
|
5648
|
+
* ```
|
|
5649
|
+
*/
|
|
5650
|
+
declare function getPositionHighestProfitDistancePnlPercentage(symbol: string): Promise<number>;
|
|
5651
|
+
/**
|
|
5652
|
+
* Returns the distance in PnL cost between the current price and the highest profit peak.
|
|
5653
|
+
*
|
|
5654
|
+
* Computed as: max(0, peakPnlCost - currentPnlCost).
|
|
5655
|
+
* Returns null if no pending signal exists.
|
|
5656
|
+
*
|
|
5657
|
+
* @param symbol - Trading pair symbol
|
|
5658
|
+
* @returns Promise resolving to drawdown distance in PnL cost (≥ 0) or null
|
|
5659
|
+
*
|
|
5660
|
+
* @example
|
|
5661
|
+
* ```typescript
|
|
5662
|
+
* import { getPositionHighestProfitDistancePnlCost } from "backtest-kit";
|
|
5663
|
+
*
|
|
5664
|
+
* const dist = await getPositionHighestProfitDistancePnlCost("BTCUSDT");
|
|
5665
|
+
* // e.g. 3.2 (gave back $3.2 from peak)
|
|
5666
|
+
* ```
|
|
5667
|
+
*/
|
|
5668
|
+
declare function getPositionHighestProfitDistancePnlCost(symbol: string): Promise<number>;
|
|
5669
|
+
/**
|
|
5670
|
+
* Returns the distance in PnL percentage between the current price and the worst drawdown trough.
|
|
5671
|
+
*
|
|
5672
|
+
* Computed as: max(0, currentPnlPercentage - fallPnlPercentage).
|
|
5673
|
+
* Returns null if no pending signal exists.
|
|
5674
|
+
*
|
|
5675
|
+
* @param symbol - Trading pair symbol
|
|
5676
|
+
* @returns Promise resolving to recovery distance in PnL% (≥ 0) or null
|
|
5677
|
+
*
|
|
5678
|
+
* @example
|
|
5679
|
+
* ```typescript
|
|
5680
|
+
* import { getPositionHighestMaxDrawdownPnlPercentage } from "backtest-kit";
|
|
5681
|
+
*
|
|
5682
|
+
* const dist = await getPositionHighestMaxDrawdownPnlPercentage("BTCUSDT");
|
|
5683
|
+
* // e.g. 2.1 (recovered 2.1% from trough)
|
|
5684
|
+
* ```
|
|
5685
|
+
*/
|
|
5686
|
+
declare function getPositionHighestMaxDrawdownPnlPercentage(symbol: string): Promise<number>;
|
|
5687
|
+
/**
|
|
5688
|
+
* Returns the distance in PnL cost between the current price and the worst drawdown trough.
|
|
5689
|
+
*
|
|
5690
|
+
* Computed as: max(0, currentPnlCost - fallPnlCost).
|
|
5691
|
+
* Returns null if no pending signal exists.
|
|
5692
|
+
*
|
|
5693
|
+
* @param symbol - Trading pair symbol
|
|
5694
|
+
* @returns Promise resolving to recovery distance in PnL cost (≥ 0) or null
|
|
5695
|
+
*
|
|
5696
|
+
* @example
|
|
5697
|
+
* ```typescript
|
|
5698
|
+
* import { getPositionHighestMaxDrawdownPnlCost } from "backtest-kit";
|
|
5699
|
+
*
|
|
5700
|
+
* const dist = await getPositionHighestMaxDrawdownPnlCost("BTCUSDT");
|
|
5701
|
+
* // e.g. 4.8 (recovered $4.8 from trough)
|
|
5702
|
+
* ```
|
|
5703
|
+
*/
|
|
5704
|
+
declare function getPositionHighestMaxDrawdownPnlCost(symbol: string): Promise<number>;
|
|
5585
5705
|
/**
|
|
5586
5706
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
5587
5707
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -11070,6 +11190,15 @@ type SignalData = ISignalRow | null;
|
|
|
11070
11190
|
type MeasureData = {
|
|
11071
11191
|
id: string;
|
|
11072
11192
|
data: unknown;
|
|
11193
|
+
removed: boolean;
|
|
11194
|
+
};
|
|
11195
|
+
/**
|
|
11196
|
+
* Interval.file data type stored in persistence layer.
|
|
11197
|
+
*/
|
|
11198
|
+
type IntervalData = {
|
|
11199
|
+
id: string;
|
|
11200
|
+
data: unknown;
|
|
11201
|
+
removed: boolean;
|
|
11073
11202
|
};
|
|
11074
11203
|
/**
|
|
11075
11204
|
* Type helper for PersistBase instance.
|
|
@@ -12033,6 +12162,23 @@ declare class PersistMeasureUtils {
|
|
|
12033
12162
|
* @returns Promise that resolves when write is complete
|
|
12034
12163
|
*/
|
|
12035
12164
|
writeMeasureData: (data: MeasureData, bucket: string, key: string) => Promise<void>;
|
|
12165
|
+
/**
|
|
12166
|
+
* Marks a cached entry as removed (soft delete — file is kept on disk).
|
|
12167
|
+
* After this call `readMeasureData` for the same key returns `null`.
|
|
12168
|
+
*
|
|
12169
|
+
* @param bucket - Storage bucket
|
|
12170
|
+
* @param key - Dynamic cache key within the bucket
|
|
12171
|
+
* @returns Promise that resolves when removal is complete
|
|
12172
|
+
*/
|
|
12173
|
+
removeMeasureData: (bucket: string, key: string) => Promise<void>;
|
|
12174
|
+
/**
|
|
12175
|
+
* Async generator yielding all non-removed entity keys for a given bucket.
|
|
12176
|
+
* Used by `CacheFileInstance.clear()` to iterate and soft-delete all entries.
|
|
12177
|
+
*
|
|
12178
|
+
* @param bucket - Storage bucket
|
|
12179
|
+
* @returns AsyncGenerator yielding entity keys
|
|
12180
|
+
*/
|
|
12181
|
+
listMeasureData(bucket: string): AsyncGenerator<string>;
|
|
12036
12182
|
/**
|
|
12037
12183
|
* Clears the memoized storage cache.
|
|
12038
12184
|
* Call this when process.cwd() changes between strategy iterations
|
|
@@ -12053,6 +12199,76 @@ declare class PersistMeasureUtils {
|
|
|
12053
12199
|
* Used by Cache.file for persistent caching of external API responses.
|
|
12054
12200
|
*/
|
|
12055
12201
|
declare const PersistMeasureAdapter: PersistMeasureUtils;
|
|
12202
|
+
/**
|
|
12203
|
+
* Persistence layer for Interval.file once-per-interval signal firing.
|
|
12204
|
+
*
|
|
12205
|
+
* Stores fired-interval markers under `./dump/data/interval/`.
|
|
12206
|
+
* A record's presence means the interval has already fired for that bucket+key;
|
|
12207
|
+
* absence means the function has not yet fired (or returned null last time).
|
|
12208
|
+
*/
|
|
12209
|
+
declare class PersistIntervalUtils {
|
|
12210
|
+
private PersistIntervalFactory;
|
|
12211
|
+
private getIntervalStorage;
|
|
12212
|
+
/**
|
|
12213
|
+
* Registers a custom persistence adapter.
|
|
12214
|
+
*
|
|
12215
|
+
* @param Ctor - Custom PersistBase constructor
|
|
12216
|
+
*/
|
|
12217
|
+
usePersistIntervalAdapter(Ctor: TPersistBaseCtor<string, IntervalData>): void;
|
|
12218
|
+
/**
|
|
12219
|
+
* Reads interval data for a given bucket and key.
|
|
12220
|
+
*
|
|
12221
|
+
* @param bucket - Storage bucket (instance name + interval + index)
|
|
12222
|
+
* @param key - Entity key within the bucket (symbol + aligned timestamp)
|
|
12223
|
+
* @returns Promise resolving to stored value or null if not found
|
|
12224
|
+
*/
|
|
12225
|
+
readIntervalData: (bucket: string, key: string) => Promise<IntervalData | null>;
|
|
12226
|
+
/**
|
|
12227
|
+
* Writes interval data to disk.
|
|
12228
|
+
*
|
|
12229
|
+
* @param data - Data to store
|
|
12230
|
+
* @param bucket - Storage bucket
|
|
12231
|
+
* @param key - Entity key within the bucket
|
|
12232
|
+
* @returns Promise that resolves when write is complete
|
|
12233
|
+
*/
|
|
12234
|
+
writeIntervalData: (data: IntervalData, bucket: string, key: string) => Promise<void>;
|
|
12235
|
+
/**
|
|
12236
|
+
* Marks an interval entry as removed (soft delete — file is kept on disk).
|
|
12237
|
+
* After this call `readIntervalData` for the same key returns `null`,
|
|
12238
|
+
* so the function will fire again on the next `IntervalFileInstance.run` call.
|
|
12239
|
+
*
|
|
12240
|
+
* @param bucket - Storage bucket
|
|
12241
|
+
* @param key - Entity key within the bucket
|
|
12242
|
+
* @returns Promise that resolves when removal is complete
|
|
12243
|
+
*/
|
|
12244
|
+
removeIntervalData: (bucket: string, key: string) => Promise<void>;
|
|
12245
|
+
/**
|
|
12246
|
+
* Async generator yielding all non-removed entity keys for a given bucket.
|
|
12247
|
+
* Used by `IntervalFileInstance.clear()` to iterate and soft-delete all entries.
|
|
12248
|
+
*
|
|
12249
|
+
* @param bucket - Storage bucket
|
|
12250
|
+
* @returns AsyncGenerator yielding entity keys
|
|
12251
|
+
*/
|
|
12252
|
+
listIntervalData(bucket: string): AsyncGenerator<string>;
|
|
12253
|
+
/**
|
|
12254
|
+
* Clears the memoized storage cache.
|
|
12255
|
+
* Call this when process.cwd() changes between strategy iterations.
|
|
12256
|
+
*/
|
|
12257
|
+
clear(): void;
|
|
12258
|
+
/**
|
|
12259
|
+
* Switches to the default JSON persist adapter.
|
|
12260
|
+
*/
|
|
12261
|
+
useJson(): void;
|
|
12262
|
+
/**
|
|
12263
|
+
* Switches to a dummy persist adapter that discards all writes.
|
|
12264
|
+
*/
|
|
12265
|
+
useDummy(): void;
|
|
12266
|
+
}
|
|
12267
|
+
/**
|
|
12268
|
+
* Global singleton instance of PersistIntervalUtils.
|
|
12269
|
+
* Used by Interval.file for persistent once-per-interval signal firing.
|
|
12270
|
+
*/
|
|
12271
|
+
declare const PersistIntervalAdapter: PersistIntervalUtils;
|
|
12056
12272
|
/**
|
|
12057
12273
|
* Type for persisted memory entry data.
|
|
12058
12274
|
* Each memory entry is an arbitrary JSON-serializable object.
|
|
@@ -13795,6 +14011,66 @@ declare class BacktestUtils {
|
|
|
13795
14011
|
exchangeName: ExchangeName;
|
|
13796
14012
|
frameName: FrameName;
|
|
13797
14013
|
}) => Promise<number>;
|
|
14014
|
+
/**
|
|
14015
|
+
* Returns the distance in PnL percentage between the current price and the highest profit peak.
|
|
14016
|
+
*
|
|
14017
|
+
* Computed as: max(0, peakPnlPercentage - currentPnlPercentage).
|
|
14018
|
+
* Returns null if no pending signal exists.
|
|
14019
|
+
*
|
|
14020
|
+
* @param symbol - Trading pair symbol
|
|
14021
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
14022
|
+
* @returns drawdown distance in PnL% (≥ 0) or null if no active position
|
|
14023
|
+
*/
|
|
14024
|
+
getPositionHighestProfitDistancePnlPercentage: (symbol: string, context: {
|
|
14025
|
+
strategyName: StrategyName;
|
|
14026
|
+
exchangeName: ExchangeName;
|
|
14027
|
+
frameName: FrameName;
|
|
14028
|
+
}) => Promise<number>;
|
|
14029
|
+
/**
|
|
14030
|
+
* Returns the distance in PnL cost between the current price and the highest profit peak.
|
|
14031
|
+
*
|
|
14032
|
+
* Computed as: max(0, peakPnlCost - currentPnlCost).
|
|
14033
|
+
* Returns null if no pending signal exists.
|
|
14034
|
+
*
|
|
14035
|
+
* @param symbol - Trading pair symbol
|
|
14036
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
14037
|
+
* @returns drawdown distance in PnL cost (≥ 0) or null if no active position
|
|
14038
|
+
*/
|
|
14039
|
+
getPositionHighestProfitDistancePnlCost: (symbol: string, context: {
|
|
14040
|
+
strategyName: StrategyName;
|
|
14041
|
+
exchangeName: ExchangeName;
|
|
14042
|
+
frameName: FrameName;
|
|
14043
|
+
}) => Promise<number>;
|
|
14044
|
+
/**
|
|
14045
|
+
* Returns the distance in PnL percentage between the current price and the worst drawdown trough.
|
|
14046
|
+
*
|
|
14047
|
+
* Computed as: max(0, currentPnlPercentage - fallPnlPercentage).
|
|
14048
|
+
* Returns null if no pending signal exists.
|
|
14049
|
+
*
|
|
14050
|
+
* @param symbol - Trading pair symbol
|
|
14051
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
14052
|
+
* @returns recovery distance in PnL% (≥ 0) or null if no active position
|
|
14053
|
+
*/
|
|
14054
|
+
getPositionHighestMaxDrawdownPnlPercentage: (symbol: string, context: {
|
|
14055
|
+
strategyName: StrategyName;
|
|
14056
|
+
exchangeName: ExchangeName;
|
|
14057
|
+
frameName: FrameName;
|
|
14058
|
+
}) => Promise<number>;
|
|
14059
|
+
/**
|
|
14060
|
+
* Returns the distance in PnL cost between the current price and the worst drawdown trough.
|
|
14061
|
+
*
|
|
14062
|
+
* Computed as: max(0, currentPnlCost - fallPnlCost).
|
|
14063
|
+
* Returns null if no pending signal exists.
|
|
14064
|
+
*
|
|
14065
|
+
* @param symbol - Trading pair symbol
|
|
14066
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
14067
|
+
* @returns recovery distance in PnL cost (≥ 0) or null if no active position
|
|
14068
|
+
*/
|
|
14069
|
+
getPositionHighestMaxDrawdownPnlCost: (symbol: string, context: {
|
|
14070
|
+
strategyName: StrategyName;
|
|
14071
|
+
exchangeName: ExchangeName;
|
|
14072
|
+
frameName: FrameName;
|
|
14073
|
+
}) => Promise<number>;
|
|
13798
14074
|
/**
|
|
13799
14075
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
13800
14076
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -15153,6 +15429,62 @@ declare class LiveUtils {
|
|
|
15153
15429
|
strategyName: StrategyName;
|
|
15154
15430
|
exchangeName: ExchangeName;
|
|
15155
15431
|
}) => Promise<number>;
|
|
15432
|
+
/**
|
|
15433
|
+
* Returns the distance in PnL percentage between the current price and the highest profit peak.
|
|
15434
|
+
*
|
|
15435
|
+
* Computed as: max(0, peakPnlPercentage - currentPnlPercentage).
|
|
15436
|
+
* Returns null if no pending signal exists.
|
|
15437
|
+
*
|
|
15438
|
+
* @param symbol - Trading pair symbol
|
|
15439
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
15440
|
+
* @returns drawdown distance in PnL% (≥ 0) or null if no active position
|
|
15441
|
+
*/
|
|
15442
|
+
getPositionHighestProfitDistancePnlPercentage: (symbol: string, context: {
|
|
15443
|
+
strategyName: StrategyName;
|
|
15444
|
+
exchangeName: ExchangeName;
|
|
15445
|
+
}) => Promise<number>;
|
|
15446
|
+
/**
|
|
15447
|
+
* Returns the distance in PnL cost between the current price and the highest profit peak.
|
|
15448
|
+
*
|
|
15449
|
+
* Computed as: max(0, peakPnlCost - currentPnlCost).
|
|
15450
|
+
* Returns null if no pending signal exists.
|
|
15451
|
+
*
|
|
15452
|
+
* @param symbol - Trading pair symbol
|
|
15453
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
15454
|
+
* @returns drawdown distance in PnL cost (≥ 0) or null if no active position
|
|
15455
|
+
*/
|
|
15456
|
+
getPositionHighestProfitDistancePnlCost: (symbol: string, context: {
|
|
15457
|
+
strategyName: StrategyName;
|
|
15458
|
+
exchangeName: ExchangeName;
|
|
15459
|
+
}) => Promise<number>;
|
|
15460
|
+
/**
|
|
15461
|
+
* Returns the distance in PnL percentage between the current price and the worst drawdown trough.
|
|
15462
|
+
*
|
|
15463
|
+
* Computed as: max(0, currentPnlPercentage - fallPnlPercentage).
|
|
15464
|
+
* Returns null if no pending signal exists.
|
|
15465
|
+
*
|
|
15466
|
+
* @param symbol - Trading pair symbol
|
|
15467
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
15468
|
+
* @returns recovery distance in PnL% (≥ 0) or null if no active position
|
|
15469
|
+
*/
|
|
15470
|
+
getPositionHighestMaxDrawdownPnlPercentage: (symbol: string, context: {
|
|
15471
|
+
strategyName: StrategyName;
|
|
15472
|
+
exchangeName: ExchangeName;
|
|
15473
|
+
}) => Promise<number>;
|
|
15474
|
+
/**
|
|
15475
|
+
* Returns the distance in PnL cost between the current price and the worst drawdown trough.
|
|
15476
|
+
*
|
|
15477
|
+
* Computed as: max(0, currentPnlCost - fallPnlCost).
|
|
15478
|
+
* Returns null if no pending signal exists.
|
|
15479
|
+
*
|
|
15480
|
+
* @param symbol - Trading pair symbol
|
|
15481
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
15482
|
+
* @returns recovery distance in PnL cost (≥ 0) or null if no active position
|
|
15483
|
+
*/
|
|
15484
|
+
getPositionHighestMaxDrawdownPnlCost: (symbol: string, context: {
|
|
15485
|
+
strategyName: StrategyName;
|
|
15486
|
+
exchangeName: ExchangeName;
|
|
15487
|
+
}) => Promise<number>;
|
|
15156
15488
|
/**
|
|
15157
15489
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
15158
15490
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -17179,6 +17511,47 @@ declare class PositionSizeUtils {
|
|
|
17179
17511
|
}
|
|
17180
17512
|
declare const PositionSize: typeof PositionSizeUtils;
|
|
17181
17513
|
|
|
17514
|
+
/**
|
|
17515
|
+
* Utilities for calculating take profit and stop loss price levels.
|
|
17516
|
+
* Automatically inverts direction based on position type (long/short).
|
|
17517
|
+
*/
|
|
17518
|
+
declare class Position {
|
|
17519
|
+
/**
|
|
17520
|
+
* Calculates levels for the "moonbag" strategy — fixed TP at 50% from the current price.
|
|
17521
|
+
* @param dto.position - position type: "long" or "short"
|
|
17522
|
+
* @param dto.currentPrice - current asset price
|
|
17523
|
+
* @param dto.percentStopLoss - stop loss percentage from 0 to 100
|
|
17524
|
+
* @returns priceTakeProfit and priceStopLoss in fiat
|
|
17525
|
+
*/
|
|
17526
|
+
static moonbag: (dto: {
|
|
17527
|
+
position: "long" | "short";
|
|
17528
|
+
currentPrice: number;
|
|
17529
|
+
percentStopLoss: number;
|
|
17530
|
+
}) => {
|
|
17531
|
+
position: "long" | "short";
|
|
17532
|
+
priceTakeProfit: number;
|
|
17533
|
+
priceStopLoss: number;
|
|
17534
|
+
};
|
|
17535
|
+
/**
|
|
17536
|
+
* Calculates levels for a bracket order with custom TP and SL.
|
|
17537
|
+
* @param dto.position - position type: "long" or "short"
|
|
17538
|
+
* @param dto.currentPrice - current asset price
|
|
17539
|
+
* @param dto.percentStopLoss - stop loss percentage from 0 to 100
|
|
17540
|
+
* @param dto.percentTakeProfit - take profit percentage from 0 to 100
|
|
17541
|
+
* @returns priceTakeProfit and priceStopLoss in fiat
|
|
17542
|
+
*/
|
|
17543
|
+
static bracket: (dto: {
|
|
17544
|
+
position: "long" | "short";
|
|
17545
|
+
currentPrice: number;
|
|
17546
|
+
percentStopLoss: number;
|
|
17547
|
+
percentTakeProfit: number;
|
|
17548
|
+
}) => {
|
|
17549
|
+
position: "long" | "short";
|
|
17550
|
+
priceTakeProfit: number;
|
|
17551
|
+
priceStopLoss: number;
|
|
17552
|
+
};
|
|
17553
|
+
}
|
|
17554
|
+
|
|
17182
17555
|
/**
|
|
17183
17556
|
* Type alias for column configuration used in partial profit/loss markdown reports.
|
|
17184
17557
|
*
|
|
@@ -19886,7 +20259,7 @@ type CacheFileKeyArgs<T extends CacheFileFunction> = [
|
|
|
19886
20259
|
*/
|
|
19887
20260
|
declare class CacheUtils {
|
|
19888
20261
|
/**
|
|
19889
|
-
* Memoized function to get or create
|
|
20262
|
+
* Memoized function to get or create CacheFnInstance for a function.
|
|
19890
20263
|
* Each function gets its own isolated cache instance.
|
|
19891
20264
|
*/
|
|
19892
20265
|
private _getFnInstance;
|
|
@@ -19978,29 +20351,29 @@ declare class CacheUtils {
|
|
|
19978
20351
|
name: string;
|
|
19979
20352
|
key?: (args: CacheFileKeyArgs<T>) => string;
|
|
19980
20353
|
}) => T & {
|
|
19981
|
-
clear(): void
|
|
20354
|
+
clear(): Promise<void>;
|
|
19982
20355
|
};
|
|
19983
20356
|
/**
|
|
19984
|
-
* Dispose (remove) the memoized
|
|
20357
|
+
* Dispose (remove) the memoized CacheFnInstance for a specific function.
|
|
19985
20358
|
*
|
|
19986
|
-
* Removes the
|
|
20359
|
+
* Removes the CacheFnInstance from the internal memoization cache, discarding all cached
|
|
19987
20360
|
* results across all contexts (all strategy/exchange/mode combinations) for that function.
|
|
19988
|
-
* The next call to the wrapped function will create a fresh
|
|
20361
|
+
* The next call to the wrapped function will create a fresh CacheFnInstance.
|
|
19989
20362
|
*
|
|
19990
20363
|
* @template T - Function type
|
|
19991
|
-
* @param run - Function whose
|
|
20364
|
+
* @param run - Function whose CacheFnInstance should be disposed.
|
|
19992
20365
|
*
|
|
19993
20366
|
* @example
|
|
19994
20367
|
* ```typescript
|
|
19995
20368
|
* const cachedFn = Cache.fn(calculateIndicator, { interval: "1h" });
|
|
19996
20369
|
*
|
|
19997
|
-
* // Dispose
|
|
20370
|
+
* // Dispose CacheFnInstance for a specific function
|
|
19998
20371
|
* Cache.dispose(calculateIndicator);
|
|
19999
20372
|
* ```
|
|
20000
20373
|
*/
|
|
20001
20374
|
dispose: <T extends Function>(run: T) => void;
|
|
20002
20375
|
/**
|
|
20003
|
-
* Clears all memoized
|
|
20376
|
+
* Clears all memoized CacheFnInstance and CacheFileInstance objects.
|
|
20004
20377
|
* Call this when process.cwd() changes between strategy iterations
|
|
20005
20378
|
* so new instances are created with the updated base path.
|
|
20006
20379
|
*/
|
|
@@ -20022,6 +20395,137 @@ declare class CacheUtils {
|
|
|
20022
20395
|
*/
|
|
20023
20396
|
declare const Cache: CacheUtils;
|
|
20024
20397
|
|
|
20398
|
+
/**
|
|
20399
|
+
* User-implemented function fired once per interval boundary.
|
|
20400
|
+
* Receives `when` from the caller (sourced from execution context).
|
|
20401
|
+
*/
|
|
20402
|
+
type TIntervalFn<T extends object = object> = (symbol: string, when: Date) => Promise<T | null>;
|
|
20403
|
+
/**
|
|
20404
|
+
* Wrapped function returned by `Interval.fn` and `Interval.file`.
|
|
20405
|
+
* `when` is resolved internally from the execution context — callers pass only `symbol`.
|
|
20406
|
+
*/
|
|
20407
|
+
type TIntervalWrappedFn<T extends object = object> = (symbol: string) => Promise<T | null>;
|
|
20408
|
+
/**
|
|
20409
|
+
* Utility class for wrapping signal functions with once-per-interval firing.
|
|
20410
|
+
* Provides two modes: in-memory (`fn`) and persistent file-based (`file`).
|
|
20411
|
+
* Exported as singleton instance `Interval` for convenient usage.
|
|
20412
|
+
*
|
|
20413
|
+
* @example
|
|
20414
|
+
* ```typescript
|
|
20415
|
+
* import { Interval } from "./classes/Interval";
|
|
20416
|
+
*
|
|
20417
|
+
* const fireOncePerHour = Interval.fn(mySignalFn, { interval: "1h" });
|
|
20418
|
+
* await fireOncePerHour("BTCUSDT"); // fn called — returns its result
|
|
20419
|
+
* await fireOncePerHour("BTCUSDT"); // returns null (same interval)
|
|
20420
|
+
* ```
|
|
20421
|
+
*/
|
|
20422
|
+
declare class IntervalUtils {
|
|
20423
|
+
/**
|
|
20424
|
+
* Memoized factory to get or create an `IntervalFnInstance` for a function.
|
|
20425
|
+
* Each function reference gets its own isolated instance.
|
|
20426
|
+
*/
|
|
20427
|
+
private _getInstance;
|
|
20428
|
+
/**
|
|
20429
|
+
* Memoized factory to get or create an `IntervalFileInstance` for an async function.
|
|
20430
|
+
* Each function reference gets its own isolated persistent instance.
|
|
20431
|
+
*/
|
|
20432
|
+
private _getFileInstance;
|
|
20433
|
+
/**
|
|
20434
|
+
* Wrap a signal function with in-memory once-per-interval firing.
|
|
20435
|
+
*
|
|
20436
|
+
* Returns a wrapped version of the function that fires at most once per interval boundary.
|
|
20437
|
+
* If the function returns `null`, the countdown does not start and the next call retries.
|
|
20438
|
+
*
|
|
20439
|
+
* The `run` function reference is used as the memoization key for the underlying
|
|
20440
|
+
* `IntervalFnInstance`, so each unique function reference gets its own isolated instance.
|
|
20441
|
+
*
|
|
20442
|
+
* @param run - Signal function to wrap
|
|
20443
|
+
* @param context.interval - Candle interval that controls the firing boundary
|
|
20444
|
+
* @returns Wrapped function with the same signature as `TIntervalFn<T>`, plus a `clear()` method
|
|
20445
|
+
*
|
|
20446
|
+
* @example
|
|
20447
|
+
* ```typescript
|
|
20448
|
+
* const fireOnce = Interval.fn(mySignalFn, { interval: "15m" });
|
|
20449
|
+
*
|
|
20450
|
+
* await fireOnce("BTCUSDT"); // → T or null (fn called)
|
|
20451
|
+
* await fireOnce("BTCUSDT"); // → null (same interval, skipped)
|
|
20452
|
+
* ```
|
|
20453
|
+
*/
|
|
20454
|
+
fn: <T extends object>(run: TIntervalFn<T>, context: {
|
|
20455
|
+
interval: CandleInterval;
|
|
20456
|
+
}) => TIntervalWrappedFn<T> & {
|
|
20457
|
+
clear(): void;
|
|
20458
|
+
};
|
|
20459
|
+
/**
|
|
20460
|
+
* Wrap an async signal function with persistent file-based once-per-interval firing.
|
|
20461
|
+
*
|
|
20462
|
+
* Returns a wrapped version of the function that reads from disk on hit (returns `null`)
|
|
20463
|
+
* and writes the fired signal to disk on the first successful fire.
|
|
20464
|
+
* Fired state survives process restarts.
|
|
20465
|
+
*
|
|
20466
|
+
* The `run` function reference is used as the memoization key for the underlying
|
|
20467
|
+
* `IntervalFileInstance`, so each unique function reference gets its own isolated instance.
|
|
20468
|
+
*
|
|
20469
|
+
* @template T - Async function type to wrap
|
|
20470
|
+
* @param run - Async signal function to wrap with persistent once-per-interval firing
|
|
20471
|
+
* @param context.interval - Candle interval that controls the firing boundary
|
|
20472
|
+
* @param context.name - Human-readable bucket name; becomes the directory prefix
|
|
20473
|
+
* @returns Wrapped function with the same signature as `T`, plus an async `clear()` method
|
|
20474
|
+
* that deletes persisted records from disk and disposes the memoized instance
|
|
20475
|
+
*
|
|
20476
|
+
* @example
|
|
20477
|
+
* ```typescript
|
|
20478
|
+
* const fetchSignal = async (symbol: string, when: Date) => { ... };
|
|
20479
|
+
* const fireOnce = Interval.file(fetchSignal, { interval: "1h", name: "fetchSignal" });
|
|
20480
|
+
* await fireOnce.clear(); // delete disk records so the function fires again next call
|
|
20481
|
+
* ```
|
|
20482
|
+
*/
|
|
20483
|
+
file: <T extends object>(run: TIntervalFn<T>, context: {
|
|
20484
|
+
interval: CandleInterval;
|
|
20485
|
+
name: string;
|
|
20486
|
+
}) => TIntervalWrappedFn<T> & {
|
|
20487
|
+
clear(): Promise<void>;
|
|
20488
|
+
};
|
|
20489
|
+
/**
|
|
20490
|
+
* Dispose (remove) the memoized `IntervalFnInstance` for a specific function.
|
|
20491
|
+
*
|
|
20492
|
+
* Removes the instance from the internal memoization cache, discarding all in-memory
|
|
20493
|
+
* fired-interval state across all contexts for that function.
|
|
20494
|
+
* The next call to the wrapped function will create a fresh `IntervalFnInstance`.
|
|
20495
|
+
*
|
|
20496
|
+
* @param run - Function whose `IntervalFnInstance` should be disposed
|
|
20497
|
+
*
|
|
20498
|
+
* @example
|
|
20499
|
+
* ```typescript
|
|
20500
|
+
* const fireOnce = Interval.fn(mySignalFn, { interval: "1h" });
|
|
20501
|
+
* Interval.dispose(mySignalFn);
|
|
20502
|
+
* ```
|
|
20503
|
+
*/
|
|
20504
|
+
dispose: (run: TIntervalFn<object>) => void;
|
|
20505
|
+
/**
|
|
20506
|
+
* Clears all memoized `IntervalFnInstance` and `IntervalFileInstance` objects and
|
|
20507
|
+
* resets the `IntervalFileInstance` index counter.
|
|
20508
|
+
* Call this when `process.cwd()` changes between strategy iterations
|
|
20509
|
+
* so new instances are created with the updated base path.
|
|
20510
|
+
*/
|
|
20511
|
+
clear: () => void;
|
|
20512
|
+
}
|
|
20513
|
+
/**
|
|
20514
|
+
* Singleton instance of `IntervalUtils` for convenient once-per-interval signal firing.
|
|
20515
|
+
*
|
|
20516
|
+
* @example
|
|
20517
|
+
* ```typescript
|
|
20518
|
+
* import { Interval } from "./classes/Interval";
|
|
20519
|
+
*
|
|
20520
|
+
* // In-memory: fires once per hour, resets on process restart
|
|
20521
|
+
* const fireOnce = Interval.fn(mySignalFn, { interval: "1h" });
|
|
20522
|
+
*
|
|
20523
|
+
* // Persistent: fired state survives restarts
|
|
20524
|
+
* const fireOncePersist = Interval.file(mySignalFn, { interval: "1h", name: "mySignal" });
|
|
20525
|
+
* ```
|
|
20526
|
+
*/
|
|
20527
|
+
declare const Interval: IntervalUtils;
|
|
20528
|
+
|
|
20025
20529
|
/**
|
|
20026
20530
|
* Type alias for column configuration used in breakeven markdown reports.
|
|
20027
20531
|
*
|
|
@@ -24785,6 +25289,74 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
24785
25289
|
exchangeName: ExchangeName;
|
|
24786
25290
|
frameName: FrameName;
|
|
24787
25291
|
}) => Promise<number | null>;
|
|
25292
|
+
/**
|
|
25293
|
+
* Returns the distance in PnL percentage between the current price and the highest profit peak.
|
|
25294
|
+
*
|
|
25295
|
+
* Resolves current price via priceMetaService and delegates to
|
|
25296
|
+
* ClientStrategy.getPositionHighestProfitDistancePnlPercentage().
|
|
25297
|
+
* Returns null if no pending signal exists.
|
|
25298
|
+
*
|
|
25299
|
+
* @param backtest - Whether running in backtest mode
|
|
25300
|
+
* @param symbol - Trading pair symbol
|
|
25301
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
25302
|
+
* @returns Promise resolving to drawdown distance in PnL% (≥ 0) or null
|
|
25303
|
+
*/
|
|
25304
|
+
getPositionHighestProfitDistancePnlPercentage: (backtest: boolean, symbol: string, context: {
|
|
25305
|
+
strategyName: StrategyName;
|
|
25306
|
+
exchangeName: ExchangeName;
|
|
25307
|
+
frameName: FrameName;
|
|
25308
|
+
}) => Promise<number | null>;
|
|
25309
|
+
/**
|
|
25310
|
+
* Returns the distance in PnL cost between the current price and the highest profit peak.
|
|
25311
|
+
*
|
|
25312
|
+
* Resolves current price via priceMetaService and delegates to
|
|
25313
|
+
* ClientStrategy.getPositionHighestProfitDistancePnlCost().
|
|
25314
|
+
* Returns null if no pending signal exists.
|
|
25315
|
+
*
|
|
25316
|
+
* @param backtest - Whether running in backtest mode
|
|
25317
|
+
* @param symbol - Trading pair symbol
|
|
25318
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
25319
|
+
* @returns Promise resolving to drawdown distance in PnL cost (≥ 0) or null
|
|
25320
|
+
*/
|
|
25321
|
+
getPositionHighestProfitDistancePnlCost: (backtest: boolean, symbol: string, context: {
|
|
25322
|
+
strategyName: StrategyName;
|
|
25323
|
+
exchangeName: ExchangeName;
|
|
25324
|
+
frameName: FrameName;
|
|
25325
|
+
}) => Promise<number | null>;
|
|
25326
|
+
/**
|
|
25327
|
+
* Returns the distance in PnL percentage between the current price and the worst drawdown trough.
|
|
25328
|
+
*
|
|
25329
|
+
* Resolves current price via priceMetaService and delegates to
|
|
25330
|
+
* ClientStrategy.getPositionHighestMaxDrawdownPnlPercentage().
|
|
25331
|
+
* Returns null if no pending signal exists.
|
|
25332
|
+
*
|
|
25333
|
+
* @param backtest - Whether running in backtest mode
|
|
25334
|
+
* @param symbol - Trading pair symbol
|
|
25335
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
25336
|
+
* @returns Promise resolving to recovery distance in PnL% (≥ 0) or null
|
|
25337
|
+
*/
|
|
25338
|
+
getPositionHighestMaxDrawdownPnlPercentage: (backtest: boolean, symbol: string, context: {
|
|
25339
|
+
strategyName: StrategyName;
|
|
25340
|
+
exchangeName: ExchangeName;
|
|
25341
|
+
frameName: FrameName;
|
|
25342
|
+
}) => Promise<number | null>;
|
|
25343
|
+
/**
|
|
25344
|
+
* Returns the distance in PnL cost between the current price and the worst drawdown trough.
|
|
25345
|
+
*
|
|
25346
|
+
* Resolves current price via priceMetaService and delegates to
|
|
25347
|
+
* ClientStrategy.getPositionHighestMaxDrawdownPnlCost().
|
|
25348
|
+
* Returns null if no pending signal exists.
|
|
25349
|
+
*
|
|
25350
|
+
* @param backtest - Whether running in backtest mode
|
|
25351
|
+
* @param symbol - Trading pair symbol
|
|
25352
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
25353
|
+
* @returns Promise resolving to recovery distance in PnL cost (≥ 0) or null
|
|
25354
|
+
*/
|
|
25355
|
+
getPositionHighestMaxDrawdownPnlCost: (backtest: boolean, symbol: string, context: {
|
|
25356
|
+
strategyName: StrategyName;
|
|
25357
|
+
exchangeName: ExchangeName;
|
|
25358
|
+
frameName: FrameName;
|
|
25359
|
+
}) => Promise<number | null>;
|
|
24788
25360
|
/**
|
|
24789
25361
|
* Disposes the ClientStrategy instance for the given context.
|
|
24790
25362
|
*
|
|
@@ -26956,6 +27528,70 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
26956
27528
|
exchangeName: ExchangeName;
|
|
26957
27529
|
frameName: FrameName;
|
|
26958
27530
|
}) => Promise<number | null>;
|
|
27531
|
+
/**
|
|
27532
|
+
* Returns the distance in PnL percentage between the current price and the highest profit peak.
|
|
27533
|
+
*
|
|
27534
|
+
* Delegates to StrategyConnectionService.getPositionHighestProfitDistancePnlPercentage().
|
|
27535
|
+
* Returns null if no pending signal exists.
|
|
27536
|
+
*
|
|
27537
|
+
* @param backtest - Whether running in backtest mode
|
|
27538
|
+
* @param symbol - Trading pair symbol
|
|
27539
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
27540
|
+
* @returns Promise resolving to drawdown distance in PnL% (≥ 0) or null
|
|
27541
|
+
*/
|
|
27542
|
+
getPositionHighestProfitDistancePnlPercentage: (backtest: boolean, symbol: string, context: {
|
|
27543
|
+
strategyName: StrategyName;
|
|
27544
|
+
exchangeName: ExchangeName;
|
|
27545
|
+
frameName: FrameName;
|
|
27546
|
+
}) => Promise<number | null>;
|
|
27547
|
+
/**
|
|
27548
|
+
* Returns the distance in PnL cost between the current price and the highest profit peak.
|
|
27549
|
+
*
|
|
27550
|
+
* Delegates to StrategyConnectionService.getPositionHighestProfitDistancePnlCost().
|
|
27551
|
+
* Returns null if no pending signal exists.
|
|
27552
|
+
*
|
|
27553
|
+
* @param backtest - Whether running in backtest mode
|
|
27554
|
+
* @param symbol - Trading pair symbol
|
|
27555
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
27556
|
+
* @returns Promise resolving to drawdown distance in PnL cost (≥ 0) or null
|
|
27557
|
+
*/
|
|
27558
|
+
getPositionHighestProfitDistancePnlCost: (backtest: boolean, symbol: string, context: {
|
|
27559
|
+
strategyName: StrategyName;
|
|
27560
|
+
exchangeName: ExchangeName;
|
|
27561
|
+
frameName: FrameName;
|
|
27562
|
+
}) => Promise<number | null>;
|
|
27563
|
+
/**
|
|
27564
|
+
* Returns the distance in PnL percentage between the current price and the worst drawdown trough.
|
|
27565
|
+
*
|
|
27566
|
+
* Delegates to StrategyConnectionService.getPositionHighestMaxDrawdownPnlPercentage().
|
|
27567
|
+
* Returns null if no pending signal exists.
|
|
27568
|
+
*
|
|
27569
|
+
* @param backtest - Whether running in backtest mode
|
|
27570
|
+
* @param symbol - Trading pair symbol
|
|
27571
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
27572
|
+
* @returns Promise resolving to recovery distance in PnL% (≥ 0) or null
|
|
27573
|
+
*/
|
|
27574
|
+
getPositionHighestMaxDrawdownPnlPercentage: (backtest: boolean, symbol: string, context: {
|
|
27575
|
+
strategyName: StrategyName;
|
|
27576
|
+
exchangeName: ExchangeName;
|
|
27577
|
+
frameName: FrameName;
|
|
27578
|
+
}) => Promise<number | null>;
|
|
27579
|
+
/**
|
|
27580
|
+
* Returns the distance in PnL cost between the current price and the worst drawdown trough.
|
|
27581
|
+
*
|
|
27582
|
+
* Delegates to StrategyConnectionService.getPositionHighestMaxDrawdownPnlCost().
|
|
27583
|
+
* Returns null if no pending signal exists.
|
|
27584
|
+
*
|
|
27585
|
+
* @param backtest - Whether running in backtest mode
|
|
27586
|
+
* @param symbol - Trading pair symbol
|
|
27587
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
27588
|
+
* @returns Promise resolving to recovery distance in PnL cost (≥ 0) or null
|
|
27589
|
+
*/
|
|
27590
|
+
getPositionHighestMaxDrawdownPnlCost: (backtest: boolean, symbol: string, context: {
|
|
27591
|
+
strategyName: StrategyName;
|
|
27592
|
+
exchangeName: ExchangeName;
|
|
27593
|
+
frameName: FrameName;
|
|
27594
|
+
}) => Promise<number | null>;
|
|
26959
27595
|
}
|
|
26960
27596
|
|
|
26961
27597
|
/**
|
|
@@ -29807,4 +30443,4 @@ declare const getTotalClosed: (signal: Signal) => {
|
|
|
29807
30443
|
remainingCostBasis: number;
|
|
29808
30444
|
};
|
|
29809
30445
|
|
|
29810
|
-
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 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, 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, PersistLogAdapter, PersistMeasureAdapter, PersistMemoryAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PersistStorageAdapter, 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, getPositionHighestPnlCost, getPositionHighestPnlPercentage, getPositionHighestProfitBreakeven, 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 };
|
|
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 TIntervalFn, 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 };
|