backtest-kit 6.5.2 → 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 +1752 -111
- package/build/index.mjs +1744 -112
- package/package.json +1 -1
- package/types.d.ts +951 -98
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).
|
|
@@ -8826,6 +9075,10 @@ interface IHeatmapRow {
|
|
|
8826
9075
|
maxLossStreak: number;
|
|
8827
9076
|
/** Expectancy: (winRate * avgWin) - (lossRate * avgLoss) */
|
|
8828
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;
|
|
8829
9082
|
}
|
|
8830
9083
|
|
|
8831
9084
|
/**
|
|
@@ -10111,6 +10364,10 @@ interface TickEvent {
|
|
|
10111
10364
|
pendingAt?: number;
|
|
10112
10365
|
/** Timestamp when signal was created/scheduled (only for scheduled/waiting/opened/active/closed/cancelled) */
|
|
10113
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;
|
|
10114
10371
|
}
|
|
10115
10372
|
/**
|
|
10116
10373
|
* Statistical data calculated from live trading results.
|
|
@@ -10162,6 +10419,10 @@ interface LiveStatisticsModel {
|
|
|
10162
10419
|
certaintyRatio: number | null;
|
|
10163
10420
|
/** Expected yearly returns based on average trade duration and PNL, null if unsafe. Higher is better. */
|
|
10164
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;
|
|
10165
10426
|
}
|
|
10166
10427
|
|
|
10167
10428
|
/**
|
|
@@ -10179,6 +10440,10 @@ interface HeatmapStatisticsModel {
|
|
|
10179
10440
|
portfolioSharpeRatio: number | null;
|
|
10180
10441
|
/** Portfolio-wide total trades */
|
|
10181
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;
|
|
10182
10447
|
}
|
|
10183
10448
|
|
|
10184
10449
|
/**
|
|
@@ -10485,6 +10750,43 @@ interface HighestProfitStatisticsModel {
|
|
|
10485
10750
|
totalEvents: number;
|
|
10486
10751
|
}
|
|
10487
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
|
+
|
|
10488
10790
|
/**
|
|
10489
10791
|
* Risk rejection event data for report generation.
|
|
10490
10792
|
* Contains all information about rejected signals due to risk limits.
|
|
@@ -11882,6 +12184,8 @@ interface IReportTarget {
|
|
|
11882
12184
|
sync: boolean;
|
|
11883
12185
|
/** Enable highest profit milestone event logging */
|
|
11884
12186
|
highest_profit: boolean;
|
|
12187
|
+
/** Enable max drawdown milestone event logging */
|
|
12188
|
+
max_drawdown: boolean;
|
|
11885
12189
|
}
|
|
11886
12190
|
/**
|
|
11887
12191
|
* Union type of all valid report names.
|
|
@@ -12033,7 +12337,7 @@ declare class ReportUtils {
|
|
|
12033
12337
|
*
|
|
12034
12338
|
* @returns Cleanup function that unsubscribes from all enabled services
|
|
12035
12339
|
*/
|
|
12036
|
-
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;
|
|
12037
12341
|
/**
|
|
12038
12342
|
* Disables report services selectively.
|
|
12039
12343
|
*
|
|
@@ -12070,7 +12374,7 @@ declare class ReportUtils {
|
|
|
12070
12374
|
* Report.disable();
|
|
12071
12375
|
* ```
|
|
12072
12376
|
*/
|
|
12073
|
-
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;
|
|
12074
12378
|
}
|
|
12075
12379
|
/**
|
|
12076
12380
|
* Report adapter with pluggable storage backend and instance memoization.
|
|
@@ -12170,6 +12474,8 @@ interface IMarkdownTarget {
|
|
|
12170
12474
|
sync: boolean;
|
|
12171
12475
|
/** Enable highest profit milestone tracking reports */
|
|
12172
12476
|
highest_profit: boolean;
|
|
12477
|
+
/** Enable max drawdown milestone tracking reports */
|
|
12478
|
+
max_drawdown: boolean;
|
|
12173
12479
|
}
|
|
12174
12480
|
/** Symbol key for the singleshot waitForInit function on MarkdownFileBase instances. */
|
|
12175
12481
|
declare const WAIT_FOR_INIT_SYMBOL: unique symbol;
|
|
@@ -12367,7 +12673,7 @@ declare class MarkdownUtils {
|
|
|
12367
12673
|
*
|
|
12368
12674
|
* @returns Cleanup function that unsubscribes from all enabled services
|
|
12369
12675
|
*/
|
|
12370
|
-
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;
|
|
12371
12677
|
/**
|
|
12372
12678
|
* Disables markdown report services selectively.
|
|
12373
12679
|
*
|
|
@@ -12405,7 +12711,7 @@ declare class MarkdownUtils {
|
|
|
12405
12711
|
* Markdown.disable();
|
|
12406
12712
|
* ```
|
|
12407
12713
|
*/
|
|
12408
|
-
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;
|
|
12409
12715
|
}
|
|
12410
12716
|
/**
|
|
12411
12717
|
* Markdown adapter with pluggable storage backend and instance memoization.
|
|
@@ -12617,7 +12923,7 @@ declare const Log: LogAdapter;
|
|
|
12617
12923
|
* @see ColumnModel for the base interface
|
|
12618
12924
|
* @see IStrategyTickResultClosed for the signal data structure
|
|
12619
12925
|
*/
|
|
12620
|
-
type Columns$
|
|
12926
|
+
type Columns$b = ColumnModel<IStrategyTickResultClosed>;
|
|
12621
12927
|
/**
|
|
12622
12928
|
* Service for generating and saving backtest markdown reports.
|
|
12623
12929
|
*
|
|
@@ -12711,7 +13017,7 @@ declare class BacktestMarkdownService {
|
|
|
12711
13017
|
* console.log(markdown);
|
|
12712
13018
|
* ```
|
|
12713
13019
|
*/
|
|
12714
|
-
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>;
|
|
12715
13021
|
/**
|
|
12716
13022
|
* Saves symbol-strategy report to disk.
|
|
12717
13023
|
* Creates directory if it doesn't exist.
|
|
@@ -12736,7 +13042,7 @@ declare class BacktestMarkdownService {
|
|
|
12736
13042
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", true, "./custom/path");
|
|
12737
13043
|
* ```
|
|
12738
13044
|
*/
|
|
12739
|
-
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>;
|
|
12740
13046
|
/**
|
|
12741
13047
|
* Clears accumulated signal data from storage.
|
|
12742
13048
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -13276,6 +13582,97 @@ declare class BacktestUtils {
|
|
|
13276
13582
|
exchangeName: ExchangeName;
|
|
13277
13583
|
frameName: FrameName;
|
|
13278
13584
|
}) => Promise<number>;
|
|
13585
|
+
/**
|
|
13586
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
13587
|
+
*
|
|
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.
|
|
13593
|
+
*
|
|
13594
|
+
* @param symbol - Trading pair symbol
|
|
13595
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
13596
|
+
* @returns Minutes since last profit peak, or null if no active position
|
|
13597
|
+
*/
|
|
13598
|
+
getPositionHighestProfitMinutes: (symbol: string, context: {
|
|
13599
|
+
strategyName: StrategyName;
|
|
13600
|
+
exchangeName: ExchangeName;
|
|
13601
|
+
frameName: FrameName;
|
|
13602
|
+
}) => Promise<number>;
|
|
13603
|
+
/**
|
|
13604
|
+
* Returns the number of minutes elapsed since the worst loss price was recorded.
|
|
13605
|
+
*
|
|
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.
|
|
13610
|
+
*
|
|
13611
|
+
* @param symbol - Trading pair symbol
|
|
13612
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
13613
|
+
* @returns Minutes since last drawdown trough, or null if no active position
|
|
13614
|
+
*/
|
|
13615
|
+
getPositionMaxDrawdownMinutes: (symbol: string, context: {
|
|
13616
|
+
strategyName: StrategyName;
|
|
13617
|
+
exchangeName: ExchangeName;
|
|
13618
|
+
frameName: FrameName;
|
|
13619
|
+
}) => Promise<number>;
|
|
13620
|
+
/**
|
|
13621
|
+
* Returns the worst price reached in the loss direction during this position's life.
|
|
13622
|
+
*
|
|
13623
|
+
* Returns null if no pending signal exists.
|
|
13624
|
+
*
|
|
13625
|
+
* @param symbol - Trading pair symbol
|
|
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>;
|
|
13279
13676
|
/**
|
|
13280
13677
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
13281
13678
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -13793,7 +14190,7 @@ declare class BacktestUtils {
|
|
|
13793
14190
|
strategyName: StrategyName;
|
|
13794
14191
|
exchangeName: ExchangeName;
|
|
13795
14192
|
frameName: FrameName;
|
|
13796
|
-
}, columns?: Columns$
|
|
14193
|
+
}, columns?: Columns$b[]) => Promise<string>;
|
|
13797
14194
|
/**
|
|
13798
14195
|
* Saves strategy report to disk.
|
|
13799
14196
|
*
|
|
@@ -13824,7 +14221,7 @@ declare class BacktestUtils {
|
|
|
13824
14221
|
strategyName: StrategyName;
|
|
13825
14222
|
exchangeName: ExchangeName;
|
|
13826
14223
|
frameName: FrameName;
|
|
13827
|
-
}, path?: string, columns?: Columns$
|
|
14224
|
+
}, path?: string, columns?: Columns$b[]) => Promise<void>;
|
|
13828
14225
|
/**
|
|
13829
14226
|
* Lists all active backtest instances with their current status.
|
|
13830
14227
|
*
|
|
@@ -13898,7 +14295,7 @@ declare const Backtest: BacktestUtils;
|
|
|
13898
14295
|
* @see ColumnModel for the base interface
|
|
13899
14296
|
* @see TickEvent for the event data structure
|
|
13900
14297
|
*/
|
|
13901
|
-
type Columns$
|
|
14298
|
+
type Columns$a = ColumnModel<TickEvent>;
|
|
13902
14299
|
/**
|
|
13903
14300
|
* Service for generating and saving live trading markdown reports.
|
|
13904
14301
|
*
|
|
@@ -14025,7 +14422,7 @@ declare class LiveMarkdownService {
|
|
|
14025
14422
|
* console.log(markdown);
|
|
14026
14423
|
* ```
|
|
14027
14424
|
*/
|
|
14028
|
-
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>;
|
|
14029
14426
|
/**
|
|
14030
14427
|
* Saves symbol-strategy report to disk.
|
|
14031
14428
|
* Creates directory if it doesn't exist.
|
|
@@ -14050,7 +14447,7 @@ declare class LiveMarkdownService {
|
|
|
14050
14447
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
14051
14448
|
* ```
|
|
14052
14449
|
*/
|
|
14053
|
-
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>;
|
|
14054
14451
|
/**
|
|
14055
14452
|
* Clears accumulated event data from storage.
|
|
14056
14453
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -14549,6 +14946,91 @@ declare class LiveUtils {
|
|
|
14549
14946
|
strategyName: StrategyName;
|
|
14550
14947
|
exchangeName: ExchangeName;
|
|
14551
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>;
|
|
14552
15034
|
/**
|
|
14553
15035
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
14554
15036
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -15034,7 +15516,7 @@ declare class LiveUtils {
|
|
|
15034
15516
|
getReport: (symbol: string, context: {
|
|
15035
15517
|
strategyName: StrategyName;
|
|
15036
15518
|
exchangeName: ExchangeName;
|
|
15037
|
-
}, columns?: Columns$
|
|
15519
|
+
}, columns?: Columns$a[]) => Promise<string>;
|
|
15038
15520
|
/**
|
|
15039
15521
|
* Saves strategy report to disk.
|
|
15040
15522
|
*
|
|
@@ -15064,7 +15546,7 @@ declare class LiveUtils {
|
|
|
15064
15546
|
dump: (symbol: string, context: {
|
|
15065
15547
|
strategyName: StrategyName;
|
|
15066
15548
|
exchangeName: ExchangeName;
|
|
15067
|
-
}, path?: string, columns?: Columns$
|
|
15549
|
+
}, path?: string, columns?: Columns$a[]) => Promise<void>;
|
|
15068
15550
|
/**
|
|
15069
15551
|
* Lists all active live trading instances with their current status.
|
|
15070
15552
|
*
|
|
@@ -15134,7 +15616,7 @@ declare const Live: LiveUtils;
|
|
|
15134
15616
|
* @see ColumnModel for the base interface
|
|
15135
15617
|
* @see ScheduledEvent for the event data structure
|
|
15136
15618
|
*/
|
|
15137
|
-
type Columns$
|
|
15619
|
+
type Columns$9 = ColumnModel<ScheduledEvent>;
|
|
15138
15620
|
/**
|
|
15139
15621
|
* Service for generating and saving scheduled signals markdown reports.
|
|
15140
15622
|
*
|
|
@@ -15245,7 +15727,7 @@ declare class ScheduleMarkdownService {
|
|
|
15245
15727
|
* console.log(markdown);
|
|
15246
15728
|
* ```
|
|
15247
15729
|
*/
|
|
15248
|
-
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>;
|
|
15249
15731
|
/**
|
|
15250
15732
|
* Saves symbol-strategy report to disk.
|
|
15251
15733
|
* Creates directory if it doesn't exist.
|
|
@@ -15270,7 +15752,7 @@ declare class ScheduleMarkdownService {
|
|
|
15270
15752
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
15271
15753
|
* ```
|
|
15272
15754
|
*/
|
|
15273
|
-
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>;
|
|
15274
15756
|
/**
|
|
15275
15757
|
* Clears accumulated event data from storage.
|
|
15276
15758
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -15360,7 +15842,7 @@ declare class ScheduleUtils {
|
|
|
15360
15842
|
strategyName: StrategyName;
|
|
15361
15843
|
exchangeName: ExchangeName;
|
|
15362
15844
|
frameName: FrameName;
|
|
15363
|
-
}, backtest?: boolean, columns?: Columns$
|
|
15845
|
+
}, backtest?: boolean, columns?: Columns$9[]) => Promise<string>;
|
|
15364
15846
|
/**
|
|
15365
15847
|
* Saves strategy report to disk.
|
|
15366
15848
|
*
|
|
@@ -15382,7 +15864,7 @@ declare class ScheduleUtils {
|
|
|
15382
15864
|
strategyName: StrategyName;
|
|
15383
15865
|
exchangeName: ExchangeName;
|
|
15384
15866
|
frameName: FrameName;
|
|
15385
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
15867
|
+
}, backtest?: boolean, path?: string, columns?: Columns$9[]) => Promise<void>;
|
|
15386
15868
|
}
|
|
15387
15869
|
/**
|
|
15388
15870
|
* Singleton instance of ScheduleUtils for convenient scheduled signals reporting.
|
|
@@ -15428,7 +15910,7 @@ declare const Schedule: ScheduleUtils;
|
|
|
15428
15910
|
* @see ColumnModel for the base interface
|
|
15429
15911
|
* @see MetricStats for the metric data structure
|
|
15430
15912
|
*/
|
|
15431
|
-
type Columns$
|
|
15913
|
+
type Columns$8 = ColumnModel<MetricStats>;
|
|
15432
15914
|
/**
|
|
15433
15915
|
* Service for collecting and analyzing performance metrics.
|
|
15434
15916
|
*
|
|
@@ -15535,7 +16017,7 @@ declare class PerformanceMarkdownService {
|
|
|
15535
16017
|
* console.log(markdown);
|
|
15536
16018
|
* ```
|
|
15537
16019
|
*/
|
|
15538
|
-
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>;
|
|
15539
16021
|
/**
|
|
15540
16022
|
* Saves performance report to disk.
|
|
15541
16023
|
*
|
|
@@ -15556,7 +16038,7 @@ declare class PerformanceMarkdownService {
|
|
|
15556
16038
|
* await performanceService.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
15557
16039
|
* ```
|
|
15558
16040
|
*/
|
|
15559
|
-
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>;
|
|
15560
16042
|
/**
|
|
15561
16043
|
* Clears accumulated performance data from storage.
|
|
15562
16044
|
*
|
|
@@ -15664,7 +16146,7 @@ declare class Performance {
|
|
|
15664
16146
|
strategyName: StrategyName;
|
|
15665
16147
|
exchangeName: ExchangeName;
|
|
15666
16148
|
frameName: FrameName;
|
|
15667
|
-
}, backtest?: boolean, columns?: Columns$
|
|
16149
|
+
}, backtest?: boolean, columns?: Columns$8[]): Promise<string>;
|
|
15668
16150
|
/**
|
|
15669
16151
|
* Saves performance report to disk.
|
|
15670
16152
|
*
|
|
@@ -15689,7 +16171,7 @@ declare class Performance {
|
|
|
15689
16171
|
strategyName: StrategyName;
|
|
15690
16172
|
exchangeName: ExchangeName;
|
|
15691
16173
|
frameName: FrameName;
|
|
15692
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
16174
|
+
}, backtest?: boolean, path?: string, columns?: Columns$8[]): Promise<void>;
|
|
15693
16175
|
}
|
|
15694
16176
|
|
|
15695
16177
|
/**
|
|
@@ -16120,7 +16602,7 @@ declare const Walker: WalkerUtils;
|
|
|
16120
16602
|
* @see ColumnModel for the base interface
|
|
16121
16603
|
* @see IHeatmapRow for the row data structure
|
|
16122
16604
|
*/
|
|
16123
|
-
type Columns$
|
|
16605
|
+
type Columns$7 = ColumnModel<IHeatmapRow>;
|
|
16124
16606
|
/**
|
|
16125
16607
|
* Portfolio Heatmap Markdown Service.
|
|
16126
16608
|
*
|
|
@@ -16255,7 +16737,7 @@ declare class HeatMarkdownService {
|
|
|
16255
16737
|
* // | ETHUSDT | +12.3% | 1.85 | -3.1% | 38 |
|
|
16256
16738
|
* ```
|
|
16257
16739
|
*/
|
|
16258
|
-
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>;
|
|
16259
16741
|
/**
|
|
16260
16742
|
* Generates the heatmap report and writes it to disk.
|
|
16261
16743
|
*
|
|
@@ -16283,7 +16765,7 @@ declare class HeatMarkdownService {
|
|
|
16283
16765
|
* await service.dump("my-strategy", "binance", "frame1", true, "./reports");
|
|
16284
16766
|
* ```
|
|
16285
16767
|
*/
|
|
16286
|
-
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>;
|
|
16287
16769
|
/**
|
|
16288
16770
|
* Evicts memoized `HeatmapStorage` instances, releasing all accumulated signal data.
|
|
16289
16771
|
*
|
|
@@ -16419,7 +16901,7 @@ declare class HeatUtils {
|
|
|
16419
16901
|
strategyName: StrategyName;
|
|
16420
16902
|
exchangeName: ExchangeName;
|
|
16421
16903
|
frameName: FrameName;
|
|
16422
|
-
}, backtest?: boolean, columns?: Columns$
|
|
16904
|
+
}, backtest?: boolean, columns?: Columns$7[]) => Promise<string>;
|
|
16423
16905
|
/**
|
|
16424
16906
|
* Saves heatmap report to disk for a strategy.
|
|
16425
16907
|
*
|
|
@@ -16452,7 +16934,7 @@ declare class HeatUtils {
|
|
|
16452
16934
|
strategyName: StrategyName;
|
|
16453
16935
|
exchangeName: ExchangeName;
|
|
16454
16936
|
frameName: FrameName;
|
|
16455
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
16937
|
+
}, backtest?: boolean, path?: string, columns?: Columns$7[]) => Promise<void>;
|
|
16456
16938
|
}
|
|
16457
16939
|
/**
|
|
16458
16940
|
* Singleton instance of HeatUtils for convenient heatmap operations.
|
|
@@ -16606,7 +17088,7 @@ declare const PositionSize: typeof PositionSizeUtils;
|
|
|
16606
17088
|
* @see ColumnModel for the base interface
|
|
16607
17089
|
* @see PartialEvent for the event data structure
|
|
16608
17090
|
*/
|
|
16609
|
-
type Columns$
|
|
17091
|
+
type Columns$6 = ColumnModel<PartialEvent>;
|
|
16610
17092
|
/**
|
|
16611
17093
|
* Service for generating and saving partial profit/loss markdown reports.
|
|
16612
17094
|
*
|
|
@@ -16728,7 +17210,7 @@ declare class PartialMarkdownService {
|
|
|
16728
17210
|
* console.log(markdown);
|
|
16729
17211
|
* ```
|
|
16730
17212
|
*/
|
|
16731
|
-
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>;
|
|
16732
17214
|
/**
|
|
16733
17215
|
* Saves symbol-strategy report to disk.
|
|
16734
17216
|
* Creates directory if it doesn't exist.
|
|
@@ -16753,7 +17235,7 @@ declare class PartialMarkdownService {
|
|
|
16753
17235
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
16754
17236
|
* ```
|
|
16755
17237
|
*/
|
|
16756
|
-
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>;
|
|
16757
17239
|
/**
|
|
16758
17240
|
* Clears accumulated event data from storage.
|
|
16759
17241
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -16889,7 +17371,7 @@ declare class PartialUtils {
|
|
|
16889
17371
|
strategyName: StrategyName;
|
|
16890
17372
|
exchangeName: ExchangeName;
|
|
16891
17373
|
frameName: FrameName;
|
|
16892
|
-
}, backtest?: boolean, columns?: Columns$
|
|
17374
|
+
}, backtest?: boolean, columns?: Columns$6[]) => Promise<string>;
|
|
16893
17375
|
/**
|
|
16894
17376
|
* Generates and saves markdown report to file.
|
|
16895
17377
|
*
|
|
@@ -16926,7 +17408,7 @@ declare class PartialUtils {
|
|
|
16926
17408
|
strategyName: StrategyName;
|
|
16927
17409
|
exchangeName: ExchangeName;
|
|
16928
17410
|
frameName: FrameName;
|
|
16929
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
17411
|
+
}, backtest?: boolean, path?: string, columns?: Columns$6[]) => Promise<void>;
|
|
16930
17412
|
}
|
|
16931
17413
|
/**
|
|
16932
17414
|
* Global singleton instance of PartialUtils.
|
|
@@ -16947,7 +17429,7 @@ declare const Partial$1: PartialUtils;
|
|
|
16947
17429
|
/**
|
|
16948
17430
|
* Type alias for column configuration used in highest profit markdown reports.
|
|
16949
17431
|
*/
|
|
16950
|
-
type Columns$
|
|
17432
|
+
type Columns$5 = ColumnModel<HighestProfitEvent>;
|
|
16951
17433
|
/**
|
|
16952
17434
|
* Service for generating and saving highest profit markdown reports.
|
|
16953
17435
|
*
|
|
@@ -17023,63 +17505,185 @@ declare class HighestProfitMarkdownService {
|
|
|
17023
17505
|
* `eventList` (newest first) and `totalEvents`
|
|
17024
17506
|
* @throws {Error} If `subscribe()` has not been called before this method
|
|
17025
17507
|
*/
|
|
17026
|
-
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;
|
|
17027
17670
|
/**
|
|
17028
|
-
*
|
|
17029
|
-
|
|
17030
|
-
|
|
17031
|
-
|
|
17032
|
-
*
|
|
17033
|
-
* @param symbol - Trading pair symbol (e.g. `"BTCUSDT"`)
|
|
17034
|
-
* @param strategyName - Strategy identifier
|
|
17035
|
-
* @param exchangeName - Exchange identifier (e.g. `"binance"`)
|
|
17036
|
-
* @param frameName - Backtest frame identifier; empty string for live mode
|
|
17037
|
-
* @param backtest - `true` for backtest mode, `false` for live mode
|
|
17038
|
-
* @param columns - Column definitions controlling the table layout;
|
|
17039
|
-
* defaults to `COLUMN_CONFIG.highest_profit_columns`
|
|
17040
|
-
* @returns Promise resolving to the full markdown string
|
|
17041
|
-
* @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.
|
|
17042
17676
|
*/
|
|
17043
17677
|
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$4[]) => Promise<string>;
|
|
17044
17678
|
/**
|
|
17045
|
-
* Generates the
|
|
17046
|
-
*
|
|
17047
|
-
* Delegates to `ReportStorage.dump`. The filename follows the pattern:
|
|
17048
|
-
* - Backtest: `{symbol}_{strategyName}_{exchangeName}_{frameName}_backtest-{timestamp}.md`
|
|
17049
|
-
* - Live: `{symbol}_{strategyName}_{exchangeName}_live-{timestamp}.md`
|
|
17050
|
-
*
|
|
17051
|
-
* @param symbol - Trading pair symbol (e.g. `"BTCUSDT"`)
|
|
17052
|
-
* @param strategyName - Strategy identifier
|
|
17053
|
-
* @param exchangeName - Exchange identifier (e.g. `"binance"`)
|
|
17054
|
-
* @param frameName - Backtest frame identifier; empty string for live mode
|
|
17055
|
-
* @param backtest - `true` for backtest mode, `false` for live mode
|
|
17056
|
-
* @param path - Directory to write the file into; defaults to `"./dump/highest_profit"`
|
|
17057
|
-
* @param columns - Column definitions for table formatting;
|
|
17058
|
-
* defaults to `COLUMN_CONFIG.highest_profit_columns`
|
|
17059
|
-
* @throws {Error} If `subscribe()` has not been called before this method
|
|
17679
|
+
* Generates the max drawdown report and writes it to disk.
|
|
17060
17680
|
*/
|
|
17061
17681
|
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$4[]) => Promise<void>;
|
|
17062
17682
|
/**
|
|
17063
17683
|
* Evicts memoized `ReportStorage` instances, releasing all accumulated event data.
|
|
17064
17684
|
*
|
|
17065
|
-
* - With `payload` — clears only the storage bucket
|
|
17066
|
-
* `(symbol, strategyName, exchangeName, frameName, backtest)`;
|
|
17067
|
-
* subsequent calls for that combination start from an empty state.
|
|
17685
|
+
* - With `payload` — clears only the storage bucket for that combination.
|
|
17068
17686
|
* - Without `payload` — clears **all** storage buckets.
|
|
17069
|
-
*
|
|
17070
|
-
* Also called internally by the unsubscribe closure returned from `subscribe()`.
|
|
17071
|
-
*
|
|
17072
|
-
* @param payload - Optional scope to restrict which bucket is cleared;
|
|
17073
|
-
* omit to clear everything
|
|
17074
|
-
*
|
|
17075
|
-
* @example
|
|
17076
|
-
* ```typescript
|
|
17077
|
-
* // Clear one specific context
|
|
17078
|
-
* await service.clear({ symbol: "BTCUSDT", strategyName: "my-strategy", exchangeName: "binance", frameName: "1m-btc", backtest: true });
|
|
17079
|
-
*
|
|
17080
|
-
* // Clear all contexts
|
|
17081
|
-
* await service.clear();
|
|
17082
|
-
* ```
|
|
17083
17687
|
*/
|
|
17084
17688
|
clear: (payload?: {
|
|
17085
17689
|
symbol: string;
|
|
@@ -17091,36 +17695,36 @@ declare class HighestProfitMarkdownService {
|
|
|
17091
17695
|
}
|
|
17092
17696
|
|
|
17093
17697
|
/**
|
|
17094
|
-
* Utility class for accessing
|
|
17698
|
+
* Utility class for accessing max drawdown reports and statistics.
|
|
17095
17699
|
*
|
|
17096
17700
|
* Provides static-like methods (via singleton instance) to retrieve data
|
|
17097
|
-
* accumulated by
|
|
17701
|
+
* accumulated by MaxDrawdownMarkdownService from maxDrawdownSubject events.
|
|
17098
17702
|
*
|
|
17099
17703
|
* @example
|
|
17100
17704
|
* ```typescript
|
|
17101
|
-
* import {
|
|
17705
|
+
* import { MaxDrawdown } from "backtest-kit";
|
|
17102
17706
|
*
|
|
17103
|
-
* const stats = await
|
|
17104
|
-
* const report = await
|
|
17105
|
-
* 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 });
|
|
17106
17710
|
* ```
|
|
17107
17711
|
*/
|
|
17108
|
-
declare class
|
|
17712
|
+
declare class MaxDrawdownUtils {
|
|
17109
17713
|
/**
|
|
17110
|
-
* Retrieves statistical data from accumulated
|
|
17714
|
+
* Retrieves statistical data from accumulated max drawdown events.
|
|
17111
17715
|
*
|
|
17112
17716
|
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
17113
17717
|
* @param context - Execution context
|
|
17114
17718
|
* @param backtest - Whether to query backtest data
|
|
17115
|
-
* @returns Promise resolving to
|
|
17719
|
+
* @returns Promise resolving to MaxDrawdownStatisticsModel
|
|
17116
17720
|
*/
|
|
17117
17721
|
getData: (symbol: string, context: {
|
|
17118
17722
|
strategyName: StrategyName;
|
|
17119
17723
|
exchangeName: ExchangeName;
|
|
17120
17724
|
frameName: FrameName;
|
|
17121
|
-
}, backtest?: boolean) => Promise<
|
|
17725
|
+
}, backtest?: boolean) => Promise<MaxDrawdownStatisticsModel>;
|
|
17122
17726
|
/**
|
|
17123
|
-
* Generates a markdown report with all
|
|
17727
|
+
* Generates a markdown report with all max drawdown events for a symbol-strategy pair.
|
|
17124
17728
|
*
|
|
17125
17729
|
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
17126
17730
|
* @param context - Execution context
|
|
@@ -17139,7 +17743,7 @@ declare class HighestProfitUtils {
|
|
|
17139
17743
|
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
17140
17744
|
* @param context - Execution context
|
|
17141
17745
|
* @param backtest - Whether to query backtest data
|
|
17142
|
-
* @param path - Output directory path (default: "./dump/
|
|
17746
|
+
* @param path - Output directory path (default: "./dump/max_drawdown")
|
|
17143
17747
|
* @param columns - Optional column configuration
|
|
17144
17748
|
*/
|
|
17145
17749
|
dump: (symbol: string, context: {
|
|
@@ -17149,9 +17753,9 @@ declare class HighestProfitUtils {
|
|
|
17149
17753
|
}, backtest?: boolean, path?: string, columns?: Columns$4[]) => Promise<void>;
|
|
17150
17754
|
}
|
|
17151
17755
|
/**
|
|
17152
|
-
* Global singleton instance of
|
|
17756
|
+
* Global singleton instance of MaxDrawdownUtils.
|
|
17153
17757
|
*/
|
|
17154
|
-
declare const
|
|
17758
|
+
declare const MaxDrawdown: MaxDrawdownUtils;
|
|
17155
17759
|
|
|
17156
17760
|
/**
|
|
17157
17761
|
* Utility class containing predefined trading constants for take-profit and stop-loss levels.
|
|
@@ -21992,6 +22596,12 @@ declare const backtestScheduleOpenSubject: Subject<IStrategyTickResultOpened>;
|
|
|
21992
22596
|
* Allows users to track profit milestones and implement custom management logic based on profit levels.
|
|
21993
22597
|
*/
|
|
21994
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>;
|
|
21995
22605
|
|
|
21996
22606
|
declare const emitters_activePingSubject: typeof activePingSubject;
|
|
21997
22607
|
declare const emitters_backtestScheduleOpenSubject: typeof backtestScheduleOpenSubject;
|
|
@@ -22002,6 +22612,7 @@ declare const emitters_doneWalkerSubject: typeof doneWalkerSubject;
|
|
|
22002
22612
|
declare const emitters_errorEmitter: typeof errorEmitter;
|
|
22003
22613
|
declare const emitters_exitEmitter: typeof exitEmitter;
|
|
22004
22614
|
declare const emitters_highestProfitSubject: typeof highestProfitSubject;
|
|
22615
|
+
declare const emitters_maxDrawdownSubject: typeof maxDrawdownSubject;
|
|
22005
22616
|
declare const emitters_partialLossSubject: typeof partialLossSubject;
|
|
22006
22617
|
declare const emitters_partialProfitSubject: typeof partialProfitSubject;
|
|
22007
22618
|
declare const emitters_performanceEmitter: typeof performanceEmitter;
|
|
@@ -22020,7 +22631,7 @@ declare const emitters_walkerCompleteSubject: typeof walkerCompleteSubject;
|
|
|
22020
22631
|
declare const emitters_walkerEmitter: typeof walkerEmitter;
|
|
22021
22632
|
declare const emitters_walkerStopSubject: typeof walkerStopSubject;
|
|
22022
22633
|
declare namespace emitters {
|
|
22023
|
-
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 };
|
|
22024
22635
|
}
|
|
22025
22636
|
|
|
22026
22637
|
/**
|
|
@@ -24056,6 +24667,110 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
24056
24667
|
exchangeName: ExchangeName;
|
|
24057
24668
|
frameName: FrameName;
|
|
24058
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>;
|
|
24059
24774
|
/**
|
|
24060
24775
|
* Disposes the ClientStrategy instance for the given context.
|
|
24061
24776
|
*
|
|
@@ -25933,6 +26648,96 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
25933
26648
|
exchangeName: ExchangeName;
|
|
25934
26649
|
frameName: FrameName;
|
|
25935
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>;
|
|
25936
26741
|
}
|
|
25937
26742
|
|
|
25938
26743
|
/**
|
|
@@ -28472,6 +29277,52 @@ declare class HighestProfitReportService {
|
|
|
28472
29277
|
unsubscribe: () => Promise<void>;
|
|
28473
29278
|
}
|
|
28474
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
|
+
|
|
28475
29326
|
declare const backtest: {
|
|
28476
29327
|
exchangeValidationService: ExchangeValidationService;
|
|
28477
29328
|
strategyValidationService: StrategyValidationService;
|
|
@@ -28494,6 +29345,7 @@ declare const backtest: {
|
|
|
28494
29345
|
strategyReportService: StrategyReportService;
|
|
28495
29346
|
syncReportService: SyncReportService;
|
|
28496
29347
|
highestProfitReportService: HighestProfitReportService;
|
|
29348
|
+
maxDrawdownReportService: MaxDrawdownReportService;
|
|
28497
29349
|
backtestMarkdownService: BacktestMarkdownService;
|
|
28498
29350
|
liveMarkdownService: LiveMarkdownService;
|
|
28499
29351
|
scheduleMarkdownService: ScheduleMarkdownService;
|
|
@@ -28506,6 +29358,7 @@ declare const backtest: {
|
|
|
28506
29358
|
strategyMarkdownService: StrategyMarkdownService;
|
|
28507
29359
|
syncMarkdownService: SyncMarkdownService;
|
|
28508
29360
|
highestProfitMarkdownService: HighestProfitMarkdownService;
|
|
29361
|
+
maxDrawdownMarkdownService: MaxDrawdownMarkdownService;
|
|
28509
29362
|
backtestLogicPublicService: BacktestLogicPublicService;
|
|
28510
29363
|
liveLogicPublicService: LiveLogicPublicService;
|
|
28511
29364
|
walkerLogicPublicService: WalkerLogicPublicService;
|
|
@@ -28625,4 +29478,4 @@ declare const getTotalClosed: (signal: Signal) => {
|
|
|
28625
29478
|
remainingCostBasis: number;
|
|
28626
29479
|
};
|
|
28627
29480
|
|
|
28628
|
-
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, runInMockContext, 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 };
|