backtest-kit 6.5.1 → 6.7.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 +1858 -111
- package/build/index.mjs +1849 -112
- package/package.json +2 -2
- package/types.d.ts +1031 -132
package/types.d.ts
CHANGED
|
@@ -2235,6 +2235,19 @@ interface ISignalRow extends ISignalDto {
|
|
|
2235
2235
|
pnlPercentage: number;
|
|
2236
2236
|
pnlCost: number;
|
|
2237
2237
|
};
|
|
2238
|
+
/**
|
|
2239
|
+
* Worst price seen in loss direction during the life of this position.
|
|
2240
|
+
* Initialized at position open with priceOpen/pendingAt (pnl = 0).
|
|
2241
|
+
* Updated on every tick/candle when price moves toward SL (currentDistance < 0).
|
|
2242
|
+
* - For LONG: minimum VWAP price seen below effective entry
|
|
2243
|
+
* - For SHORT: maximum VWAP price seen above effective entry
|
|
2244
|
+
*/
|
|
2245
|
+
_fall: {
|
|
2246
|
+
price: number;
|
|
2247
|
+
timestamp: number;
|
|
2248
|
+
pnlPercentage: number;
|
|
2249
|
+
pnlCost: number;
|
|
2250
|
+
};
|
|
2238
2251
|
/** Unix timestamp in milliseconds when this signal was created/scheduled in backtest context or when getSignal was called in live context (before validation) */
|
|
2239
2252
|
timestamp: number;
|
|
2240
2253
|
}
|
|
@@ -3502,6 +3515,68 @@ interface IStrategy {
|
|
|
3502
3515
|
* @returns Promise resolving to drawdown duration in minutes or null
|
|
3503
3516
|
*/
|
|
3504
3517
|
getPositionDrawdownMinutes: (symbol: string, timestamp: number) => Promise<number | null>;
|
|
3518
|
+
/**
|
|
3519
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
3520
|
+
*
|
|
3521
|
+
* Alias for getPositionDrawdownMinutes — measures how long the position has been
|
|
3522
|
+
* pulling back from its peak profit level.
|
|
3523
|
+
*
|
|
3524
|
+
* Returns null if no pending signal exists.
|
|
3525
|
+
*
|
|
3526
|
+
* @param symbol - Trading pair symbol
|
|
3527
|
+
* @param timestamp - Current Unix timestamp in milliseconds
|
|
3528
|
+
* @returns Promise resolving to minutes since last profit peak or null
|
|
3529
|
+
*/
|
|
3530
|
+
getPositionHighestProfitMinutes: (symbol: string, timestamp: number) => Promise<number | null>;
|
|
3531
|
+
/**
|
|
3532
|
+
* Returns the number of minutes elapsed since the worst loss price was recorded.
|
|
3533
|
+
*
|
|
3534
|
+
* Measures how long ago the deepest drawdown point occurred.
|
|
3535
|
+
* Zero when called at the exact moment the trough was set.
|
|
3536
|
+
*
|
|
3537
|
+
* Returns null if no pending signal exists.
|
|
3538
|
+
*
|
|
3539
|
+
* @param symbol - Trading pair symbol
|
|
3540
|
+
* @param timestamp - Current Unix timestamp in milliseconds
|
|
3541
|
+
* @returns Promise resolving to minutes since last drawdown trough or null
|
|
3542
|
+
*/
|
|
3543
|
+
getPositionMaxDrawdownMinutes: (symbol: string, timestamp: number) => Promise<number | null>;
|
|
3544
|
+
/**
|
|
3545
|
+
* Returns the worst price reached in the loss direction during this position's life.
|
|
3546
|
+
*
|
|
3547
|
+
* Returns null if no pending signal exists.
|
|
3548
|
+
*
|
|
3549
|
+
* @param symbol - Trading pair symbol
|
|
3550
|
+
* @returns Promise resolving to price or null
|
|
3551
|
+
*/
|
|
3552
|
+
getPositionMaxDrawdownPrice: (symbol: string) => Promise<number | null>;
|
|
3553
|
+
/**
|
|
3554
|
+
* Returns the timestamp when the worst loss price was recorded during this position's life.
|
|
3555
|
+
*
|
|
3556
|
+
* Returns null if no pending signal exists.
|
|
3557
|
+
*
|
|
3558
|
+
* @param symbol - Trading pair symbol
|
|
3559
|
+
* @returns Promise resolving to timestamp in milliseconds or null
|
|
3560
|
+
*/
|
|
3561
|
+
getPositionMaxDrawdownTimestamp: (symbol: string) => Promise<number | null>;
|
|
3562
|
+
/**
|
|
3563
|
+
* Returns the PnL percentage at the moment the worst loss price was recorded during this position's life.
|
|
3564
|
+
*
|
|
3565
|
+
* Returns null if no pending signal exists.
|
|
3566
|
+
*
|
|
3567
|
+
* @param symbol - Trading pair symbol
|
|
3568
|
+
* @returns Promise resolving to PnL percentage or null
|
|
3569
|
+
*/
|
|
3570
|
+
getPositionMaxDrawdownPnlPercentage: (symbol: string) => Promise<number | null>;
|
|
3571
|
+
/**
|
|
3572
|
+
* Returns the PnL cost (in quote currency) at the moment the worst loss price was recorded during this position's life.
|
|
3573
|
+
*
|
|
3574
|
+
* Returns null if no pending signal exists.
|
|
3575
|
+
*
|
|
3576
|
+
* @param symbol - Trading pair symbol
|
|
3577
|
+
* @returns Promise resolving to PnL cost or null
|
|
3578
|
+
*/
|
|
3579
|
+
getPositionMaxDrawdownPnlCost: (symbol: string) => Promise<number | null>;
|
|
3505
3580
|
/**
|
|
3506
3581
|
* Disposes the strategy instance and cleans up resources.
|
|
3507
3582
|
*
|
|
@@ -4106,6 +4181,10 @@ interface BacktestStatisticsModel {
|
|
|
4106
4181
|
certaintyRatio: number | null;
|
|
4107
4182
|
/** Expected yearly returns based on average trade duration and PNL, null if unsafe. Higher is better. */
|
|
4108
4183
|
expectedYearlyReturns: number | null;
|
|
4184
|
+
/** Average peak PNL percentage across all signals (_peak.pnlPercentage), null if unsafe. Higher is better. */
|
|
4185
|
+
avgPeakPnl: number | null;
|
|
4186
|
+
/** Average fall PNL percentage across all signals (_fall.pnlPercentage), null if unsafe. Lower (more negative) means deeper drawdowns. */
|
|
4187
|
+
avgFallPnl: number | null;
|
|
4109
4188
|
}
|
|
4110
4189
|
|
|
4111
4190
|
/**
|
|
@@ -5349,6 +5428,115 @@ declare function getPositionHighestProfitBreakeven(symbol: string): Promise<bool
|
|
|
5349
5428
|
* ```
|
|
5350
5429
|
*/
|
|
5351
5430
|
declare function getPositionDrawdownMinutes(symbol: string): Promise<number>;
|
|
5431
|
+
/**
|
|
5432
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
5433
|
+
*
|
|
5434
|
+
* Alias for getPositionDrawdownMinutes — measures how long the position has been
|
|
5435
|
+
* pulling back from its peak profit level.
|
|
5436
|
+
* Zero when called at the exact moment the peak was set.
|
|
5437
|
+
*
|
|
5438
|
+
* Returns null if no pending signal exists.
|
|
5439
|
+
*
|
|
5440
|
+
* @param symbol - Trading pair symbol
|
|
5441
|
+
* @returns Promise resolving to minutes since last profit peak or null
|
|
5442
|
+
*
|
|
5443
|
+
* @example
|
|
5444
|
+
* ```typescript
|
|
5445
|
+
* import { getPositionHighestProfitMinutes } from "backtest-kit";
|
|
5446
|
+
*
|
|
5447
|
+
* const minutes = await getPositionHighestProfitMinutes("BTCUSDT");
|
|
5448
|
+
* // e.g. 30 (30 minutes since the highest profit price)
|
|
5449
|
+
* ```
|
|
5450
|
+
*/
|
|
5451
|
+
declare function getPositionHighestProfitMinutes(symbol: string): Promise<number>;
|
|
5452
|
+
/**
|
|
5453
|
+
* Returns the number of minutes elapsed since the worst loss price was recorded.
|
|
5454
|
+
*
|
|
5455
|
+
* Measures how long ago the deepest drawdown point occurred.
|
|
5456
|
+
* Zero when called at the exact moment the trough was set.
|
|
5457
|
+
*
|
|
5458
|
+
* Returns null if no pending signal exists.
|
|
5459
|
+
*
|
|
5460
|
+
* @param symbol - Trading pair symbol
|
|
5461
|
+
* @returns Promise resolving to minutes since last drawdown trough or null
|
|
5462
|
+
*
|
|
5463
|
+
* @example
|
|
5464
|
+
* ```typescript
|
|
5465
|
+
* import { getPositionMaxDrawdownMinutes } from "backtest-kit";
|
|
5466
|
+
*
|
|
5467
|
+
* const minutes = await getPositionMaxDrawdownMinutes("BTCUSDT");
|
|
5468
|
+
* // e.g. 15 (15 minutes since the worst loss price)
|
|
5469
|
+
* ```
|
|
5470
|
+
*/
|
|
5471
|
+
declare function getPositionMaxDrawdownMinutes(symbol: string): Promise<number>;
|
|
5472
|
+
/**
|
|
5473
|
+
* Returns the worst price reached in the loss direction during this position's life.
|
|
5474
|
+
*
|
|
5475
|
+
* Returns null if no pending signal exists.
|
|
5476
|
+
*
|
|
5477
|
+
* @param symbol - Trading pair symbol
|
|
5478
|
+
* @returns Promise resolving to price or null
|
|
5479
|
+
*
|
|
5480
|
+
* @example
|
|
5481
|
+
* ```typescript
|
|
5482
|
+
* import { getPositionMaxDrawdownPrice } from "backtest-kit";
|
|
5483
|
+
*
|
|
5484
|
+
* const price = await getPositionMaxDrawdownPrice("BTCUSDT");
|
|
5485
|
+
* // e.g. 41000 (lowest price seen for a LONG position)
|
|
5486
|
+
* ```
|
|
5487
|
+
*/
|
|
5488
|
+
declare function getPositionMaxDrawdownPrice(symbol: string): Promise<number>;
|
|
5489
|
+
/**
|
|
5490
|
+
* Returns the timestamp when the worst loss price was recorded during this position's life.
|
|
5491
|
+
*
|
|
5492
|
+
* Returns null if no pending signal exists.
|
|
5493
|
+
*
|
|
5494
|
+
* @param symbol - Trading pair symbol
|
|
5495
|
+
* @returns Promise resolving to timestamp in milliseconds or null
|
|
5496
|
+
*
|
|
5497
|
+
* @example
|
|
5498
|
+
* ```typescript
|
|
5499
|
+
* import { getPositionMaxDrawdownTimestamp } from "backtest-kit";
|
|
5500
|
+
*
|
|
5501
|
+
* const ts = await getPositionMaxDrawdownTimestamp("BTCUSDT");
|
|
5502
|
+
* // e.g. 1700000000000
|
|
5503
|
+
* ```
|
|
5504
|
+
*/
|
|
5505
|
+
declare function getPositionMaxDrawdownTimestamp(symbol: string): Promise<number>;
|
|
5506
|
+
/**
|
|
5507
|
+
* Returns the PnL percentage at the moment the worst loss price was recorded during this position's life.
|
|
5508
|
+
*
|
|
5509
|
+
* Returns null if no pending signal exists.
|
|
5510
|
+
*
|
|
5511
|
+
* @param symbol - Trading pair symbol
|
|
5512
|
+
* @returns Promise resolving to PnL percentage or null
|
|
5513
|
+
*
|
|
5514
|
+
* @example
|
|
5515
|
+
* ```typescript
|
|
5516
|
+
* import { getPositionMaxDrawdownPnlPercentage } from "backtest-kit";
|
|
5517
|
+
*
|
|
5518
|
+
* const pnl = await getPositionMaxDrawdownPnlPercentage("BTCUSDT");
|
|
5519
|
+
* // e.g. -5.2 (deepest PnL percentage reached)
|
|
5520
|
+
* ```
|
|
5521
|
+
*/
|
|
5522
|
+
declare function getPositionMaxDrawdownPnlPercentage(symbol: string): Promise<number>;
|
|
5523
|
+
/**
|
|
5524
|
+
* Returns the PnL cost (in quote currency) at the moment the worst loss price was recorded during this position's life.
|
|
5525
|
+
*
|
|
5526
|
+
* Returns null if no pending signal exists.
|
|
5527
|
+
*
|
|
5528
|
+
* @param symbol - Trading pair symbol
|
|
5529
|
+
* @returns Promise resolving to PnL cost or null
|
|
5530
|
+
*
|
|
5531
|
+
* @example
|
|
5532
|
+
* ```typescript
|
|
5533
|
+
* import { getPositionMaxDrawdownPnlCost } from "backtest-kit";
|
|
5534
|
+
*
|
|
5535
|
+
* const cost = await getPositionMaxDrawdownPnlCost("BTCUSDT");
|
|
5536
|
+
* // e.g. -52 (deepest PnL in quote currency)
|
|
5537
|
+
* ```
|
|
5538
|
+
*/
|
|
5539
|
+
declare function getPositionMaxDrawdownPnlCost(symbol: string): Promise<number>;
|
|
5352
5540
|
/**
|
|
5353
5541
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
5354
5542
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -5653,6 +5841,13 @@ declare const GLOBAL_CONFIG: {
|
|
|
5653
5841
|
* Default: 250 events
|
|
5654
5842
|
*/
|
|
5655
5843
|
CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS: number;
|
|
5844
|
+
/**
|
|
5845
|
+
* Maximum number of events to keep in max drawdown markdown report storage.
|
|
5846
|
+
* Older events are removed (FIFO) when this limit is exceeded.
|
|
5847
|
+
*
|
|
5848
|
+
* Default: 250 events
|
|
5849
|
+
*/
|
|
5850
|
+
CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS: number;
|
|
5656
5851
|
/**
|
|
5657
5852
|
* Maximum number of events to keep in live markdown report storage.
|
|
5658
5853
|
* Older events are removed (FIFO) when this limit is exceeded.
|
|
@@ -5807,6 +6002,8 @@ declare const COLUMN_CONFIG: {
|
|
|
5807
6002
|
sync_columns: ColumnModel<SyncEvent>[];
|
|
5808
6003
|
/** Columns for highest profit milestone tracking events */
|
|
5809
6004
|
highest_profit_columns: ColumnModel<HighestProfitEvent>[];
|
|
6005
|
+
/** Columns for max drawdown milestone tracking events */
|
|
6006
|
+
max_drawdown_columns: ColumnModel<MaxDrawdownEvent>[];
|
|
5810
6007
|
/** Walker: PnL summary columns */
|
|
5811
6008
|
walker_pnl_columns: ColumnModel<SignalData$1>[];
|
|
5812
6009
|
/** Walker: strategy-level summary columns */
|
|
@@ -5886,6 +6083,7 @@ declare function getConfig(): {
|
|
|
5886
6083
|
CC_MAX_BREAKEVEN_MARKDOWN_ROWS: number;
|
|
5887
6084
|
CC_MAX_HEATMAP_MARKDOWN_ROWS: number;
|
|
5888
6085
|
CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS: number;
|
|
6086
|
+
CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS: number;
|
|
5889
6087
|
CC_MAX_LIVE_MARKDOWN_ROWS: number;
|
|
5890
6088
|
CC_MAX_PARTIAL_MARKDOWN_ROWS: number;
|
|
5891
6089
|
CC_MAX_RISK_MARKDOWN_ROWS: number;
|
|
@@ -5941,6 +6139,7 @@ declare function getDefaultConfig(): Readonly<{
|
|
|
5941
6139
|
CC_MAX_BREAKEVEN_MARKDOWN_ROWS: number;
|
|
5942
6140
|
CC_MAX_HEATMAP_MARKDOWN_ROWS: number;
|
|
5943
6141
|
CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS: number;
|
|
6142
|
+
CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS: number;
|
|
5944
6143
|
CC_MAX_LIVE_MARKDOWN_ROWS: number;
|
|
5945
6144
|
CC_MAX_PARTIAL_MARKDOWN_ROWS: number;
|
|
5946
6145
|
CC_MAX_RISK_MARKDOWN_ROWS: number;
|
|
@@ -6010,6 +6209,7 @@ declare function getColumns(): {
|
|
|
6010
6209
|
strategy_columns: ColumnModel<StrategyEvent>[];
|
|
6011
6210
|
sync_columns: ColumnModel<SyncEvent>[];
|
|
6012
6211
|
highest_profit_columns: ColumnModel<HighestProfitEvent>[];
|
|
6212
|
+
max_drawdown_columns: ColumnModel<MaxDrawdownEvent>[];
|
|
6013
6213
|
walker_pnl_columns: ColumnModel<SignalData$1>[];
|
|
6014
6214
|
walker_strategy_columns: ColumnModel<IStrategyResult>[];
|
|
6015
6215
|
};
|
|
@@ -6039,6 +6239,7 @@ declare function getDefaultColumns(): Readonly<{
|
|
|
6039
6239
|
strategy_columns: ColumnModel<StrategyEvent>[];
|
|
6040
6240
|
sync_columns: ColumnModel<SyncEvent>[];
|
|
6041
6241
|
highest_profit_columns: ColumnModel<HighestProfitEvent>[];
|
|
6242
|
+
max_drawdown_columns: ColumnModel<MaxDrawdownEvent>[];
|
|
6042
6243
|
walker_pnl_columns: ColumnModel<SignalData$1>[];
|
|
6043
6244
|
walker_strategy_columns: ColumnModel<IStrategyResult>[];
|
|
6044
6245
|
}>;
|
|
@@ -7112,6 +7313,35 @@ interface HighestProfitContract {
|
|
|
7112
7313
|
backtest: boolean;
|
|
7113
7314
|
}
|
|
7114
7315
|
|
|
7316
|
+
/**
|
|
7317
|
+
* Contract for max drawdown updates emitted by the framework.
|
|
7318
|
+
* This contract defines the structure of the data emitted when a new maximum drawdown is reached for an open position.
|
|
7319
|
+
* It includes contextual information about the strategy, exchange, frame, and the associated signal.
|
|
7320
|
+
* Consumers can use this information to implement custom logic based on drawdown milestones (e.g. dynamic stop-loss adjustments, risk management).
|
|
7321
|
+
* The backtest flag allows consumers to differentiate between live and backtest updates for appropriate handling.
|
|
7322
|
+
* Max drawdown events are crucial for monitoring and managing risk, as they indicate the largest peak-to-trough decline in the position's value.
|
|
7323
|
+
* By tracking max drawdown, traders can make informed decisions to protect capital and optimize position management strategies.
|
|
7324
|
+
* The framework emits max drawdown updates whenever a new drawdown level is reached, allowing consumers to react in real-time to changing market conditions and position performance.
|
|
7325
|
+
*/
|
|
7326
|
+
interface MaxDrawdownContract {
|
|
7327
|
+
/** Trading symbol (e.g. "BTC/USDT") */
|
|
7328
|
+
symbol: string;
|
|
7329
|
+
/** Current price at the time of the max drawdown update */
|
|
7330
|
+
currentPrice: number;
|
|
7331
|
+
/** Timestamp of the max drawdown update (milliseconds since epoch) */
|
|
7332
|
+
timestamp: number;
|
|
7333
|
+
/** Strategy name for context */
|
|
7334
|
+
strategyName: StrategyName;
|
|
7335
|
+
/** Exchange name for context */
|
|
7336
|
+
exchangeName: ExchangeName;
|
|
7337
|
+
/** Frame name for context (e.g. "1m", "5m") */
|
|
7338
|
+
frameName: FrameName;
|
|
7339
|
+
/** Public signal data for the position associated with this max drawdown update */
|
|
7340
|
+
signal: IPublicSignalRow;
|
|
7341
|
+
/** Indicates if the update is from a backtest or live trading (true for backtest, false for live) */
|
|
7342
|
+
backtest: boolean;
|
|
7343
|
+
}
|
|
7344
|
+
|
|
7115
7345
|
/**
|
|
7116
7346
|
* Subscribes to all signal events with queued async processing.
|
|
7117
7347
|
*
|
|
@@ -8148,6 +8378,25 @@ declare function listenHighestProfit(fn: (event: HighestProfitContract) => void)
|
|
|
8148
8378
|
* @returns Unsubscribe function to cancel the listener before it fires
|
|
8149
8379
|
*/
|
|
8150
8380
|
declare function listenHighestProfitOnce(filterFn: (event: HighestProfitContract) => boolean, fn: (event: HighestProfitContract) => void): () => void;
|
|
8381
|
+
/**
|
|
8382
|
+
* Subscribes to max drawdown events with queued async processing.
|
|
8383
|
+
* Emits when a signal reaches a new maximum drawdown level during its lifecycle.
|
|
8384
|
+
* Events are processed sequentially in order received, even if callback is async.
|
|
8385
|
+
* Uses queued wrapper to prevent concurrent execution of the callback.
|
|
8386
|
+
* Useful for tracking drawdown milestones and implementing dynamic risk management logic.
|
|
8387
|
+
* @param fn - Callback function to handle max drawdown events
|
|
8388
|
+
* @return Unsubscribe function to stop listening to events
|
|
8389
|
+
*/
|
|
8390
|
+
declare function listenMaxDrawdown(fn: (event: MaxDrawdownContract) => void): () => void;
|
|
8391
|
+
/**
|
|
8392
|
+
* Subscribes to filtered max drawdown events with one-time execution.
|
|
8393
|
+
* Listens for events matching the filter predicate, then executes callback once
|
|
8394
|
+
* and automatically unsubscribes. Useful for waiting for specific drawdown conditions.
|
|
8395
|
+
* @param filterFn - Predicate to filter which events trigger the callback
|
|
8396
|
+
* @param fn - Callback function to handle the filtered event (called only once)
|
|
8397
|
+
* @return Unsubscribe function to cancel the listener before it fires
|
|
8398
|
+
*/
|
|
8399
|
+
declare function listenMaxDrawdownOnce(filterFn: (event: MaxDrawdownContract) => boolean, fn: (event: MaxDrawdownContract) => void): () => void;
|
|
8151
8400
|
|
|
8152
8401
|
/**
|
|
8153
8402
|
* Checks if trade context is active (execution and method contexts).
|
|
@@ -8743,6 +8992,52 @@ declare function dumpJson(dto: {
|
|
|
8743
8992
|
description: string;
|
|
8744
8993
|
}): Promise<void>;
|
|
8745
8994
|
|
|
8995
|
+
/**
|
|
8996
|
+
* Full context required to run a function inside both method and execution scopes.
|
|
8997
|
+
*
|
|
8998
|
+
* Combines `IMethodContext` (schema routing: exchange, strategy, frame names) with
|
|
8999
|
+
* `IExecutionContext` (runtime state: symbol, timestamp, backtest flag).
|
|
9000
|
+
*
|
|
9001
|
+
* Passed as a single object to `runInContextInternal`, which splits and distributes
|
|
9002
|
+
* the fields between `MethodContextService` and `ExecutionContextService`.
|
|
9003
|
+
*/
|
|
9004
|
+
interface IRunContext extends IMethodContext, IExecutionContext {
|
|
9005
|
+
}
|
|
9006
|
+
/**
|
|
9007
|
+
* A zero-argument function that may be synchronous or asynchronous.
|
|
9008
|
+
*
|
|
9009
|
+
* @template T - Return type of the function.
|
|
9010
|
+
*/
|
|
9011
|
+
type Function$1<T extends unknown = any> = () => T | Promise<T>;
|
|
9012
|
+
/**
|
|
9013
|
+
* Runs a function inside a mock method and execution context.
|
|
9014
|
+
*
|
|
9015
|
+
* Useful in tests and scripts that need to call context-dependent services
|
|
9016
|
+
* (e.g. `getBacktestTimeframe`) without a real backtest runner.
|
|
9017
|
+
*
|
|
9018
|
+
* All context fields are optional; the defaults produce a minimal live-mode
|
|
9019
|
+
* environment pointing at placeholder schema names:
|
|
9020
|
+
* - `exchangeName` → `"mock-exchange"`
|
|
9021
|
+
* - `strategyName` → `"mock-strategy"`
|
|
9022
|
+
* - `frameName` → `"mock-frame"`
|
|
9023
|
+
* - `symbol` → `"BTCUSDT"`
|
|
9024
|
+
* - `backtest` → `false` (live mode)
|
|
9025
|
+
* - `when` → current minute boundary (`alignToInterval(new Date(), "1m")`)
|
|
9026
|
+
*
|
|
9027
|
+
* @param run - Zero-argument function to execute within the context.
|
|
9028
|
+
* @param context - Partial `IRunContext`; any omitted field falls back to its default.
|
|
9029
|
+
* @returns Promise resolving to the return value of `run`.
|
|
9030
|
+
*
|
|
9031
|
+
* @example
|
|
9032
|
+
* ```typescript
|
|
9033
|
+
* const price = await runInMockContext(
|
|
9034
|
+
* () => getEffectivePrice("BTCUSDT"),
|
|
9035
|
+
* { exchangeName: "binance", strategyName: "my-strategy", frameName: "1d" },
|
|
9036
|
+
* );
|
|
9037
|
+
* ```
|
|
9038
|
+
*/
|
|
9039
|
+
declare function runInMockContext<T extends unknown = any>(run: Function$1<T>, { exchangeName, frameName, strategyName, symbol, backtest: isBacktest, when, }: Partial<IRunContext>): Promise<T>;
|
|
9040
|
+
|
|
8746
9041
|
/**
|
|
8747
9042
|
* Portfolio heatmap statistics for a single symbol.
|
|
8748
9043
|
* Aggregated metrics across all strategies for one trading pair.
|
|
@@ -8780,6 +9075,10 @@ interface IHeatmapRow {
|
|
|
8780
9075
|
maxLossStreak: number;
|
|
8781
9076
|
/** Expectancy: (winRate * avgWin) - (lossRate * avgLoss) */
|
|
8782
9077
|
expectancy: number | null;
|
|
9078
|
+
/** Average peak PNL percentage across all trades (_peak.pnlPercentage). Higher is better. */
|
|
9079
|
+
avgPeakPnl: number | null;
|
|
9080
|
+
/** Average fall PNL percentage across all trades (_fall.pnlPercentage). Closer to 0 is better. */
|
|
9081
|
+
avgFallPnl: number | null;
|
|
8783
9082
|
}
|
|
8784
9083
|
|
|
8785
9084
|
/**
|
|
@@ -10065,6 +10364,10 @@ interface TickEvent {
|
|
|
10065
10364
|
pendingAt?: number;
|
|
10066
10365
|
/** Timestamp when signal was created/scheduled (only for scheduled/waiting/opened/active/closed/cancelled) */
|
|
10067
10366
|
scheduledAt?: number;
|
|
10367
|
+
/** Peak PNL percentage at best price during position (_peak.pnlPercentage, only for closed) */
|
|
10368
|
+
peakPnl?: number;
|
|
10369
|
+
/** Fall PNL percentage at worst price during position (_fall.pnlPercentage, only for closed) */
|
|
10370
|
+
fallPnl?: number;
|
|
10068
10371
|
}
|
|
10069
10372
|
/**
|
|
10070
10373
|
* Statistical data calculated from live trading results.
|
|
@@ -10116,6 +10419,10 @@ interface LiveStatisticsModel {
|
|
|
10116
10419
|
certaintyRatio: number | null;
|
|
10117
10420
|
/** Expected yearly returns based on average trade duration and PNL, null if unsafe. Higher is better. */
|
|
10118
10421
|
expectedYearlyReturns: number | null;
|
|
10422
|
+
/** Average peak PNL percentage across all closed signals (_peak.pnlPercentage), null if unsafe. Higher is better. */
|
|
10423
|
+
avgPeakPnl: number | null;
|
|
10424
|
+
/** Average fall PNL percentage across all closed signals (_fall.pnlPercentage), null if unsafe. Closer to 0 is better. */
|
|
10425
|
+
avgFallPnl: number | null;
|
|
10119
10426
|
}
|
|
10120
10427
|
|
|
10121
10428
|
/**
|
|
@@ -10133,6 +10440,10 @@ interface HeatmapStatisticsModel {
|
|
|
10133
10440
|
portfolioSharpeRatio: number | null;
|
|
10134
10441
|
/** Portfolio-wide total trades */
|
|
10135
10442
|
portfolioTotalTrades: number;
|
|
10443
|
+
/** Trade-count-weighted average peak PNL across all symbols. Higher is better. */
|
|
10444
|
+
portfolioAvgPeakPnl: number | null;
|
|
10445
|
+
/** Trade-count-weighted average fall PNL across all symbols. Closer to 0 is better. */
|
|
10446
|
+
portfolioAvgFallPnl: number | null;
|
|
10136
10447
|
}
|
|
10137
10448
|
|
|
10138
10449
|
/**
|
|
@@ -10439,6 +10750,43 @@ interface HighestProfitStatisticsModel {
|
|
|
10439
10750
|
totalEvents: number;
|
|
10440
10751
|
}
|
|
10441
10752
|
|
|
10753
|
+
/**
|
|
10754
|
+
* Single max drawdown event recorded for a position.
|
|
10755
|
+
*/
|
|
10756
|
+
interface MaxDrawdownEvent {
|
|
10757
|
+
/** Unix timestamp in milliseconds when the record was set */
|
|
10758
|
+
timestamp: number;
|
|
10759
|
+
/** Trading pair symbol */
|
|
10760
|
+
symbol: string;
|
|
10761
|
+
/** Strategy name */
|
|
10762
|
+
strategyName: string;
|
|
10763
|
+
/** Signal unique identifier */
|
|
10764
|
+
signalId: string;
|
|
10765
|
+
/** Position direction */
|
|
10766
|
+
position: IPublicSignalRow["position"];
|
|
10767
|
+
/** Unrealized PNL at the time the record was set */
|
|
10768
|
+
pnl: IStrategyPnL;
|
|
10769
|
+
/** Record price reached in the loss direction */
|
|
10770
|
+
currentPrice: number;
|
|
10771
|
+
/** Effective entry price at the time of the update */
|
|
10772
|
+
priceOpen: number;
|
|
10773
|
+
/** Take profit price */
|
|
10774
|
+
priceTakeProfit: number;
|
|
10775
|
+
/** Stop loss price */
|
|
10776
|
+
priceStopLoss: number;
|
|
10777
|
+
/** Whether the event occurred in backtest mode */
|
|
10778
|
+
backtest: boolean;
|
|
10779
|
+
}
|
|
10780
|
+
/**
|
|
10781
|
+
* Aggregated statistics model for max drawdown events.
|
|
10782
|
+
*/
|
|
10783
|
+
interface MaxDrawdownStatisticsModel {
|
|
10784
|
+
/** Full list of recorded events (newest first) */
|
|
10785
|
+
eventList: MaxDrawdownEvent[];
|
|
10786
|
+
/** Total number of recorded events */
|
|
10787
|
+
totalEvents: number;
|
|
10788
|
+
}
|
|
10789
|
+
|
|
10442
10790
|
/**
|
|
10443
10791
|
* Risk rejection event data for report generation.
|
|
10444
10792
|
* Contains all information about rejected signals due to risk limits.
|
|
@@ -11836,6 +12184,8 @@ interface IReportTarget {
|
|
|
11836
12184
|
sync: boolean;
|
|
11837
12185
|
/** Enable highest profit milestone event logging */
|
|
11838
12186
|
highest_profit: boolean;
|
|
12187
|
+
/** Enable max drawdown milestone event logging */
|
|
12188
|
+
max_drawdown: boolean;
|
|
11839
12189
|
}
|
|
11840
12190
|
/**
|
|
11841
12191
|
* Union type of all valid report names.
|
|
@@ -11987,7 +12337,7 @@ declare class ReportUtils {
|
|
|
11987
12337
|
*
|
|
11988
12338
|
* @returns Cleanup function that unsubscribes from all enabled services
|
|
11989
12339
|
*/
|
|
11990
|
-
enable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, schedule, walker, strategy, sync, highest_profit, }?: Partial<IReportTarget>) => (...args: any[]) => any;
|
|
12340
|
+
enable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, schedule, walker, strategy, sync, highest_profit, max_drawdown, }?: Partial<IReportTarget>) => (...args: any[]) => any;
|
|
11991
12341
|
/**
|
|
11992
12342
|
* Disables report services selectively.
|
|
11993
12343
|
*
|
|
@@ -12024,7 +12374,7 @@ declare class ReportUtils {
|
|
|
12024
12374
|
* Report.disable();
|
|
12025
12375
|
* ```
|
|
12026
12376
|
*/
|
|
12027
|
-
disable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, schedule, walker, strategy, sync, highest_profit, }?: Partial<IReportTarget>) => void;
|
|
12377
|
+
disable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, schedule, walker, strategy, sync, highest_profit, max_drawdown, }?: Partial<IReportTarget>) => void;
|
|
12028
12378
|
}
|
|
12029
12379
|
/**
|
|
12030
12380
|
* Report adapter with pluggable storage backend and instance memoization.
|
|
@@ -12124,6 +12474,8 @@ interface IMarkdownTarget {
|
|
|
12124
12474
|
sync: boolean;
|
|
12125
12475
|
/** Enable highest profit milestone tracking reports */
|
|
12126
12476
|
highest_profit: boolean;
|
|
12477
|
+
/** Enable max drawdown milestone tracking reports */
|
|
12478
|
+
max_drawdown: boolean;
|
|
12127
12479
|
}
|
|
12128
12480
|
/** Symbol key for the singleshot waitForInit function on MarkdownFileBase instances. */
|
|
12129
12481
|
declare const WAIT_FOR_INIT_SYMBOL: unique symbol;
|
|
@@ -12321,7 +12673,7 @@ declare class MarkdownUtils {
|
|
|
12321
12673
|
*
|
|
12322
12674
|
* @returns Cleanup function that unsubscribes from all enabled services
|
|
12323
12675
|
*/
|
|
12324
|
-
enable: ({ backtest: bt, breakeven, heat, live, partial, performance, strategy, risk, schedule, walker, sync, highest_profit, }?: Partial<IMarkdownTarget>) => (...args: any[]) => any;
|
|
12676
|
+
enable: ({ backtest: bt, breakeven, heat, live, partial, performance, strategy, risk, schedule, walker, sync, highest_profit, max_drawdown, }?: Partial<IMarkdownTarget>) => (...args: any[]) => any;
|
|
12325
12677
|
/**
|
|
12326
12678
|
* Disables markdown report services selectively.
|
|
12327
12679
|
*
|
|
@@ -12359,7 +12711,7 @@ declare class MarkdownUtils {
|
|
|
12359
12711
|
* Markdown.disable();
|
|
12360
12712
|
* ```
|
|
12361
12713
|
*/
|
|
12362
|
-
disable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, strategy, schedule, walker, sync, highest_profit, }?: Partial<IMarkdownTarget>) => void;
|
|
12714
|
+
disable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, strategy, schedule, walker, sync, highest_profit, max_drawdown, }?: Partial<IMarkdownTarget>) => void;
|
|
12363
12715
|
}
|
|
12364
12716
|
/**
|
|
12365
12717
|
* Markdown adapter with pluggable storage backend and instance memoization.
|
|
@@ -12571,7 +12923,7 @@ declare const Log: LogAdapter;
|
|
|
12571
12923
|
* @see ColumnModel for the base interface
|
|
12572
12924
|
* @see IStrategyTickResultClosed for the signal data structure
|
|
12573
12925
|
*/
|
|
12574
|
-
type Columns$
|
|
12926
|
+
type Columns$b = ColumnModel<IStrategyTickResultClosed>;
|
|
12575
12927
|
/**
|
|
12576
12928
|
* Service for generating and saving backtest markdown reports.
|
|
12577
12929
|
*
|
|
@@ -12665,7 +13017,7 @@ declare class BacktestMarkdownService {
|
|
|
12665
13017
|
* console.log(markdown);
|
|
12666
13018
|
* ```
|
|
12667
13019
|
*/
|
|
12668
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
13020
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$b[]) => Promise<string>;
|
|
12669
13021
|
/**
|
|
12670
13022
|
* Saves symbol-strategy report to disk.
|
|
12671
13023
|
* Creates directory if it doesn't exist.
|
|
@@ -12690,7 +13042,7 @@ declare class BacktestMarkdownService {
|
|
|
12690
13042
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", true, "./custom/path");
|
|
12691
13043
|
* ```
|
|
12692
13044
|
*/
|
|
12693
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
13045
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$b[]) => Promise<void>;
|
|
12694
13046
|
/**
|
|
12695
13047
|
* Clears accumulated signal data from storage.
|
|
12696
13048
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -13231,61 +13583,152 @@ declare class BacktestUtils {
|
|
|
13231
13583
|
frameName: FrameName;
|
|
13232
13584
|
}) => Promise<number>;
|
|
13233
13585
|
/**
|
|
13234
|
-
*
|
|
13235
|
-
* Use this to prevent duplicate DCA entries at the same price area.
|
|
13586
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
13236
13587
|
*
|
|
13237
|
-
*
|
|
13238
|
-
*
|
|
13239
|
-
*
|
|
13588
|
+
* Alias for getPositionDrawdownMinutes — measures how long the position has been
|
|
13589
|
+
* pulling back from its peak profit level.
|
|
13590
|
+
* Zero when called at the exact moment the peak was set.
|
|
13591
|
+
*
|
|
13592
|
+
* Returns null if no pending signal exists.
|
|
13240
13593
|
*
|
|
13241
13594
|
* @param symbol - Trading pair symbol
|
|
13242
|
-
* @param currentPrice - Price to check against existing DCA levels
|
|
13243
13595
|
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
13244
|
-
* @
|
|
13245
|
-
* @returns true if price overlaps an existing entry level (DCA not recommended)
|
|
13596
|
+
* @returns Minutes since last profit peak, or null if no active position
|
|
13246
13597
|
*/
|
|
13247
|
-
|
|
13598
|
+
getPositionHighestProfitMinutes: (symbol: string, context: {
|
|
13248
13599
|
strategyName: StrategyName;
|
|
13249
13600
|
exchangeName: ExchangeName;
|
|
13250
13601
|
frameName: FrameName;
|
|
13251
|
-
}
|
|
13602
|
+
}) => Promise<number>;
|
|
13252
13603
|
/**
|
|
13253
|
-
*
|
|
13254
|
-
* Use this to prevent duplicate partial closes at the same price area.
|
|
13604
|
+
* Returns the number of minutes elapsed since the worst loss price was recorded.
|
|
13255
13605
|
*
|
|
13256
|
-
*
|
|
13257
|
-
*
|
|
13258
|
-
*
|
|
13606
|
+
* Measures how long ago the deepest drawdown point occurred.
|
|
13607
|
+
* Zero when called at the exact moment the trough was set.
|
|
13608
|
+
*
|
|
13609
|
+
* Returns null if no pending signal exists.
|
|
13259
13610
|
*
|
|
13260
13611
|
* @param symbol - Trading pair symbol
|
|
13261
|
-
* @param currentPrice - Price to check against existing partial close prices
|
|
13262
13612
|
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
13263
|
-
* @
|
|
13264
|
-
* @returns true if price overlaps an existing partial price (partial not recommended)
|
|
13613
|
+
* @returns Minutes since last drawdown trough, or null if no active position
|
|
13265
13614
|
*/
|
|
13266
|
-
|
|
13615
|
+
getPositionMaxDrawdownMinutes: (symbol: string, context: {
|
|
13267
13616
|
strategyName: StrategyName;
|
|
13268
13617
|
exchangeName: ExchangeName;
|
|
13269
13618
|
frameName: FrameName;
|
|
13270
|
-
}
|
|
13619
|
+
}) => Promise<number>;
|
|
13271
13620
|
/**
|
|
13272
|
-
*
|
|
13621
|
+
* Returns the worst price reached in the loss direction during this position's life.
|
|
13273
13622
|
*
|
|
13274
|
-
*
|
|
13275
|
-
* Current active signal (if any) will complete normally.
|
|
13276
|
-
* Backtest will stop at the next safe point (idle state or after signal closes).
|
|
13623
|
+
* Returns null if no pending signal exists.
|
|
13277
13624
|
*
|
|
13278
13625
|
* @param symbol - Trading pair symbol
|
|
13279
|
-
* @param
|
|
13280
|
-
* @
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
*
|
|
13626
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
13627
|
+
* @returns price or null if no active position
|
|
13628
|
+
*/
|
|
13629
|
+
getPositionMaxDrawdownPrice: (symbol: string, context: {
|
|
13630
|
+
strategyName: StrategyName;
|
|
13631
|
+
exchangeName: ExchangeName;
|
|
13632
|
+
frameName: FrameName;
|
|
13633
|
+
}) => Promise<number>;
|
|
13634
|
+
/**
|
|
13635
|
+
* Returns the timestamp when the worst loss price was recorded during this position's life.
|
|
13636
|
+
*
|
|
13637
|
+
* Returns null if no pending signal exists.
|
|
13638
|
+
*
|
|
13639
|
+
* @param symbol - Trading pair symbol
|
|
13640
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
13641
|
+
* @returns timestamp in milliseconds or null if no active position
|
|
13642
|
+
*/
|
|
13643
|
+
getPositionMaxDrawdownTimestamp: (symbol: string, context: {
|
|
13644
|
+
strategyName: StrategyName;
|
|
13645
|
+
exchangeName: ExchangeName;
|
|
13646
|
+
frameName: FrameName;
|
|
13647
|
+
}) => Promise<number>;
|
|
13648
|
+
/**
|
|
13649
|
+
* Returns the PnL percentage at the moment the worst loss price was recorded during this position's life.
|
|
13650
|
+
*
|
|
13651
|
+
* Returns null if no pending signal exists.
|
|
13652
|
+
*
|
|
13653
|
+
* @param symbol - Trading pair symbol
|
|
13654
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
13655
|
+
* @returns PnL percentage or null if no active position
|
|
13656
|
+
*/
|
|
13657
|
+
getPositionMaxDrawdownPnlPercentage: (symbol: string, context: {
|
|
13658
|
+
strategyName: StrategyName;
|
|
13659
|
+
exchangeName: ExchangeName;
|
|
13660
|
+
frameName: FrameName;
|
|
13661
|
+
}) => Promise<number>;
|
|
13662
|
+
/**
|
|
13663
|
+
* Returns the PnL cost (in quote currency) at the moment the worst loss price was recorded during this position's life.
|
|
13664
|
+
*
|
|
13665
|
+
* Returns null if no pending signal exists.
|
|
13666
|
+
*
|
|
13667
|
+
* @param symbol - Trading pair symbol
|
|
13668
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
13669
|
+
* @returns PnL cost or null if no active position
|
|
13670
|
+
*/
|
|
13671
|
+
getPositionMaxDrawdownPnlCost: (symbol: string, context: {
|
|
13672
|
+
strategyName: StrategyName;
|
|
13673
|
+
exchangeName: ExchangeName;
|
|
13674
|
+
frameName: FrameName;
|
|
13675
|
+
}) => Promise<number>;
|
|
13676
|
+
/**
|
|
13677
|
+
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
13678
|
+
* Use this to prevent duplicate DCA entries at the same price area.
|
|
13679
|
+
*
|
|
13680
|
+
* Returns true if currentPrice is within [level - lowerStep, level + upperStep] for any level,
|
|
13681
|
+
* where step = level * percent / 100.
|
|
13682
|
+
* Returns false if no pending signal exists.
|
|
13683
|
+
*
|
|
13684
|
+
* @param symbol - Trading pair symbol
|
|
13685
|
+
* @param currentPrice - Price to check against existing DCA levels
|
|
13686
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
13687
|
+
* @param ladder - Tolerance zone config; percentages in 0–100 format (default: 1.5% up and down)
|
|
13688
|
+
* @returns true if price overlaps an existing entry level (DCA not recommended)
|
|
13689
|
+
*/
|
|
13690
|
+
getPositionEntryOverlap: (symbol: string, currentPrice: number, context: {
|
|
13691
|
+
strategyName: StrategyName;
|
|
13692
|
+
exchangeName: ExchangeName;
|
|
13693
|
+
frameName: FrameName;
|
|
13694
|
+
}, ladder?: IPositionOverlapLadder) => Promise<boolean>;
|
|
13695
|
+
/**
|
|
13696
|
+
* Checks whether the current price falls within the tolerance zone of any existing partial close price.
|
|
13697
|
+
* Use this to prevent duplicate partial closes at the same price area.
|
|
13698
|
+
*
|
|
13699
|
+
* Returns true if currentPrice is within [partial.currentPrice - lowerStep, partial.currentPrice + upperStep]
|
|
13700
|
+
* for any partial, where step = partial.currentPrice * percent / 100.
|
|
13701
|
+
* Returns false if no pending signal exists or no partials have been executed yet.
|
|
13702
|
+
*
|
|
13703
|
+
* @param symbol - Trading pair symbol
|
|
13704
|
+
* @param currentPrice - Price to check against existing partial close prices
|
|
13705
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
13706
|
+
* @param ladder - Tolerance zone config; percentages in 0–100 format (default: 1.5% up and down)
|
|
13707
|
+
* @returns true if price overlaps an existing partial price (partial not recommended)
|
|
13708
|
+
*/
|
|
13709
|
+
getPositionPartialOverlap: (symbol: string, currentPrice: number, context: {
|
|
13710
|
+
strategyName: StrategyName;
|
|
13711
|
+
exchangeName: ExchangeName;
|
|
13712
|
+
frameName: FrameName;
|
|
13713
|
+
}, ladder?: IPositionOverlapLadder) => Promise<boolean>;
|
|
13714
|
+
/**
|
|
13715
|
+
* Stops the strategy from generating new signals.
|
|
13716
|
+
*
|
|
13717
|
+
* Sets internal flag to prevent strategy from opening new signals.
|
|
13718
|
+
* Current active signal (if any) will complete normally.
|
|
13719
|
+
* Backtest will stop at the next safe point (idle state or after signal closes).
|
|
13720
|
+
*
|
|
13721
|
+
* @param symbol - Trading pair symbol
|
|
13722
|
+
* @param strategyName - Strategy name to stop
|
|
13723
|
+
* @param context - Execution context with exchangeName and frameName
|
|
13724
|
+
* @returns Promise that resolves when stop flag is set
|
|
13725
|
+
*
|
|
13726
|
+
* @example
|
|
13727
|
+
* ```typescript
|
|
13728
|
+
* // Stop strategy after some condition
|
|
13729
|
+
* await Backtest.stop("BTCUSDT", "my-strategy", {
|
|
13730
|
+
* exchangeName: "binance",
|
|
13731
|
+
* frameName: "frame1",
|
|
13289
13732
|
* strategyName: "my-strategy"
|
|
13290
13733
|
* });
|
|
13291
13734
|
* ```
|
|
@@ -13747,7 +14190,7 @@ declare class BacktestUtils {
|
|
|
13747
14190
|
strategyName: StrategyName;
|
|
13748
14191
|
exchangeName: ExchangeName;
|
|
13749
14192
|
frameName: FrameName;
|
|
13750
|
-
}, columns?: Columns$
|
|
14193
|
+
}, columns?: Columns$b[]) => Promise<string>;
|
|
13751
14194
|
/**
|
|
13752
14195
|
* Saves strategy report to disk.
|
|
13753
14196
|
*
|
|
@@ -13778,7 +14221,7 @@ declare class BacktestUtils {
|
|
|
13778
14221
|
strategyName: StrategyName;
|
|
13779
14222
|
exchangeName: ExchangeName;
|
|
13780
14223
|
frameName: FrameName;
|
|
13781
|
-
}, path?: string, columns?: Columns$
|
|
14224
|
+
}, path?: string, columns?: Columns$b[]) => Promise<void>;
|
|
13782
14225
|
/**
|
|
13783
14226
|
* Lists all active backtest instances with their current status.
|
|
13784
14227
|
*
|
|
@@ -13852,7 +14295,7 @@ declare const Backtest: BacktestUtils;
|
|
|
13852
14295
|
* @see ColumnModel for the base interface
|
|
13853
14296
|
* @see TickEvent for the event data structure
|
|
13854
14297
|
*/
|
|
13855
|
-
type Columns$
|
|
14298
|
+
type Columns$a = ColumnModel<TickEvent>;
|
|
13856
14299
|
/**
|
|
13857
14300
|
* Service for generating and saving live trading markdown reports.
|
|
13858
14301
|
*
|
|
@@ -13979,7 +14422,7 @@ declare class LiveMarkdownService {
|
|
|
13979
14422
|
* console.log(markdown);
|
|
13980
14423
|
* ```
|
|
13981
14424
|
*/
|
|
13982
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
14425
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$a[]) => Promise<string>;
|
|
13983
14426
|
/**
|
|
13984
14427
|
* Saves symbol-strategy report to disk.
|
|
13985
14428
|
* Creates directory if it doesn't exist.
|
|
@@ -14004,7 +14447,7 @@ declare class LiveMarkdownService {
|
|
|
14004
14447
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
14005
14448
|
* ```
|
|
14006
14449
|
*/
|
|
14007
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
14450
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$a[]) => Promise<void>;
|
|
14008
14451
|
/**
|
|
14009
14452
|
* Clears accumulated event data from storage.
|
|
14010
14453
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -14503,6 +14946,91 @@ declare class LiveUtils {
|
|
|
14503
14946
|
strategyName: StrategyName;
|
|
14504
14947
|
exchangeName: ExchangeName;
|
|
14505
14948
|
}) => Promise<number>;
|
|
14949
|
+
/**
|
|
14950
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
14951
|
+
*
|
|
14952
|
+
* Alias for getPositionDrawdownMinutes — measures how long the position has been
|
|
14953
|
+
* pulling back from its peak profit level.
|
|
14954
|
+
* Zero when called at the exact moment the peak was set.
|
|
14955
|
+
*
|
|
14956
|
+
* Returns null if no pending signal exists.
|
|
14957
|
+
*
|
|
14958
|
+
* @param symbol - Trading pair symbol
|
|
14959
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
14960
|
+
* @returns Minutes since last profit peak, or null if no active position
|
|
14961
|
+
*/
|
|
14962
|
+
getPositionHighestProfitMinutes: (symbol: string, context: {
|
|
14963
|
+
strategyName: StrategyName;
|
|
14964
|
+
exchangeName: ExchangeName;
|
|
14965
|
+
}) => Promise<number>;
|
|
14966
|
+
/**
|
|
14967
|
+
* Returns the number of minutes elapsed since the worst loss price was recorded.
|
|
14968
|
+
*
|
|
14969
|
+
* Measures how long ago the deepest drawdown point occurred.
|
|
14970
|
+
* Zero when called at the exact moment the trough was set.
|
|
14971
|
+
*
|
|
14972
|
+
* Returns null if no pending signal exists.
|
|
14973
|
+
*
|
|
14974
|
+
* @param symbol - Trading pair symbol
|
|
14975
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
14976
|
+
* @returns Minutes since last drawdown trough, or null if no active position
|
|
14977
|
+
*/
|
|
14978
|
+
getPositionMaxDrawdownMinutes: (symbol: string, context: {
|
|
14979
|
+
strategyName: StrategyName;
|
|
14980
|
+
exchangeName: ExchangeName;
|
|
14981
|
+
}) => Promise<number>;
|
|
14982
|
+
/**
|
|
14983
|
+
* Returns the worst price reached in the loss direction during this position's life.
|
|
14984
|
+
*
|
|
14985
|
+
* Returns null if no pending signal exists.
|
|
14986
|
+
*
|
|
14987
|
+
* @param symbol - Trading pair symbol
|
|
14988
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
14989
|
+
* @returns price or null if no active position
|
|
14990
|
+
*/
|
|
14991
|
+
getPositionMaxDrawdownPrice: (symbol: string, context: {
|
|
14992
|
+
strategyName: StrategyName;
|
|
14993
|
+
exchangeName: ExchangeName;
|
|
14994
|
+
}) => Promise<number>;
|
|
14995
|
+
/**
|
|
14996
|
+
* Returns the timestamp when the worst loss price was recorded during this position's life.
|
|
14997
|
+
*
|
|
14998
|
+
* Returns null if no pending signal exists.
|
|
14999
|
+
*
|
|
15000
|
+
* @param symbol - Trading pair symbol
|
|
15001
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
15002
|
+
* @returns timestamp in milliseconds or null if no active position
|
|
15003
|
+
*/
|
|
15004
|
+
getPositionMaxDrawdownTimestamp: (symbol: string, context: {
|
|
15005
|
+
strategyName: StrategyName;
|
|
15006
|
+
exchangeName: ExchangeName;
|
|
15007
|
+
}) => Promise<number>;
|
|
15008
|
+
/**
|
|
15009
|
+
* Returns the PnL percentage at the moment the worst loss price was recorded during this position's life.
|
|
15010
|
+
*
|
|
15011
|
+
* Returns null if no pending signal exists.
|
|
15012
|
+
*
|
|
15013
|
+
* @param symbol - Trading pair symbol
|
|
15014
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
15015
|
+
* @returns PnL percentage or null if no active position
|
|
15016
|
+
*/
|
|
15017
|
+
getPositionMaxDrawdownPnlPercentage: (symbol: string, context: {
|
|
15018
|
+
strategyName: StrategyName;
|
|
15019
|
+
exchangeName: ExchangeName;
|
|
15020
|
+
}) => Promise<number>;
|
|
15021
|
+
/**
|
|
15022
|
+
* Returns the PnL cost (in quote currency) at the moment the worst loss price was recorded during this position's life.
|
|
15023
|
+
*
|
|
15024
|
+
* Returns null if no pending signal exists.
|
|
15025
|
+
*
|
|
15026
|
+
* @param symbol - Trading pair symbol
|
|
15027
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
15028
|
+
* @returns PnL cost or null if no active position
|
|
15029
|
+
*/
|
|
15030
|
+
getPositionMaxDrawdownPnlCost: (symbol: string, context: {
|
|
15031
|
+
strategyName: StrategyName;
|
|
15032
|
+
exchangeName: ExchangeName;
|
|
15033
|
+
}) => Promise<number>;
|
|
14506
15034
|
/**
|
|
14507
15035
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
14508
15036
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -14988,7 +15516,7 @@ declare class LiveUtils {
|
|
|
14988
15516
|
getReport: (symbol: string, context: {
|
|
14989
15517
|
strategyName: StrategyName;
|
|
14990
15518
|
exchangeName: ExchangeName;
|
|
14991
|
-
}, columns?: Columns$
|
|
15519
|
+
}, columns?: Columns$a[]) => Promise<string>;
|
|
14992
15520
|
/**
|
|
14993
15521
|
* Saves strategy report to disk.
|
|
14994
15522
|
*
|
|
@@ -15018,7 +15546,7 @@ declare class LiveUtils {
|
|
|
15018
15546
|
dump: (symbol: string, context: {
|
|
15019
15547
|
strategyName: StrategyName;
|
|
15020
15548
|
exchangeName: ExchangeName;
|
|
15021
|
-
}, path?: string, columns?: Columns$
|
|
15549
|
+
}, path?: string, columns?: Columns$a[]) => Promise<void>;
|
|
15022
15550
|
/**
|
|
15023
15551
|
* Lists all active live trading instances with their current status.
|
|
15024
15552
|
*
|
|
@@ -15088,7 +15616,7 @@ declare const Live: LiveUtils;
|
|
|
15088
15616
|
* @see ColumnModel for the base interface
|
|
15089
15617
|
* @see ScheduledEvent for the event data structure
|
|
15090
15618
|
*/
|
|
15091
|
-
type Columns$
|
|
15619
|
+
type Columns$9 = ColumnModel<ScheduledEvent>;
|
|
15092
15620
|
/**
|
|
15093
15621
|
* Service for generating and saving scheduled signals markdown reports.
|
|
15094
15622
|
*
|
|
@@ -15199,7 +15727,7 @@ declare class ScheduleMarkdownService {
|
|
|
15199
15727
|
* console.log(markdown);
|
|
15200
15728
|
* ```
|
|
15201
15729
|
*/
|
|
15202
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
15730
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$9[]) => Promise<string>;
|
|
15203
15731
|
/**
|
|
15204
15732
|
* Saves symbol-strategy report to disk.
|
|
15205
15733
|
* Creates directory if it doesn't exist.
|
|
@@ -15224,7 +15752,7 @@ declare class ScheduleMarkdownService {
|
|
|
15224
15752
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
15225
15753
|
* ```
|
|
15226
15754
|
*/
|
|
15227
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
15755
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$9[]) => Promise<void>;
|
|
15228
15756
|
/**
|
|
15229
15757
|
* Clears accumulated event data from storage.
|
|
15230
15758
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -15314,7 +15842,7 @@ declare class ScheduleUtils {
|
|
|
15314
15842
|
strategyName: StrategyName;
|
|
15315
15843
|
exchangeName: ExchangeName;
|
|
15316
15844
|
frameName: FrameName;
|
|
15317
|
-
}, backtest?: boolean, columns?: Columns$
|
|
15845
|
+
}, backtest?: boolean, columns?: Columns$9[]) => Promise<string>;
|
|
15318
15846
|
/**
|
|
15319
15847
|
* Saves strategy report to disk.
|
|
15320
15848
|
*
|
|
@@ -15336,7 +15864,7 @@ declare class ScheduleUtils {
|
|
|
15336
15864
|
strategyName: StrategyName;
|
|
15337
15865
|
exchangeName: ExchangeName;
|
|
15338
15866
|
frameName: FrameName;
|
|
15339
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
15867
|
+
}, backtest?: boolean, path?: string, columns?: Columns$9[]) => Promise<void>;
|
|
15340
15868
|
}
|
|
15341
15869
|
/**
|
|
15342
15870
|
* Singleton instance of ScheduleUtils for convenient scheduled signals reporting.
|
|
@@ -15382,7 +15910,7 @@ declare const Schedule: ScheduleUtils;
|
|
|
15382
15910
|
* @see ColumnModel for the base interface
|
|
15383
15911
|
* @see MetricStats for the metric data structure
|
|
15384
15912
|
*/
|
|
15385
|
-
type Columns$
|
|
15913
|
+
type Columns$8 = ColumnModel<MetricStats>;
|
|
15386
15914
|
/**
|
|
15387
15915
|
* Service for collecting and analyzing performance metrics.
|
|
15388
15916
|
*
|
|
@@ -15489,7 +16017,7 @@ declare class PerformanceMarkdownService {
|
|
|
15489
16017
|
* console.log(markdown);
|
|
15490
16018
|
* ```
|
|
15491
16019
|
*/
|
|
15492
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
16020
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$8[]) => Promise<string>;
|
|
15493
16021
|
/**
|
|
15494
16022
|
* Saves performance report to disk.
|
|
15495
16023
|
*
|
|
@@ -15510,7 +16038,7 @@ declare class PerformanceMarkdownService {
|
|
|
15510
16038
|
* await performanceService.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
15511
16039
|
* ```
|
|
15512
16040
|
*/
|
|
15513
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
16041
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$8[]) => Promise<void>;
|
|
15514
16042
|
/**
|
|
15515
16043
|
* Clears accumulated performance data from storage.
|
|
15516
16044
|
*
|
|
@@ -15618,7 +16146,7 @@ declare class Performance {
|
|
|
15618
16146
|
strategyName: StrategyName;
|
|
15619
16147
|
exchangeName: ExchangeName;
|
|
15620
16148
|
frameName: FrameName;
|
|
15621
|
-
}, backtest?: boolean, columns?: Columns$
|
|
16149
|
+
}, backtest?: boolean, columns?: Columns$8[]): Promise<string>;
|
|
15622
16150
|
/**
|
|
15623
16151
|
* Saves performance report to disk.
|
|
15624
16152
|
*
|
|
@@ -15643,7 +16171,7 @@ declare class Performance {
|
|
|
15643
16171
|
strategyName: StrategyName;
|
|
15644
16172
|
exchangeName: ExchangeName;
|
|
15645
16173
|
frameName: FrameName;
|
|
15646
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
16174
|
+
}, backtest?: boolean, path?: string, columns?: Columns$8[]): Promise<void>;
|
|
15647
16175
|
}
|
|
15648
16176
|
|
|
15649
16177
|
/**
|
|
@@ -16074,7 +16602,7 @@ declare const Walker: WalkerUtils;
|
|
|
16074
16602
|
* @see ColumnModel for the base interface
|
|
16075
16603
|
* @see IHeatmapRow for the row data structure
|
|
16076
16604
|
*/
|
|
16077
|
-
type Columns$
|
|
16605
|
+
type Columns$7 = ColumnModel<IHeatmapRow>;
|
|
16078
16606
|
/**
|
|
16079
16607
|
* Portfolio Heatmap Markdown Service.
|
|
16080
16608
|
*
|
|
@@ -16209,7 +16737,7 @@ declare class HeatMarkdownService {
|
|
|
16209
16737
|
* // | ETHUSDT | +12.3% | 1.85 | -3.1% | 38 |
|
|
16210
16738
|
* ```
|
|
16211
16739
|
*/
|
|
16212
|
-
getReport: (strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
16740
|
+
getReport: (strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$7[]) => Promise<string>;
|
|
16213
16741
|
/**
|
|
16214
16742
|
* Generates the heatmap report and writes it to disk.
|
|
16215
16743
|
*
|
|
@@ -16237,7 +16765,7 @@ declare class HeatMarkdownService {
|
|
|
16237
16765
|
* await service.dump("my-strategy", "binance", "frame1", true, "./reports");
|
|
16238
16766
|
* ```
|
|
16239
16767
|
*/
|
|
16240
|
-
dump: (strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
16768
|
+
dump: (strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$7[]) => Promise<void>;
|
|
16241
16769
|
/**
|
|
16242
16770
|
* Evicts memoized `HeatmapStorage` instances, releasing all accumulated signal data.
|
|
16243
16771
|
*
|
|
@@ -16373,7 +16901,7 @@ declare class HeatUtils {
|
|
|
16373
16901
|
strategyName: StrategyName;
|
|
16374
16902
|
exchangeName: ExchangeName;
|
|
16375
16903
|
frameName: FrameName;
|
|
16376
|
-
}, backtest?: boolean, columns?: Columns$
|
|
16904
|
+
}, backtest?: boolean, columns?: Columns$7[]) => Promise<string>;
|
|
16377
16905
|
/**
|
|
16378
16906
|
* Saves heatmap report to disk for a strategy.
|
|
16379
16907
|
*
|
|
@@ -16406,7 +16934,7 @@ declare class HeatUtils {
|
|
|
16406
16934
|
strategyName: StrategyName;
|
|
16407
16935
|
exchangeName: ExchangeName;
|
|
16408
16936
|
frameName: FrameName;
|
|
16409
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
16937
|
+
}, backtest?: boolean, path?: string, columns?: Columns$7[]) => Promise<void>;
|
|
16410
16938
|
}
|
|
16411
16939
|
/**
|
|
16412
16940
|
* Singleton instance of HeatUtils for convenient heatmap operations.
|
|
@@ -16560,7 +17088,7 @@ declare const PositionSize: typeof PositionSizeUtils;
|
|
|
16560
17088
|
* @see ColumnModel for the base interface
|
|
16561
17089
|
* @see PartialEvent for the event data structure
|
|
16562
17090
|
*/
|
|
16563
|
-
type Columns$
|
|
17091
|
+
type Columns$6 = ColumnModel<PartialEvent>;
|
|
16564
17092
|
/**
|
|
16565
17093
|
* Service for generating and saving partial profit/loss markdown reports.
|
|
16566
17094
|
*
|
|
@@ -16682,7 +17210,7 @@ declare class PartialMarkdownService {
|
|
|
16682
17210
|
* console.log(markdown);
|
|
16683
17211
|
* ```
|
|
16684
17212
|
*/
|
|
16685
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
17213
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$6[]) => Promise<string>;
|
|
16686
17214
|
/**
|
|
16687
17215
|
* Saves symbol-strategy report to disk.
|
|
16688
17216
|
* Creates directory if it doesn't exist.
|
|
@@ -16707,7 +17235,7 @@ declare class PartialMarkdownService {
|
|
|
16707
17235
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
16708
17236
|
* ```
|
|
16709
17237
|
*/
|
|
16710
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
17238
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$6[]) => Promise<void>;
|
|
16711
17239
|
/**
|
|
16712
17240
|
* Clears accumulated event data from storage.
|
|
16713
17241
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -16843,7 +17371,7 @@ declare class PartialUtils {
|
|
|
16843
17371
|
strategyName: StrategyName;
|
|
16844
17372
|
exchangeName: ExchangeName;
|
|
16845
17373
|
frameName: FrameName;
|
|
16846
|
-
}, backtest?: boolean, columns?: Columns$
|
|
17374
|
+
}, backtest?: boolean, columns?: Columns$6[]) => Promise<string>;
|
|
16847
17375
|
/**
|
|
16848
17376
|
* Generates and saves markdown report to file.
|
|
16849
17377
|
*
|
|
@@ -16880,7 +17408,7 @@ declare class PartialUtils {
|
|
|
16880
17408
|
strategyName: StrategyName;
|
|
16881
17409
|
exchangeName: ExchangeName;
|
|
16882
17410
|
frameName: FrameName;
|
|
16883
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
17411
|
+
}, backtest?: boolean, path?: string, columns?: Columns$6[]) => Promise<void>;
|
|
16884
17412
|
}
|
|
16885
17413
|
/**
|
|
16886
17414
|
* Global singleton instance of PartialUtils.
|
|
@@ -16901,7 +17429,7 @@ declare const Partial$1: PartialUtils;
|
|
|
16901
17429
|
/**
|
|
16902
17430
|
* Type alias for column configuration used in highest profit markdown reports.
|
|
16903
17431
|
*/
|
|
16904
|
-
type Columns$
|
|
17432
|
+
type Columns$5 = ColumnModel<HighestProfitEvent>;
|
|
16905
17433
|
/**
|
|
16906
17434
|
* Service for generating and saving highest profit markdown reports.
|
|
16907
17435
|
*
|
|
@@ -16977,63 +17505,185 @@ declare class HighestProfitMarkdownService {
|
|
|
16977
17505
|
* `eventList` (newest first) and `totalEvents`
|
|
16978
17506
|
* @throws {Error} If `subscribe()` has not been called before this method
|
|
16979
17507
|
*/
|
|
16980
|
-
getData: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<HighestProfitStatisticsModel>;
|
|
17508
|
+
getData: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<HighestProfitStatisticsModel>;
|
|
17509
|
+
/**
|
|
17510
|
+
* Generates a markdown highest profit report for the given context.
|
|
17511
|
+
*
|
|
17512
|
+
* Delegates to `ReportStorage.getReport`. The resulting string includes a
|
|
17513
|
+
* markdown table (newest events first) followed by the total event count.
|
|
17514
|
+
*
|
|
17515
|
+
* @param symbol - Trading pair symbol (e.g. `"BTCUSDT"`)
|
|
17516
|
+
* @param strategyName - Strategy identifier
|
|
17517
|
+
* @param exchangeName - Exchange identifier (e.g. `"binance"`)
|
|
17518
|
+
* @param frameName - Backtest frame identifier; empty string for live mode
|
|
17519
|
+
* @param backtest - `true` for backtest mode, `false` for live mode
|
|
17520
|
+
* @param columns - Column definitions controlling the table layout;
|
|
17521
|
+
* defaults to `COLUMN_CONFIG.highest_profit_columns`
|
|
17522
|
+
* @returns Promise resolving to the full markdown string
|
|
17523
|
+
* @throws {Error} If `subscribe()` has not been called before this method
|
|
17524
|
+
*/
|
|
17525
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$5[]) => Promise<string>;
|
|
17526
|
+
/**
|
|
17527
|
+
* Generates the highest profit report and writes it to disk.
|
|
17528
|
+
*
|
|
17529
|
+
* Delegates to `ReportStorage.dump`. The filename follows the pattern:
|
|
17530
|
+
* - Backtest: `{symbol}_{strategyName}_{exchangeName}_{frameName}_backtest-{timestamp}.md`
|
|
17531
|
+
* - Live: `{symbol}_{strategyName}_{exchangeName}_live-{timestamp}.md`
|
|
17532
|
+
*
|
|
17533
|
+
* @param symbol - Trading pair symbol (e.g. `"BTCUSDT"`)
|
|
17534
|
+
* @param strategyName - Strategy identifier
|
|
17535
|
+
* @param exchangeName - Exchange identifier (e.g. `"binance"`)
|
|
17536
|
+
* @param frameName - Backtest frame identifier; empty string for live mode
|
|
17537
|
+
* @param backtest - `true` for backtest mode, `false` for live mode
|
|
17538
|
+
* @param path - Directory to write the file into; defaults to `"./dump/highest_profit"`
|
|
17539
|
+
* @param columns - Column definitions for table formatting;
|
|
17540
|
+
* defaults to `COLUMN_CONFIG.highest_profit_columns`
|
|
17541
|
+
* @throws {Error} If `subscribe()` has not been called before this method
|
|
17542
|
+
*/
|
|
17543
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$5[]) => Promise<void>;
|
|
17544
|
+
/**
|
|
17545
|
+
* Evicts memoized `ReportStorage` instances, releasing all accumulated event data.
|
|
17546
|
+
*
|
|
17547
|
+
* - With `payload` — clears only the storage bucket identified by
|
|
17548
|
+
* `(symbol, strategyName, exchangeName, frameName, backtest)`;
|
|
17549
|
+
* subsequent calls for that combination start from an empty state.
|
|
17550
|
+
* - Without `payload` — clears **all** storage buckets.
|
|
17551
|
+
*
|
|
17552
|
+
* Also called internally by the unsubscribe closure returned from `subscribe()`.
|
|
17553
|
+
*
|
|
17554
|
+
* @param payload - Optional scope to restrict which bucket is cleared;
|
|
17555
|
+
* omit to clear everything
|
|
17556
|
+
*
|
|
17557
|
+
* @example
|
|
17558
|
+
* ```typescript
|
|
17559
|
+
* // Clear one specific context
|
|
17560
|
+
* await service.clear({ symbol: "BTCUSDT", strategyName: "my-strategy", exchangeName: "binance", frameName: "1m-btc", backtest: true });
|
|
17561
|
+
*
|
|
17562
|
+
* // Clear all contexts
|
|
17563
|
+
* await service.clear();
|
|
17564
|
+
* ```
|
|
17565
|
+
*/
|
|
17566
|
+
clear: (payload?: {
|
|
17567
|
+
symbol: string;
|
|
17568
|
+
strategyName: StrategyName;
|
|
17569
|
+
exchangeName: ExchangeName;
|
|
17570
|
+
frameName: FrameName;
|
|
17571
|
+
backtest: boolean;
|
|
17572
|
+
}) => Promise<void>;
|
|
17573
|
+
}
|
|
17574
|
+
|
|
17575
|
+
/**
|
|
17576
|
+
* Utility class for accessing highest profit reports and statistics.
|
|
17577
|
+
*
|
|
17578
|
+
* Provides static-like methods (via singleton instance) to retrieve data
|
|
17579
|
+
* accumulated by HighestProfitMarkdownService from highestProfitSubject events.
|
|
17580
|
+
*
|
|
17581
|
+
* @example
|
|
17582
|
+
* ```typescript
|
|
17583
|
+
* import { HighestProfit } from "backtest-kit";
|
|
17584
|
+
*
|
|
17585
|
+
* const stats = await HighestProfit.getData("BTCUSDT", { strategyName, exchangeName, frameName });
|
|
17586
|
+
* const report = await HighestProfit.getReport("BTCUSDT", { strategyName, exchangeName, frameName });
|
|
17587
|
+
* await HighestProfit.dump("BTCUSDT", { strategyName, exchangeName, frameName });
|
|
17588
|
+
* ```
|
|
17589
|
+
*/
|
|
17590
|
+
declare class HighestProfitUtils {
|
|
17591
|
+
/**
|
|
17592
|
+
* Retrieves statistical data from accumulated highest profit events.
|
|
17593
|
+
*
|
|
17594
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
17595
|
+
* @param context - Execution context
|
|
17596
|
+
* @param backtest - Whether to query backtest data
|
|
17597
|
+
* @returns Promise resolving to HighestProfitStatisticsModel
|
|
17598
|
+
*/
|
|
17599
|
+
getData: (symbol: string, context: {
|
|
17600
|
+
strategyName: StrategyName;
|
|
17601
|
+
exchangeName: ExchangeName;
|
|
17602
|
+
frameName: FrameName;
|
|
17603
|
+
}, backtest?: boolean) => Promise<HighestProfitStatisticsModel>;
|
|
17604
|
+
/**
|
|
17605
|
+
* Generates a markdown report with all highest profit events for a symbol-strategy pair.
|
|
17606
|
+
*
|
|
17607
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
17608
|
+
* @param context - Execution context
|
|
17609
|
+
* @param backtest - Whether to query backtest data
|
|
17610
|
+
* @param columns - Optional column configuration
|
|
17611
|
+
* @returns Promise resolving to markdown formatted report string
|
|
17612
|
+
*/
|
|
17613
|
+
getReport: (symbol: string, context: {
|
|
17614
|
+
strategyName: StrategyName;
|
|
17615
|
+
exchangeName: ExchangeName;
|
|
17616
|
+
frameName: FrameName;
|
|
17617
|
+
}, backtest?: boolean, columns?: Columns$5[]) => Promise<string>;
|
|
17618
|
+
/**
|
|
17619
|
+
* Generates and saves a markdown report to file.
|
|
17620
|
+
*
|
|
17621
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
17622
|
+
* @param context - Execution context
|
|
17623
|
+
* @param backtest - Whether to query backtest data
|
|
17624
|
+
* @param path - Output directory path (default: "./dump/highest_profit")
|
|
17625
|
+
* @param columns - Optional column configuration
|
|
17626
|
+
*/
|
|
17627
|
+
dump: (symbol: string, context: {
|
|
17628
|
+
strategyName: StrategyName;
|
|
17629
|
+
exchangeName: ExchangeName;
|
|
17630
|
+
frameName: FrameName;
|
|
17631
|
+
}, backtest?: boolean, path?: string, columns?: Columns$5[]) => Promise<void>;
|
|
17632
|
+
}
|
|
17633
|
+
/**
|
|
17634
|
+
* Global singleton instance of HighestProfitUtils.
|
|
17635
|
+
*/
|
|
17636
|
+
declare const HighestProfit: HighestProfitUtils;
|
|
17637
|
+
|
|
17638
|
+
/**
|
|
17639
|
+
* Type alias for column configuration used in max drawdown markdown reports.
|
|
17640
|
+
*/
|
|
17641
|
+
type Columns$4 = ColumnModel<MaxDrawdownEvent>;
|
|
17642
|
+
/**
|
|
17643
|
+
* Service for generating and saving max drawdown markdown reports.
|
|
17644
|
+
*
|
|
17645
|
+
* Listens to maxDrawdownSubject and accumulates events per
|
|
17646
|
+
* symbol-strategy-exchange-frame combination. Provides getData(),
|
|
17647
|
+
* getReport(), and dump() methods matching the HighestProfit pattern.
|
|
17648
|
+
*/
|
|
17649
|
+
declare class MaxDrawdownMarkdownService {
|
|
17650
|
+
private readonly loggerService;
|
|
17651
|
+
private getStorage;
|
|
17652
|
+
/**
|
|
17653
|
+
* Subscribes to `maxDrawdownSubject` to start receiving `MaxDrawdownContract`
|
|
17654
|
+
* events. Protected against multiple subscriptions via `singleshot`.
|
|
17655
|
+
*
|
|
17656
|
+
* @returns Unsubscribe function; calling it tears down the subscription and
|
|
17657
|
+
* clears all accumulated data
|
|
17658
|
+
*/
|
|
17659
|
+
subscribe: (() => () => void) & functools_kit.ISingleshotClearable;
|
|
17660
|
+
/**
|
|
17661
|
+
* Detaches from `maxDrawdownSubject` and clears all accumulated data.
|
|
17662
|
+
*
|
|
17663
|
+
* If `subscribe()` was never called, does nothing.
|
|
17664
|
+
*/
|
|
17665
|
+
unsubscribe: () => Promise<void>;
|
|
17666
|
+
/**
|
|
17667
|
+
* Handles a single `MaxDrawdownContract` event emitted by `maxDrawdownSubject`.
|
|
17668
|
+
*/
|
|
17669
|
+
private tick;
|
|
16981
17670
|
/**
|
|
16982
|
-
*
|
|
16983
|
-
|
|
16984
|
-
|
|
16985
|
-
|
|
16986
|
-
*
|
|
16987
|
-
* @param symbol - Trading pair symbol (e.g. `"BTCUSDT"`)
|
|
16988
|
-
* @param strategyName - Strategy identifier
|
|
16989
|
-
* @param exchangeName - Exchange identifier (e.g. `"binance"`)
|
|
16990
|
-
* @param frameName - Backtest frame identifier; empty string for live mode
|
|
16991
|
-
* @param backtest - `true` for backtest mode, `false` for live mode
|
|
16992
|
-
* @param columns - Column definitions controlling the table layout;
|
|
16993
|
-
* defaults to `COLUMN_CONFIG.highest_profit_columns`
|
|
16994
|
-
* @returns Promise resolving to the full markdown string
|
|
16995
|
-
* @throws {Error} If `subscribe()` has not been called before this method
|
|
17671
|
+
* Returns accumulated max drawdown statistics for the given context.
|
|
17672
|
+
*/
|
|
17673
|
+
getData: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<MaxDrawdownStatisticsModel>;
|
|
17674
|
+
/**
|
|
17675
|
+
* Generates a markdown max drawdown report for the given context.
|
|
16996
17676
|
*/
|
|
16997
17677
|
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$4[]) => Promise<string>;
|
|
16998
17678
|
/**
|
|
16999
|
-
* Generates the
|
|
17000
|
-
*
|
|
17001
|
-
* Delegates to `ReportStorage.dump`. The filename follows the pattern:
|
|
17002
|
-
* - Backtest: `{symbol}_{strategyName}_{exchangeName}_{frameName}_backtest-{timestamp}.md`
|
|
17003
|
-
* - Live: `{symbol}_{strategyName}_{exchangeName}_live-{timestamp}.md`
|
|
17004
|
-
*
|
|
17005
|
-
* @param symbol - Trading pair symbol (e.g. `"BTCUSDT"`)
|
|
17006
|
-
* @param strategyName - Strategy identifier
|
|
17007
|
-
* @param exchangeName - Exchange identifier (e.g. `"binance"`)
|
|
17008
|
-
* @param frameName - Backtest frame identifier; empty string for live mode
|
|
17009
|
-
* @param backtest - `true` for backtest mode, `false` for live mode
|
|
17010
|
-
* @param path - Directory to write the file into; defaults to `"./dump/highest_profit"`
|
|
17011
|
-
* @param columns - Column definitions for table formatting;
|
|
17012
|
-
* defaults to `COLUMN_CONFIG.highest_profit_columns`
|
|
17013
|
-
* @throws {Error} If `subscribe()` has not been called before this method
|
|
17679
|
+
* Generates the max drawdown report and writes it to disk.
|
|
17014
17680
|
*/
|
|
17015
17681
|
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$4[]) => Promise<void>;
|
|
17016
17682
|
/**
|
|
17017
17683
|
* Evicts memoized `ReportStorage` instances, releasing all accumulated event data.
|
|
17018
17684
|
*
|
|
17019
|
-
* - With `payload` — clears only the storage bucket
|
|
17020
|
-
* `(symbol, strategyName, exchangeName, frameName, backtest)`;
|
|
17021
|
-
* subsequent calls for that combination start from an empty state.
|
|
17685
|
+
* - With `payload` — clears only the storage bucket for that combination.
|
|
17022
17686
|
* - Without `payload` — clears **all** storage buckets.
|
|
17023
|
-
*
|
|
17024
|
-
* Also called internally by the unsubscribe closure returned from `subscribe()`.
|
|
17025
|
-
*
|
|
17026
|
-
* @param payload - Optional scope to restrict which bucket is cleared;
|
|
17027
|
-
* omit to clear everything
|
|
17028
|
-
*
|
|
17029
|
-
* @example
|
|
17030
|
-
* ```typescript
|
|
17031
|
-
* // Clear one specific context
|
|
17032
|
-
* await service.clear({ symbol: "BTCUSDT", strategyName: "my-strategy", exchangeName: "binance", frameName: "1m-btc", backtest: true });
|
|
17033
|
-
*
|
|
17034
|
-
* // Clear all contexts
|
|
17035
|
-
* await service.clear();
|
|
17036
|
-
* ```
|
|
17037
17687
|
*/
|
|
17038
17688
|
clear: (payload?: {
|
|
17039
17689
|
symbol: string;
|
|
@@ -17045,36 +17695,36 @@ declare class HighestProfitMarkdownService {
|
|
|
17045
17695
|
}
|
|
17046
17696
|
|
|
17047
17697
|
/**
|
|
17048
|
-
* Utility class for accessing
|
|
17698
|
+
* Utility class for accessing max drawdown reports and statistics.
|
|
17049
17699
|
*
|
|
17050
17700
|
* Provides static-like methods (via singleton instance) to retrieve data
|
|
17051
|
-
* accumulated by
|
|
17701
|
+
* accumulated by MaxDrawdownMarkdownService from maxDrawdownSubject events.
|
|
17052
17702
|
*
|
|
17053
17703
|
* @example
|
|
17054
17704
|
* ```typescript
|
|
17055
|
-
* import {
|
|
17705
|
+
* import { MaxDrawdown } from "backtest-kit";
|
|
17056
17706
|
*
|
|
17057
|
-
* const stats = await
|
|
17058
|
-
* const report = await
|
|
17059
|
-
* await
|
|
17707
|
+
* const stats = await MaxDrawdown.getData("BTCUSDT", { strategyName, exchangeName, frameName });
|
|
17708
|
+
* const report = await MaxDrawdown.getReport("BTCUSDT", { strategyName, exchangeName, frameName });
|
|
17709
|
+
* await MaxDrawdown.dump("BTCUSDT", { strategyName, exchangeName, frameName });
|
|
17060
17710
|
* ```
|
|
17061
17711
|
*/
|
|
17062
|
-
declare class
|
|
17712
|
+
declare class MaxDrawdownUtils {
|
|
17063
17713
|
/**
|
|
17064
|
-
* Retrieves statistical data from accumulated
|
|
17714
|
+
* Retrieves statistical data from accumulated max drawdown events.
|
|
17065
17715
|
*
|
|
17066
17716
|
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
17067
17717
|
* @param context - Execution context
|
|
17068
17718
|
* @param backtest - Whether to query backtest data
|
|
17069
|
-
* @returns Promise resolving to
|
|
17719
|
+
* @returns Promise resolving to MaxDrawdownStatisticsModel
|
|
17070
17720
|
*/
|
|
17071
17721
|
getData: (symbol: string, context: {
|
|
17072
17722
|
strategyName: StrategyName;
|
|
17073
17723
|
exchangeName: ExchangeName;
|
|
17074
17724
|
frameName: FrameName;
|
|
17075
|
-
}, backtest?: boolean) => Promise<
|
|
17725
|
+
}, backtest?: boolean) => Promise<MaxDrawdownStatisticsModel>;
|
|
17076
17726
|
/**
|
|
17077
|
-
* Generates a markdown report with all
|
|
17727
|
+
* Generates a markdown report with all max drawdown events for a symbol-strategy pair.
|
|
17078
17728
|
*
|
|
17079
17729
|
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
17080
17730
|
* @param context - Execution context
|
|
@@ -17093,7 +17743,7 @@ declare class HighestProfitUtils {
|
|
|
17093
17743
|
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
17094
17744
|
* @param context - Execution context
|
|
17095
17745
|
* @param backtest - Whether to query backtest data
|
|
17096
|
-
* @param path - Output directory path (default: "./dump/
|
|
17746
|
+
* @param path - Output directory path (default: "./dump/max_drawdown")
|
|
17097
17747
|
* @param columns - Optional column configuration
|
|
17098
17748
|
*/
|
|
17099
17749
|
dump: (symbol: string, context: {
|
|
@@ -17103,9 +17753,9 @@ declare class HighestProfitUtils {
|
|
|
17103
17753
|
}, backtest?: boolean, path?: string, columns?: Columns$4[]) => Promise<void>;
|
|
17104
17754
|
}
|
|
17105
17755
|
/**
|
|
17106
|
-
* Global singleton instance of
|
|
17756
|
+
* Global singleton instance of MaxDrawdownUtils.
|
|
17107
17757
|
*/
|
|
17108
|
-
declare const
|
|
17758
|
+
declare const MaxDrawdown: MaxDrawdownUtils;
|
|
17109
17759
|
|
|
17110
17760
|
/**
|
|
17111
17761
|
* Utility class containing predefined trading constants for take-profit and stop-loss levels.
|
|
@@ -21946,6 +22596,12 @@ declare const backtestScheduleOpenSubject: Subject<IStrategyTickResultOpened>;
|
|
|
21946
22596
|
* Allows users to track profit milestones and implement custom management logic based on profit levels.
|
|
21947
22597
|
*/
|
|
21948
22598
|
declare const highestProfitSubject: Subject<HighestProfitContract>;
|
|
22599
|
+
/**
|
|
22600
|
+
* Max drawdown emitter for real-time risk tracking.
|
|
22601
|
+
* Emits updates on the maximum drawdown experienced for an open position.
|
|
22602
|
+
* Allows users to track drawdown levels and implement custom risk management logic based on drawdown thresholds.
|
|
22603
|
+
*/
|
|
22604
|
+
declare const maxDrawdownSubject: Subject<MaxDrawdownContract>;
|
|
21949
22605
|
|
|
21950
22606
|
declare const emitters_activePingSubject: typeof activePingSubject;
|
|
21951
22607
|
declare const emitters_backtestScheduleOpenSubject: typeof backtestScheduleOpenSubject;
|
|
@@ -21956,6 +22612,7 @@ declare const emitters_doneWalkerSubject: typeof doneWalkerSubject;
|
|
|
21956
22612
|
declare const emitters_errorEmitter: typeof errorEmitter;
|
|
21957
22613
|
declare const emitters_exitEmitter: typeof exitEmitter;
|
|
21958
22614
|
declare const emitters_highestProfitSubject: typeof highestProfitSubject;
|
|
22615
|
+
declare const emitters_maxDrawdownSubject: typeof maxDrawdownSubject;
|
|
21959
22616
|
declare const emitters_partialLossSubject: typeof partialLossSubject;
|
|
21960
22617
|
declare const emitters_partialProfitSubject: typeof partialProfitSubject;
|
|
21961
22618
|
declare const emitters_performanceEmitter: typeof performanceEmitter;
|
|
@@ -21974,7 +22631,7 @@ declare const emitters_walkerCompleteSubject: typeof walkerCompleteSubject;
|
|
|
21974
22631
|
declare const emitters_walkerEmitter: typeof walkerEmitter;
|
|
21975
22632
|
declare const emitters_walkerStopSubject: typeof walkerStopSubject;
|
|
21976
22633
|
declare namespace emitters {
|
|
21977
|
-
export { emitters_activePingSubject as activePingSubject, emitters_backtestScheduleOpenSubject as backtestScheduleOpenSubject, emitters_breakevenSubject as breakevenSubject, emitters_doneBacktestSubject as doneBacktestSubject, emitters_doneLiveSubject as doneLiveSubject, emitters_doneWalkerSubject as doneWalkerSubject, emitters_errorEmitter as errorEmitter, emitters_exitEmitter as exitEmitter, emitters_highestProfitSubject as highestProfitSubject, emitters_partialLossSubject as partialLossSubject, emitters_partialProfitSubject as partialProfitSubject, emitters_performanceEmitter as performanceEmitter, emitters_progressBacktestEmitter as progressBacktestEmitter, emitters_progressWalkerEmitter as progressWalkerEmitter, emitters_riskSubject as riskSubject, emitters_schedulePingSubject as schedulePingSubject, emitters_shutdownEmitter as shutdownEmitter, emitters_signalBacktestEmitter as signalBacktestEmitter, emitters_signalEmitter as signalEmitter, emitters_signalLiveEmitter as signalLiveEmitter, emitters_strategyCommitSubject as strategyCommitSubject, emitters_syncSubject as syncSubject, emitters_validationSubject as validationSubject, emitters_walkerCompleteSubject as walkerCompleteSubject, emitters_walkerEmitter as walkerEmitter, emitters_walkerStopSubject as walkerStopSubject };
|
|
22634
|
+
export { emitters_activePingSubject as activePingSubject, emitters_backtestScheduleOpenSubject as backtestScheduleOpenSubject, emitters_breakevenSubject as breakevenSubject, emitters_doneBacktestSubject as doneBacktestSubject, emitters_doneLiveSubject as doneLiveSubject, emitters_doneWalkerSubject as doneWalkerSubject, emitters_errorEmitter as errorEmitter, emitters_exitEmitter as exitEmitter, emitters_highestProfitSubject as highestProfitSubject, emitters_maxDrawdownSubject as maxDrawdownSubject, emitters_partialLossSubject as partialLossSubject, emitters_partialProfitSubject as partialProfitSubject, emitters_performanceEmitter as performanceEmitter, emitters_progressBacktestEmitter as progressBacktestEmitter, emitters_progressWalkerEmitter as progressWalkerEmitter, emitters_riskSubject as riskSubject, emitters_schedulePingSubject as schedulePingSubject, emitters_shutdownEmitter as shutdownEmitter, emitters_signalBacktestEmitter as signalBacktestEmitter, emitters_signalEmitter as signalEmitter, emitters_signalLiveEmitter as signalLiveEmitter, emitters_strategyCommitSubject as strategyCommitSubject, emitters_syncSubject as syncSubject, emitters_validationSubject as validationSubject, emitters_walkerCompleteSubject as walkerCompleteSubject, emitters_walkerEmitter as walkerEmitter, emitters_walkerStopSubject as walkerStopSubject };
|
|
21978
22635
|
}
|
|
21979
22636
|
|
|
21980
22637
|
/**
|
|
@@ -24010,6 +24667,110 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
24010
24667
|
exchangeName: ExchangeName;
|
|
24011
24668
|
frameName: FrameName;
|
|
24012
24669
|
}) => Promise<number | null>;
|
|
24670
|
+
/**
|
|
24671
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
24672
|
+
*
|
|
24673
|
+
* Alias for getPositionDrawdownMinutes — measures how long the position has been
|
|
24674
|
+
* pulling back from its peak profit level.
|
|
24675
|
+
*
|
|
24676
|
+
* Resolves current timestamp via timeMetaService and delegates to
|
|
24677
|
+
* ClientStrategy.getPositionHighestProfitMinutes().
|
|
24678
|
+
* Returns null if no pending signal exists.
|
|
24679
|
+
*
|
|
24680
|
+
* @param backtest - Whether running in backtest mode
|
|
24681
|
+
* @param symbol - Trading pair symbol
|
|
24682
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24683
|
+
* @returns Promise resolving to minutes since last profit peak or null
|
|
24684
|
+
*/
|
|
24685
|
+
getPositionHighestProfitMinutes: (backtest: boolean, symbol: string, context: {
|
|
24686
|
+
strategyName: StrategyName;
|
|
24687
|
+
exchangeName: ExchangeName;
|
|
24688
|
+
frameName: FrameName;
|
|
24689
|
+
}) => Promise<number | null>;
|
|
24690
|
+
/**
|
|
24691
|
+
* Returns the number of minutes elapsed since the worst loss price was recorded.
|
|
24692
|
+
*
|
|
24693
|
+
* Measures how long ago the deepest drawdown point occurred.
|
|
24694
|
+
* Zero when called at the exact moment the trough was set.
|
|
24695
|
+
*
|
|
24696
|
+
* Resolves current timestamp via timeMetaService and delegates to
|
|
24697
|
+
* ClientStrategy.getPositionMaxDrawdownMinutes().
|
|
24698
|
+
* Returns null if no pending signal exists.
|
|
24699
|
+
*
|
|
24700
|
+
* @param backtest - Whether running in backtest mode
|
|
24701
|
+
* @param symbol - Trading pair symbol
|
|
24702
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24703
|
+
* @returns Promise resolving to minutes since last drawdown trough or null
|
|
24704
|
+
*/
|
|
24705
|
+
getPositionMaxDrawdownMinutes: (backtest: boolean, symbol: string, context: {
|
|
24706
|
+
strategyName: StrategyName;
|
|
24707
|
+
exchangeName: ExchangeName;
|
|
24708
|
+
frameName: FrameName;
|
|
24709
|
+
}) => Promise<number | null>;
|
|
24710
|
+
/**
|
|
24711
|
+
* Returns the worst price reached in the loss direction during this position's life.
|
|
24712
|
+
*
|
|
24713
|
+
* Delegates to ClientStrategy.getPositionMaxDrawdownPrice().
|
|
24714
|
+
* Returns null if no pending signal exists.
|
|
24715
|
+
*
|
|
24716
|
+
* @param backtest - Whether running in backtest mode
|
|
24717
|
+
* @param symbol - Trading pair symbol
|
|
24718
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24719
|
+
* @returns Promise resolving to price or null
|
|
24720
|
+
*/
|
|
24721
|
+
getPositionMaxDrawdownPrice: (backtest: boolean, symbol: string, context: {
|
|
24722
|
+
strategyName: StrategyName;
|
|
24723
|
+
exchangeName: ExchangeName;
|
|
24724
|
+
frameName: FrameName;
|
|
24725
|
+
}) => Promise<number | null>;
|
|
24726
|
+
/**
|
|
24727
|
+
* Returns the timestamp when the worst loss price was recorded during this position's life.
|
|
24728
|
+
*
|
|
24729
|
+
* Delegates to ClientStrategy.getPositionMaxDrawdownTimestamp().
|
|
24730
|
+
* Returns null if no pending signal exists.
|
|
24731
|
+
*
|
|
24732
|
+
* @param backtest - Whether running in backtest mode
|
|
24733
|
+
* @param symbol - Trading pair symbol
|
|
24734
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24735
|
+
* @returns Promise resolving to timestamp in milliseconds or null
|
|
24736
|
+
*/
|
|
24737
|
+
getPositionMaxDrawdownTimestamp: (backtest: boolean, symbol: string, context: {
|
|
24738
|
+
strategyName: StrategyName;
|
|
24739
|
+
exchangeName: ExchangeName;
|
|
24740
|
+
frameName: FrameName;
|
|
24741
|
+
}) => Promise<number | null>;
|
|
24742
|
+
/**
|
|
24743
|
+
* Returns the PnL percentage at the moment the worst loss price was recorded during this position's life.
|
|
24744
|
+
*
|
|
24745
|
+
* Delegates to ClientStrategy.getPositionMaxDrawdownPnlPercentage().
|
|
24746
|
+
* Returns null if no pending signal exists.
|
|
24747
|
+
*
|
|
24748
|
+
* @param backtest - Whether running in backtest mode
|
|
24749
|
+
* @param symbol - Trading pair symbol
|
|
24750
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24751
|
+
* @returns Promise resolving to PnL percentage or null
|
|
24752
|
+
*/
|
|
24753
|
+
getPositionMaxDrawdownPnlPercentage: (backtest: boolean, symbol: string, context: {
|
|
24754
|
+
strategyName: StrategyName;
|
|
24755
|
+
exchangeName: ExchangeName;
|
|
24756
|
+
frameName: FrameName;
|
|
24757
|
+
}) => Promise<number | null>;
|
|
24758
|
+
/**
|
|
24759
|
+
* Returns the PnL cost (in quote currency) at the moment the worst loss price was recorded during this position's life.
|
|
24760
|
+
*
|
|
24761
|
+
* Delegates to ClientStrategy.getPositionMaxDrawdownPnlCost().
|
|
24762
|
+
* Returns null if no pending signal exists.
|
|
24763
|
+
*
|
|
24764
|
+
* @param backtest - Whether running in backtest mode
|
|
24765
|
+
* @param symbol - Trading pair symbol
|
|
24766
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24767
|
+
* @returns Promise resolving to PnL cost or null
|
|
24768
|
+
*/
|
|
24769
|
+
getPositionMaxDrawdownPnlCost: (backtest: boolean, symbol: string, context: {
|
|
24770
|
+
strategyName: StrategyName;
|
|
24771
|
+
exchangeName: ExchangeName;
|
|
24772
|
+
frameName: FrameName;
|
|
24773
|
+
}) => Promise<number | null>;
|
|
24013
24774
|
/**
|
|
24014
24775
|
* Disposes the ClientStrategy instance for the given context.
|
|
24015
24776
|
*
|
|
@@ -25887,6 +26648,96 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
25887
26648
|
exchangeName: ExchangeName;
|
|
25888
26649
|
frameName: FrameName;
|
|
25889
26650
|
}) => Promise<number | null>;
|
|
26651
|
+
/**
|
|
26652
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
26653
|
+
*
|
|
26654
|
+
* Alias for getPositionDrawdownMinutes — measures how long the position has been
|
|
26655
|
+
* pulling back from its peak profit level.
|
|
26656
|
+
*
|
|
26657
|
+
* Validates strategy existence and delegates to connection service.
|
|
26658
|
+
* Returns null if no pending signal exists.
|
|
26659
|
+
*
|
|
26660
|
+
* @param backtest - Whether running in backtest mode
|
|
26661
|
+
* @param symbol - Trading pair symbol
|
|
26662
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
26663
|
+
* @returns Promise resolving to minutes since last profit peak or null
|
|
26664
|
+
*/
|
|
26665
|
+
getPositionHighestProfitMinutes: (backtest: boolean, symbol: string, context: {
|
|
26666
|
+
strategyName: StrategyName;
|
|
26667
|
+
exchangeName: ExchangeName;
|
|
26668
|
+
frameName: FrameName;
|
|
26669
|
+
}) => Promise<number | null>;
|
|
26670
|
+
/**
|
|
26671
|
+
* Returns the number of minutes elapsed since the worst loss price was recorded.
|
|
26672
|
+
*
|
|
26673
|
+
* Measures how long ago the deepest drawdown point occurred.
|
|
26674
|
+
* Zero when called at the exact moment the trough was set.
|
|
26675
|
+
*
|
|
26676
|
+
* Validates strategy existence and delegates to connection service.
|
|
26677
|
+
* Returns null if no pending signal exists.
|
|
26678
|
+
*
|
|
26679
|
+
* @param backtest - Whether running in backtest mode
|
|
26680
|
+
* @param symbol - Trading pair symbol
|
|
26681
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
26682
|
+
* @returns Promise resolving to minutes since last drawdown trough or null
|
|
26683
|
+
*/
|
|
26684
|
+
getPositionMaxDrawdownMinutes: (backtest: boolean, symbol: string, context: {
|
|
26685
|
+
strategyName: StrategyName;
|
|
26686
|
+
exchangeName: ExchangeName;
|
|
26687
|
+
frameName: FrameName;
|
|
26688
|
+
}) => Promise<number | null>;
|
|
26689
|
+
/**
|
|
26690
|
+
* Returns the worst price reached in the loss direction during this position's life.
|
|
26691
|
+
*
|
|
26692
|
+
* @param backtest - Whether running in backtest mode
|
|
26693
|
+
* @param symbol - Trading pair symbol
|
|
26694
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
26695
|
+
* @returns Promise resolving to price or null
|
|
26696
|
+
*/
|
|
26697
|
+
getPositionMaxDrawdownPrice: (backtest: boolean, symbol: string, context: {
|
|
26698
|
+
strategyName: StrategyName;
|
|
26699
|
+
exchangeName: ExchangeName;
|
|
26700
|
+
frameName: FrameName;
|
|
26701
|
+
}) => Promise<number | null>;
|
|
26702
|
+
/**
|
|
26703
|
+
* Returns the timestamp when the worst loss price was recorded during this position's life.
|
|
26704
|
+
*
|
|
26705
|
+
* @param backtest - Whether running in backtest mode
|
|
26706
|
+
* @param symbol - Trading pair symbol
|
|
26707
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
26708
|
+
* @returns Promise resolving to timestamp in milliseconds or null
|
|
26709
|
+
*/
|
|
26710
|
+
getPositionMaxDrawdownTimestamp: (backtest: boolean, symbol: string, context: {
|
|
26711
|
+
strategyName: StrategyName;
|
|
26712
|
+
exchangeName: ExchangeName;
|
|
26713
|
+
frameName: FrameName;
|
|
26714
|
+
}) => Promise<number | null>;
|
|
26715
|
+
/**
|
|
26716
|
+
* Returns the PnL percentage at the moment the worst loss price was recorded during this position's life.
|
|
26717
|
+
*
|
|
26718
|
+
* @param backtest - Whether running in backtest mode
|
|
26719
|
+
* @param symbol - Trading pair symbol
|
|
26720
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
26721
|
+
* @returns Promise resolving to PnL percentage or null
|
|
26722
|
+
*/
|
|
26723
|
+
getPositionMaxDrawdownPnlPercentage: (backtest: boolean, symbol: string, context: {
|
|
26724
|
+
strategyName: StrategyName;
|
|
26725
|
+
exchangeName: ExchangeName;
|
|
26726
|
+
frameName: FrameName;
|
|
26727
|
+
}) => Promise<number | null>;
|
|
26728
|
+
/**
|
|
26729
|
+
* Returns the PnL cost (in quote currency) at the moment the worst loss price was recorded during this position's life.
|
|
26730
|
+
*
|
|
26731
|
+
* @param backtest - Whether running in backtest mode
|
|
26732
|
+
* @param symbol - Trading pair symbol
|
|
26733
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
26734
|
+
* @returns Promise resolving to PnL cost or null
|
|
26735
|
+
*/
|
|
26736
|
+
getPositionMaxDrawdownPnlCost: (backtest: boolean, symbol: string, context: {
|
|
26737
|
+
strategyName: StrategyName;
|
|
26738
|
+
exchangeName: ExchangeName;
|
|
26739
|
+
frameName: FrameName;
|
|
26740
|
+
}) => Promise<number | null>;
|
|
25890
26741
|
}
|
|
25891
26742
|
|
|
25892
26743
|
/**
|
|
@@ -28426,6 +29277,52 @@ declare class HighestProfitReportService {
|
|
|
28426
29277
|
unsubscribe: () => Promise<void>;
|
|
28427
29278
|
}
|
|
28428
29279
|
|
|
29280
|
+
/**
|
|
29281
|
+
* Service for logging max drawdown events to the JSONL report database.
|
|
29282
|
+
*
|
|
29283
|
+
* Listens to maxDrawdownSubject and writes each new drawdown record to
|
|
29284
|
+
* Report.writeData() for persistence and analytics.
|
|
29285
|
+
*/
|
|
29286
|
+
declare class MaxDrawdownReportService {
|
|
29287
|
+
private readonly loggerService;
|
|
29288
|
+
/**
|
|
29289
|
+
* Handles a single `MaxDrawdownContract` event emitted by `maxDrawdownSubject`.
|
|
29290
|
+
*
|
|
29291
|
+
* Writes a JSONL record to the `"max_drawdown"` report database via
|
|
29292
|
+
* `Report.writeData`, capturing the full signal snapshot at the moment
|
|
29293
|
+
* the new drawdown record was set:
|
|
29294
|
+
* - `timestamp`, `symbol`, `strategyName`, `exchangeName`, `frameName`, `backtest`
|
|
29295
|
+
* - `signalId`, `position`, `currentPrice`
|
|
29296
|
+
* - `priceOpen`, `priceTakeProfit`, `priceStopLoss` (effective values from the signal)
|
|
29297
|
+
*
|
|
29298
|
+
* `strategyName` and signal-level fields are sourced from `data.signal`
|
|
29299
|
+
* rather than the contract root.
|
|
29300
|
+
*
|
|
29301
|
+
* @param data - `MaxDrawdownContract` payload containing `symbol`,
|
|
29302
|
+
* `signal`, `currentPrice`, `backtest`, `timestamp`, `exchangeName`,
|
|
29303
|
+
* `frameName`
|
|
29304
|
+
*/
|
|
29305
|
+
private tick;
|
|
29306
|
+
/**
|
|
29307
|
+
* Subscribes to `maxDrawdownSubject` to start persisting drawdown records.
|
|
29308
|
+
* Protected against multiple subscriptions via `singleshot` — subsequent
|
|
29309
|
+
* calls return the same unsubscribe function without re-subscribing.
|
|
29310
|
+
*
|
|
29311
|
+
* The returned unsubscribe function clears the `singleshot` state and
|
|
29312
|
+
* detaches from `maxDrawdownSubject`.
|
|
29313
|
+
*
|
|
29314
|
+
* @returns Unsubscribe function; calling it tears down the subscription
|
|
29315
|
+
*/
|
|
29316
|
+
subscribe: (() => () => void) & functools_kit.ISingleshotClearable;
|
|
29317
|
+
/**
|
|
29318
|
+
* Detaches from `maxDrawdownSubject`, stopping further JSONL writes.
|
|
29319
|
+
*
|
|
29320
|
+
* Calls the unsubscribe closure returned by `subscribe()`.
|
|
29321
|
+
* If `subscribe()` was never called, does nothing.
|
|
29322
|
+
*/
|
|
29323
|
+
unsubscribe: () => Promise<void>;
|
|
29324
|
+
}
|
|
29325
|
+
|
|
28429
29326
|
declare const backtest: {
|
|
28430
29327
|
exchangeValidationService: ExchangeValidationService;
|
|
28431
29328
|
strategyValidationService: StrategyValidationService;
|
|
@@ -28448,6 +29345,7 @@ declare const backtest: {
|
|
|
28448
29345
|
strategyReportService: StrategyReportService;
|
|
28449
29346
|
syncReportService: SyncReportService;
|
|
28450
29347
|
highestProfitReportService: HighestProfitReportService;
|
|
29348
|
+
maxDrawdownReportService: MaxDrawdownReportService;
|
|
28451
29349
|
backtestMarkdownService: BacktestMarkdownService;
|
|
28452
29350
|
liveMarkdownService: LiveMarkdownService;
|
|
28453
29351
|
scheduleMarkdownService: ScheduleMarkdownService;
|
|
@@ -28460,6 +29358,7 @@ declare const backtest: {
|
|
|
28460
29358
|
strategyMarkdownService: StrategyMarkdownService;
|
|
28461
29359
|
syncMarkdownService: SyncMarkdownService;
|
|
28462
29360
|
highestProfitMarkdownService: HighestProfitMarkdownService;
|
|
29361
|
+
maxDrawdownMarkdownService: MaxDrawdownMarkdownService;
|
|
28463
29362
|
backtestLogicPublicService: BacktestLogicPublicService;
|
|
28464
29363
|
liveLogicPublicService: LiveLogicPublicService;
|
|
28465
29364
|
walkerLogicPublicService: WalkerLogicPublicService;
|
|
@@ -28579,4 +29478,4 @@ declare const getTotalClosed: (signal: Signal) => {
|
|
|
28579
29478
|
remainingCostBasis: number;
|
|
28580
29479
|
};
|
|
28581
29480
|
|
|
28582
|
-
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, 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, 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, getPositionHighestProfitPrice, getPositionHighestProfitTimestamp, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, 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, 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, searchMemory, set, setColumns, setConfig, setLogger, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, validateCommonSignal, validatePendingSignal, validateScheduledSignal, validateSignal, waitForCandle, warmCandles, writeMemory };
|
|
29481
|
+
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, 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, 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 };
|