backtest-kit 5.5.3 → 5.6.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 +1979 -168
- package/build/index.mjs +1967 -168
- package/package.json +1 -1
- package/types.d.ts +1100 -140
package/types.d.ts
CHANGED
|
@@ -2216,6 +2216,19 @@ interface ISignalRow extends ISignalDto {
|
|
|
2216
2216
|
* Original priceTakeProfit is preserved in persistence but ignored during execution.
|
|
2217
2217
|
*/
|
|
2218
2218
|
_trailingPriceTakeProfit?: number;
|
|
2219
|
+
/**
|
|
2220
|
+
* Best price seen in profit direction during the life of this position.
|
|
2221
|
+
* Initialized at position open with priceOpen/pendingAt.
|
|
2222
|
+
* Updated on every tick/candle when price moves toward TP (currentDistance > 0).
|
|
2223
|
+
* - For LONG: maximum VWAP price seen above effective entry
|
|
2224
|
+
* - For SHORT: minimum VWAP price seen below effective entry
|
|
2225
|
+
*/
|
|
2226
|
+
_peak: {
|
|
2227
|
+
price: number;
|
|
2228
|
+
timestamp: number;
|
|
2229
|
+
pnlPercentage: number;
|
|
2230
|
+
pnlCost: number;
|
|
2231
|
+
};
|
|
2219
2232
|
/** Unix timestamp in milliseconds when this signal was created/scheduled in backtest context or when getSignal was called in live context (before validation) */
|
|
2220
2233
|
timestamp: number;
|
|
2221
2234
|
}
|
|
@@ -2844,7 +2857,7 @@ interface IStrategy {
|
|
|
2844
2857
|
* Returns the effective (DCA-averaged) entry price for the current pending signal.
|
|
2845
2858
|
* Returns null if no pending signal exists.
|
|
2846
2859
|
*/
|
|
2847
|
-
|
|
2860
|
+
getPositionEffectivePrice: (symbol: string) => Promise<number | null>;
|
|
2848
2861
|
/**
|
|
2849
2862
|
* Returns the number of DCA entries for the current pending signal.
|
|
2850
2863
|
* 1 = original entry only. Returns null if no pending signal exists.
|
|
@@ -3386,6 +3399,91 @@ interface IStrategy {
|
|
|
3386
3399
|
* @returns Promise resolving to true if pending signal exists, false otherwise
|
|
3387
3400
|
*/
|
|
3388
3401
|
hasPendingSignal: (symbol: string) => Promise<boolean>;
|
|
3402
|
+
/**
|
|
3403
|
+
* Returns the original estimated duration for the current pending signal.
|
|
3404
|
+
*
|
|
3405
|
+
* Reflects `minuteEstimatedTime` as set in the signal DTO — the maximum
|
|
3406
|
+
* number of minutes the position is expected to be active before `time_expired`.
|
|
3407
|
+
*
|
|
3408
|
+
* Returns null if no pending signal exists.
|
|
3409
|
+
*
|
|
3410
|
+
* @param symbol - Trading pair symbol
|
|
3411
|
+
* @returns Promise resolving to estimated duration in minutes or null
|
|
3412
|
+
*/
|
|
3413
|
+
getPositionEstimateMinutes: (symbol: string) => Promise<number | null>;
|
|
3414
|
+
/**
|
|
3415
|
+
* Returns the remaining time before the position expires, clamped to zero.
|
|
3416
|
+
*
|
|
3417
|
+
* Computes elapsed minutes since `pendingAt` and subtracts from `minuteEstimatedTime`.
|
|
3418
|
+
* Returns 0 once the estimate is exceeded (never negative).
|
|
3419
|
+
*
|
|
3420
|
+
* Returns null if no pending signal exists.
|
|
3421
|
+
*
|
|
3422
|
+
* @param symbol - Trading pair symbol
|
|
3423
|
+
* @param timestamp - Current Unix timestamp in milliseconds
|
|
3424
|
+
* @returns Promise resolving to remaining minutes (≥ 0) or null
|
|
3425
|
+
*/
|
|
3426
|
+
getPositionCountdownMinutes: (symbol: string, timestamp: number) => Promise<number | null>;
|
|
3427
|
+
/**
|
|
3428
|
+
* Returns the best price reached in the profit direction during this position's life.
|
|
3429
|
+
*
|
|
3430
|
+
* Returns null if no pending signal exists.
|
|
3431
|
+
*
|
|
3432
|
+
* @param symbol - Trading pair symbol
|
|
3433
|
+
* @returns Promise resolving to price or null
|
|
3434
|
+
*/
|
|
3435
|
+
getPositionHighestProfitPrice: (symbol: string) => Promise<number | null>;
|
|
3436
|
+
/**
|
|
3437
|
+
* Returns the PnL percentage at the moment the best profit price was recorded during this position's life.
|
|
3438
|
+
*
|
|
3439
|
+
* Returns null if no pending signal exists.
|
|
3440
|
+
*
|
|
3441
|
+
* @param symbol - Trading pair symbol
|
|
3442
|
+
* @returns Promise resolving to PnL percentage or null
|
|
3443
|
+
*/
|
|
3444
|
+
getPositionHighestPnlPercentage: (symbol: string) => Promise<number | null>;
|
|
3445
|
+
/**
|
|
3446
|
+
* Returns the PnL cost (in quote currency) at the moment the best profit price was recorded during this position's life.
|
|
3447
|
+
*
|
|
3448
|
+
* Returns null if no pending signal exists.
|
|
3449
|
+
*
|
|
3450
|
+
* @param symbol - Trading pair symbol
|
|
3451
|
+
* @returns Promise resolving to PnL cost or null
|
|
3452
|
+
*/
|
|
3453
|
+
getPositionHighestPnlCost: (symbol: string) => Promise<number | null>;
|
|
3454
|
+
/**
|
|
3455
|
+
* Returns the timestamp when the best profit price was recorded during this position's life.
|
|
3456
|
+
*
|
|
3457
|
+
* Returns null if no pending signal exists.
|
|
3458
|
+
*
|
|
3459
|
+
* @param symbol - Trading pair symbol
|
|
3460
|
+
* @returns Promise resolving to timestamp in milliseconds or null
|
|
3461
|
+
*/
|
|
3462
|
+
getPositionHighestProfitTimestamp: (symbol: string) => Promise<number | null>;
|
|
3463
|
+
/**
|
|
3464
|
+
* Returns whether breakeven was mathematically reachable at the highest profit price.
|
|
3465
|
+
*
|
|
3466
|
+
* Uses the same threshold formula as getBreakeven with the recorded peak price.
|
|
3467
|
+
* Returns null if no pending signal exists.
|
|
3468
|
+
*
|
|
3469
|
+
* @param symbol - Trading pair symbol
|
|
3470
|
+
* @returns Promise resolving to true if breakeven was reachable at peak, false otherwise, or null
|
|
3471
|
+
*/
|
|
3472
|
+
getPositionHighestProfitBreakeven: (symbol: string) => Promise<boolean | null>;
|
|
3473
|
+
/**
|
|
3474
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
3475
|
+
*
|
|
3476
|
+
* Measures how long the position has been pulling back from its peak profit level.
|
|
3477
|
+
* Zero when called at the exact moment the peak was set.
|
|
3478
|
+
* Grows continuously as price moves away from the peak without setting a new record.
|
|
3479
|
+
*
|
|
3480
|
+
* Returns null if no pending signal exists.
|
|
3481
|
+
*
|
|
3482
|
+
* @param symbol - Trading pair symbol
|
|
3483
|
+
* @param timestamp - Current Unix timestamp in milliseconds
|
|
3484
|
+
* @returns Promise resolving to drawdown duration in minutes or null
|
|
3485
|
+
*/
|
|
3486
|
+
getPositionDrawdownMinutes: (symbol: string, timestamp: number) => Promise<number | null>;
|
|
3389
3487
|
/**
|
|
3390
3488
|
* Disposes the strategy instance and cleans up resources.
|
|
3391
3489
|
*
|
|
@@ -4830,14 +4928,14 @@ declare function getBreakeven(symbol: string, currentPrice: number): Promise<boo
|
|
|
4830
4928
|
*
|
|
4831
4929
|
* @example
|
|
4832
4930
|
* ```typescript
|
|
4833
|
-
* import {
|
|
4931
|
+
* import { getPositionEffectivePrice } from "backtest-kit";
|
|
4834
4932
|
*
|
|
4835
|
-
* const avgPrice = await
|
|
4933
|
+
* const avgPrice = await getPositionEffectivePrice("BTCUSDT");
|
|
4836
4934
|
* // No DCA: avgPrice === priceOpen
|
|
4837
4935
|
* // After DCA at lower price: avgPrice < priceOpen
|
|
4838
4936
|
* ```
|
|
4839
4937
|
*/
|
|
4840
|
-
declare function
|
|
4938
|
+
declare function getPositionEffectivePrice(symbol: string): Promise<number | null>;
|
|
4841
4939
|
/**
|
|
4842
4940
|
* Returns the number of DCA entries made for the current pending signal.
|
|
4843
4941
|
*
|
|
@@ -5050,6 +5148,189 @@ declare function getPositionPartials(symbol: string): Promise<{
|
|
|
5050
5148
|
entryCountAtClose: number;
|
|
5051
5149
|
timestamp: number;
|
|
5052
5150
|
}[]>;
|
|
5151
|
+
/**
|
|
5152
|
+
* Returns the list of DCA entry prices and costs for the current pending signal.
|
|
5153
|
+
*
|
|
5154
|
+
* Each element represents a single position entry — the initial open or a subsequent
|
|
5155
|
+
* DCA entry added via commitAverageBuy.
|
|
5156
|
+
*
|
|
5157
|
+
* Returns null if no pending signal exists.
|
|
5158
|
+
* Returns a single-element array if no DCA entries were made.
|
|
5159
|
+
*
|
|
5160
|
+
* Each entry contains:
|
|
5161
|
+
* - `price` — execution price of this entry
|
|
5162
|
+
* - `cost` — dollar cost allocated to this entry (e.g. 100 for $100)
|
|
5163
|
+
*
|
|
5164
|
+
* @param symbol - Trading pair symbol
|
|
5165
|
+
* @returns Promise resolving to array of entry records or null
|
|
5166
|
+
*
|
|
5167
|
+
* @example
|
|
5168
|
+
* ```typescript
|
|
5169
|
+
* import { getPositionEntries } from "backtest-kit";
|
|
5170
|
+
*
|
|
5171
|
+
* const entries = await getPositionEntries("BTCUSDT");
|
|
5172
|
+
* // No DCA: [{ price: 43000, cost: 100 }]
|
|
5173
|
+
* // One DCA: [{ price: 43000, cost: 100 }, { price: 42000, cost: 100 }]
|
|
5174
|
+
* ```
|
|
5175
|
+
*/
|
|
5176
|
+
declare function getPositionEntries(symbol: string): Promise<{
|
|
5177
|
+
price: number;
|
|
5178
|
+
cost: number;
|
|
5179
|
+
timestamp: number;
|
|
5180
|
+
}[]>;
|
|
5181
|
+
/**
|
|
5182
|
+
* Returns the original estimated duration for the current pending signal.
|
|
5183
|
+
*
|
|
5184
|
+
* Reflects `minuteEstimatedTime` as set in the signal DTO — the maximum
|
|
5185
|
+
* number of minutes the position is expected to be active before `time_expired`.
|
|
5186
|
+
*
|
|
5187
|
+
* Returns null if no pending signal exists.
|
|
5188
|
+
*
|
|
5189
|
+
* @param symbol - Trading pair symbol
|
|
5190
|
+
* @returns Promise resolving to estimated duration in minutes or null
|
|
5191
|
+
*
|
|
5192
|
+
* @example
|
|
5193
|
+
* ```typescript
|
|
5194
|
+
* import { getPositionEstimateMinutes } from "backtest-kit";
|
|
5195
|
+
*
|
|
5196
|
+
* const estimate = await getPositionEstimateMinutes("BTCUSDT");
|
|
5197
|
+
* // e.g. 120 (2 hours)
|
|
5198
|
+
* ```
|
|
5199
|
+
*/
|
|
5200
|
+
declare function getPositionEstimateMinutes(symbol: string): Promise<number>;
|
|
5201
|
+
/**
|
|
5202
|
+
* Returns the remaining time before the position expires, clamped to zero.
|
|
5203
|
+
*
|
|
5204
|
+
* Computes elapsed minutes since `pendingAt` and subtracts from `minuteEstimatedTime`.
|
|
5205
|
+
* Returns 0 once the estimate is exceeded (never negative).
|
|
5206
|
+
*
|
|
5207
|
+
* Returns null if no pending signal exists.
|
|
5208
|
+
*
|
|
5209
|
+
* @param symbol - Trading pair symbol
|
|
5210
|
+
* @returns Promise resolving to remaining minutes (≥ 0) or null
|
|
5211
|
+
*
|
|
5212
|
+
* @example
|
|
5213
|
+
* ```typescript
|
|
5214
|
+
* import { getPositionCountdownMinutes } from "backtest-kit";
|
|
5215
|
+
*
|
|
5216
|
+
* const remaining = await getPositionCountdownMinutes("BTCUSDT");
|
|
5217
|
+
* // e.g. 45 (45 minutes left)
|
|
5218
|
+
* // 0 when expired
|
|
5219
|
+
* ```
|
|
5220
|
+
*/
|
|
5221
|
+
declare function getPositionCountdownMinutes(symbol: string): Promise<number>;
|
|
5222
|
+
/**
|
|
5223
|
+
* Returns the best price reached in the profit direction during this position's life.
|
|
5224
|
+
*
|
|
5225
|
+
* Initialized at position open with the entry price and timestamp.
|
|
5226
|
+
* Updated on every tick/candle when VWAP moves beyond the previous record toward TP:
|
|
5227
|
+
* - LONG: tracks the highest price seen above effective entry
|
|
5228
|
+
* - SHORT: tracks the lowest price seen below effective entry
|
|
5229
|
+
*
|
|
5230
|
+
* Returns null if no pending signal exists.
|
|
5231
|
+
* Never returns null when a signal is active — always contains at least the entry price.
|
|
5232
|
+
*
|
|
5233
|
+
* @param symbol - Trading pair symbol
|
|
5234
|
+
* @returns Promise resolving to `{ price, timestamp }` record or null
|
|
5235
|
+
*
|
|
5236
|
+
* @example
|
|
5237
|
+
* ```typescript
|
|
5238
|
+
* import { getPositionHighestProfitPrice } from "backtest-kit";
|
|
5239
|
+
*
|
|
5240
|
+
* const peak = await getPositionHighestProfitPrice("BTCUSDT");
|
|
5241
|
+
* // e.g. { price: 44500, timestamp: 1700000000000 }
|
|
5242
|
+
* ```
|
|
5243
|
+
*/
|
|
5244
|
+
declare function getPositionHighestProfitPrice(symbol: string): Promise<number>;
|
|
5245
|
+
/**
|
|
5246
|
+
* Returns the timestamp when the best profit price was recorded during this position's life.
|
|
5247
|
+
*
|
|
5248
|
+
* Returns null if no pending signal exists.
|
|
5249
|
+
*
|
|
5250
|
+
* @param symbol - Trading pair symbol
|
|
5251
|
+
* @returns Promise resolving to timestamp in milliseconds or null
|
|
5252
|
+
*
|
|
5253
|
+
* @example
|
|
5254
|
+
* ```typescript
|
|
5255
|
+
* import { getPositionHighestProfitTimestamp } from "backtest-kit";
|
|
5256
|
+
*
|
|
5257
|
+
* const ts = await getPositionHighestProfitTimestamp("BTCUSDT");
|
|
5258
|
+
* // e.g. 1700000000000
|
|
5259
|
+
* ```
|
|
5260
|
+
*/
|
|
5261
|
+
declare function getPositionHighestProfitTimestamp(symbol: string): Promise<number>;
|
|
5262
|
+
/**
|
|
5263
|
+
* Returns the PnL percentage at the moment the best profit price was recorded during this position's life.
|
|
5264
|
+
*
|
|
5265
|
+
* Returns null if no pending signal exists.
|
|
5266
|
+
*
|
|
5267
|
+
* @param symbol - Trading pair symbol
|
|
5268
|
+
* @returns Promise resolving to PnL percentage or null
|
|
5269
|
+
*
|
|
5270
|
+
* @example
|
|
5271
|
+
* ```typescript
|
|
5272
|
+
* import { getPositionHighestPnlPercentage } from "backtest-kit";
|
|
5273
|
+
*
|
|
5274
|
+
* const pnl = await getPositionHighestPnlPercentage("BTCUSDT");
|
|
5275
|
+
* // e.g. 3.5
|
|
5276
|
+
* ```
|
|
5277
|
+
*/
|
|
5278
|
+
declare function getPositionHighestPnlPercentage(symbol: string): Promise<number>;
|
|
5279
|
+
/**
|
|
5280
|
+
* Returns the PnL cost (in quote currency) at the moment the best profit price was recorded during this position's life.
|
|
5281
|
+
*
|
|
5282
|
+
* Returns null if no pending signal exists.
|
|
5283
|
+
*
|
|
5284
|
+
* @param symbol - Trading pair symbol
|
|
5285
|
+
* @returns Promise resolving to PnL cost or null
|
|
5286
|
+
*
|
|
5287
|
+
* @example
|
|
5288
|
+
* ```typescript
|
|
5289
|
+
* import { getPositionHighestPnlCost } from "backtest-kit";
|
|
5290
|
+
*
|
|
5291
|
+
* const pnlCost = await getPositionHighestPnlCost("BTCUSDT");
|
|
5292
|
+
* // e.g. 35.5
|
|
5293
|
+
* ```
|
|
5294
|
+
*/
|
|
5295
|
+
declare function getPositionHighestPnlCost(symbol: string): Promise<number>;
|
|
5296
|
+
/**
|
|
5297
|
+
* Returns whether breakeven was mathematically reachable at the highest profit price.
|
|
5298
|
+
*
|
|
5299
|
+
* Returns null if no pending signal exists.
|
|
5300
|
+
*
|
|
5301
|
+
* @param symbol - Trading pair symbol
|
|
5302
|
+
* @returns Promise resolving to true if breakeven was reachable at peak, false otherwise, or null
|
|
5303
|
+
*
|
|
5304
|
+
* @example
|
|
5305
|
+
* ```typescript
|
|
5306
|
+
* import { getPositionHighestProfitBreakeven } from "backtest-kit";
|
|
5307
|
+
*
|
|
5308
|
+
* const couldBreakeven = await getPositionHighestProfitBreakeven("BTCUSDT");
|
|
5309
|
+
* // e.g. true (price reached the breakeven threshold at its peak)
|
|
5310
|
+
* ```
|
|
5311
|
+
*/
|
|
5312
|
+
declare function getPositionHighestProfitBreakeven(symbol: string): Promise<boolean>;
|
|
5313
|
+
/**
|
|
5314
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
5315
|
+
*
|
|
5316
|
+
* Measures how long the position has been pulling back from its peak profit level.
|
|
5317
|
+
* Zero when called at the exact moment the peak was set.
|
|
5318
|
+
* Grows continuously as price moves away from the peak without setting a new record.
|
|
5319
|
+
*
|
|
5320
|
+
* Returns null if no pending signal exists.
|
|
5321
|
+
*
|
|
5322
|
+
* @param symbol - Trading pair symbol
|
|
5323
|
+
* @returns Promise resolving to drawdown duration in minutes or null
|
|
5324
|
+
*
|
|
5325
|
+
* @example
|
|
5326
|
+
* ```typescript
|
|
5327
|
+
* import { getPositionDrawdownMinutes } from "backtest-kit";
|
|
5328
|
+
*
|
|
5329
|
+
* const drawdown = await getPositionDrawdownMinutes("BTCUSDT");
|
|
5330
|
+
* // e.g. 30 (30 minutes since the highest profit price)
|
|
5331
|
+
* ```
|
|
5332
|
+
*/
|
|
5333
|
+
declare function getPositionDrawdownMinutes(symbol: string): Promise<number>;
|
|
5053
5334
|
/**
|
|
5054
5335
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
5055
5336
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -5435,6 +5716,8 @@ declare const COLUMN_CONFIG: {
|
|
|
5435
5716
|
strategy_columns: ColumnModel<StrategyEvent>[];
|
|
5436
5717
|
/** Columns for signal sync lifecycle events (signal-open, signal-close) */
|
|
5437
5718
|
sync_columns: ColumnModel<SyncEvent>[];
|
|
5719
|
+
/** Columns for highest profit milestone tracking events */
|
|
5720
|
+
highest_profit_columns: ColumnModel<HighestProfitEvent>[];
|
|
5438
5721
|
/** Walker: PnL summary columns */
|
|
5439
5722
|
walker_pnl_columns: ColumnModel<SignalData$1>[];
|
|
5440
5723
|
/** Walker: strategy-level summary columns */
|
|
@@ -5611,6 +5894,7 @@ declare function getColumns(): {
|
|
|
5611
5894
|
schedule_columns: ColumnModel<ScheduledEvent>[];
|
|
5612
5895
|
strategy_columns: ColumnModel<StrategyEvent>[];
|
|
5613
5896
|
sync_columns: ColumnModel<SyncEvent>[];
|
|
5897
|
+
highest_profit_columns: ColumnModel<HighestProfitEvent>[];
|
|
5614
5898
|
walker_pnl_columns: ColumnModel<SignalData$1>[];
|
|
5615
5899
|
walker_strategy_columns: ColumnModel<IStrategyResult>[];
|
|
5616
5900
|
};
|
|
@@ -5639,6 +5923,7 @@ declare function getDefaultColumns(): Readonly<{
|
|
|
5639
5923
|
schedule_columns: ColumnModel<ScheduledEvent>[];
|
|
5640
5924
|
strategy_columns: ColumnModel<StrategyEvent>[];
|
|
5641
5925
|
sync_columns: ColumnModel<SyncEvent>[];
|
|
5926
|
+
highest_profit_columns: ColumnModel<HighestProfitEvent>[];
|
|
5642
5927
|
walker_pnl_columns: ColumnModel<SignalData$1>[];
|
|
5643
5928
|
walker_strategy_columns: ColumnModel<IStrategyResult>[];
|
|
5644
5929
|
}>;
|
|
@@ -6686,6 +6971,32 @@ interface WalkerContract {
|
|
|
6686
6971
|
totalStrategies: number;
|
|
6687
6972
|
}
|
|
6688
6973
|
|
|
6974
|
+
/**
|
|
6975
|
+
* Contract for highest profit updates emitted by the framework.
|
|
6976
|
+
* This contract defines the structure of the data emitted when a new highest profit is achieved for an open position.
|
|
6977
|
+
* It includes contextual information about the strategy, exchange, frame, and the associated signal.
|
|
6978
|
+
* Consumers can use this information to implement custom logic based on profit milestones (e.g. trailing stops, partial profit-taking).
|
|
6979
|
+
* The backtest flag allows consumers to differentiate between live and backtest updates for appropriate handling.
|
|
6980
|
+
*/
|
|
6981
|
+
interface HighestProfitContract {
|
|
6982
|
+
/** Trading symbol (e.g. "BTC/USDT") */
|
|
6983
|
+
symbol: string;
|
|
6984
|
+
/** Current price at the time of the highest profit update */
|
|
6985
|
+
currentPrice: number;
|
|
6986
|
+
/** Timestamp of the highest profit update (milliseconds since epoch) */
|
|
6987
|
+
timestamp: number;
|
|
6988
|
+
/** Strategy name for context */
|
|
6989
|
+
strategyName: StrategyName;
|
|
6990
|
+
/** Exchange name for context */
|
|
6991
|
+
exchangeName: ExchangeName;
|
|
6992
|
+
/** Frame name for context (e.g. "1m", "5m") */
|
|
6993
|
+
frameName: FrameName;
|
|
6994
|
+
/** Public signal data for the position associated with this highest profit update */
|
|
6995
|
+
signal: IPublicSignalRow;
|
|
6996
|
+
/** Indicates if the update is from a backtest or live trading (true for backtest, false for live) */
|
|
6997
|
+
backtest: boolean;
|
|
6998
|
+
}
|
|
6999
|
+
|
|
6689
7000
|
/**
|
|
6690
7001
|
* Subscribes to all signal events with queued async processing.
|
|
6691
7002
|
*
|
|
@@ -7701,6 +8012,27 @@ declare function listenSync(fn: (event: SignalSyncContract) => void): () => void
|
|
|
7701
8012
|
* @returns Unsubscribe function to cancel the listener before it fires
|
|
7702
8013
|
*/
|
|
7703
8014
|
declare function listenSyncOnce(filterFn: (event: SignalSyncContract) => boolean, fn: (event: SignalSyncContract) => void): () => void;
|
|
8015
|
+
/**
|
|
8016
|
+
* Subscribes to highest profit events with queued async processing.
|
|
8017
|
+
* Emits when a signal reaches a new highest profit level during its lifecycle.
|
|
8018
|
+
* Events are processed sequentially in order received, even if callback is async.
|
|
8019
|
+
* Uses queued wrapper to prevent concurrent execution of the callback.
|
|
8020
|
+
* Useful for tracking profit milestones and implementing dynamic management logic.
|
|
8021
|
+
*
|
|
8022
|
+
* @param fn - Callback function to handle highest profit events
|
|
8023
|
+
* @return Unsubscribe function to stop listening to events
|
|
8024
|
+
*/
|
|
8025
|
+
declare function listenHighestProfit(fn: (event: HighestProfitContract) => void): () => void;
|
|
8026
|
+
/**
|
|
8027
|
+
* Subscribes to filtered highest profit events with one-time execution.
|
|
8028
|
+
* Listens for events matching the filter predicate, then executes callback once
|
|
8029
|
+
* and automatically unsubscribes. Useful for waiting for specific profit conditions.
|
|
8030
|
+
*
|
|
8031
|
+
* @param filterFn - Predicate to filter which events trigger the callback
|
|
8032
|
+
* @param fn - Callback function to handle the filtered event (called only once)
|
|
8033
|
+
* @returns Unsubscribe function to cancel the listener before it fires
|
|
8034
|
+
*/
|
|
8035
|
+
declare function listenHighestProfitOnce(filterFn: (event: HighestProfitContract) => boolean, fn: (event: HighestProfitContract) => void): () => void;
|
|
7704
8036
|
|
|
7705
8037
|
/**
|
|
7706
8038
|
* Checks if trade context is active (execution and method contexts).
|
|
@@ -9660,6 +9992,41 @@ interface PartialStatisticsModel {
|
|
|
9660
9992
|
totalLoss: number;
|
|
9661
9993
|
}
|
|
9662
9994
|
|
|
9995
|
+
/**
|
|
9996
|
+
* Single highest profit event recorded for a position.
|
|
9997
|
+
*/
|
|
9998
|
+
interface HighestProfitEvent {
|
|
9999
|
+
/** Unix timestamp in milliseconds when the record was set */
|
|
10000
|
+
timestamp: number;
|
|
10001
|
+
/** Trading pair symbol */
|
|
10002
|
+
symbol: string;
|
|
10003
|
+
/** Strategy name */
|
|
10004
|
+
strategyName: string;
|
|
10005
|
+
/** Signal unique identifier */
|
|
10006
|
+
signalId: string;
|
|
10007
|
+
/** Position direction */
|
|
10008
|
+
position: IPublicSignalRow["position"];
|
|
10009
|
+
/** Record price reached in the profit direction */
|
|
10010
|
+
currentPrice: number;
|
|
10011
|
+
/** Effective entry price at the time of the update */
|
|
10012
|
+
priceOpen: number;
|
|
10013
|
+
/** Take profit price */
|
|
10014
|
+
priceTakeProfit: number;
|
|
10015
|
+
/** Stop loss price */
|
|
10016
|
+
priceStopLoss: number;
|
|
10017
|
+
/** Whether the event occurred in backtest mode */
|
|
10018
|
+
backtest: boolean;
|
|
10019
|
+
}
|
|
10020
|
+
/**
|
|
10021
|
+
* Aggregated statistics model for highest profit events.
|
|
10022
|
+
*/
|
|
10023
|
+
interface HighestProfitStatisticsModel {
|
|
10024
|
+
/** Full list of recorded events (newest first) */
|
|
10025
|
+
eventList: HighestProfitEvent[];
|
|
10026
|
+
/** Total number of recorded events */
|
|
10027
|
+
totalEvents: number;
|
|
10028
|
+
}
|
|
10029
|
+
|
|
9663
10030
|
/**
|
|
9664
10031
|
* Risk rejection event data for report generation.
|
|
9665
10032
|
* Contains all information about rejected signals due to risk limits.
|
|
@@ -10781,6 +11148,8 @@ interface IReportTarget {
|
|
|
10781
11148
|
backtest: boolean;
|
|
10782
11149
|
/** Enable signal synchronization event logging (signal-open, signal-close) */
|
|
10783
11150
|
sync: boolean;
|
|
11151
|
+
/** Enable highest profit milestone event logging */
|
|
11152
|
+
highest_profit: boolean;
|
|
10784
11153
|
}
|
|
10785
11154
|
/**
|
|
10786
11155
|
* Union type of all valid report names.
|
|
@@ -10932,7 +11301,7 @@ declare class ReportUtils {
|
|
|
10932
11301
|
*
|
|
10933
11302
|
* @returns Cleanup function that unsubscribes from all enabled services
|
|
10934
11303
|
*/
|
|
10935
|
-
enable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, schedule, walker, strategy, sync, }?: Partial<IReportTarget>) => (...args: any[]) => any;
|
|
11304
|
+
enable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, schedule, walker, strategy, sync, highest_profit, }?: Partial<IReportTarget>) => (...args: any[]) => any;
|
|
10936
11305
|
/**
|
|
10937
11306
|
* Disables report services selectively.
|
|
10938
11307
|
*
|
|
@@ -10969,7 +11338,7 @@ declare class ReportUtils {
|
|
|
10969
11338
|
* Report.disable();
|
|
10970
11339
|
* ```
|
|
10971
11340
|
*/
|
|
10972
|
-
disable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, schedule, walker, strategy, sync, }?: Partial<IReportTarget>) => void;
|
|
11341
|
+
disable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, schedule, walker, strategy, sync, highest_profit, }?: Partial<IReportTarget>) => void;
|
|
10973
11342
|
}
|
|
10974
11343
|
/**
|
|
10975
11344
|
* Report adapter with pluggable storage backend and instance memoization.
|
|
@@ -11061,6 +11430,8 @@ interface IMarkdownTarget {
|
|
|
11061
11430
|
backtest: boolean;
|
|
11062
11431
|
/** Enable signal sync lifecycle reports (signal-open and signal-close events) */
|
|
11063
11432
|
sync: boolean;
|
|
11433
|
+
/** Enable highest profit milestone tracking reports */
|
|
11434
|
+
highest_profit: boolean;
|
|
11064
11435
|
}
|
|
11065
11436
|
declare const WAIT_FOR_INIT_SYMBOL: unique symbol;
|
|
11066
11437
|
declare const WRITE_SAFE_SYMBOL: unique symbol;
|
|
@@ -11256,7 +11627,7 @@ declare class MarkdownUtils {
|
|
|
11256
11627
|
*
|
|
11257
11628
|
* @returns Cleanup function that unsubscribes from all enabled services
|
|
11258
11629
|
*/
|
|
11259
|
-
enable: ({ backtest: bt, breakeven, heat, live, partial, performance, strategy, risk, schedule, walker, sync, }?: Partial<IMarkdownTarget>) => (...args: any[]) => any;
|
|
11630
|
+
enable: ({ backtest: bt, breakeven, heat, live, partial, performance, strategy, risk, schedule, walker, sync, highest_profit, }?: Partial<IMarkdownTarget>) => (...args: any[]) => any;
|
|
11260
11631
|
/**
|
|
11261
11632
|
* Disables markdown report services selectively.
|
|
11262
11633
|
*
|
|
@@ -11294,7 +11665,7 @@ declare class MarkdownUtils {
|
|
|
11294
11665
|
* Markdown.disable();
|
|
11295
11666
|
* ```
|
|
11296
11667
|
*/
|
|
11297
|
-
disable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, strategy, schedule, walker, sync, }?: Partial<IMarkdownTarget>) => void;
|
|
11668
|
+
disable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, strategy, schedule, walker, sync, highest_profit, }?: Partial<IMarkdownTarget>) => void;
|
|
11298
11669
|
}
|
|
11299
11670
|
/**
|
|
11300
11671
|
* Markdown adapter with pluggable storage backend and instance memoization.
|
|
@@ -11494,7 +11865,7 @@ declare const Log: LogAdapter;
|
|
|
11494
11865
|
* @see ColumnModel for the base interface
|
|
11495
11866
|
* @see IStrategyTickResultClosed for the signal data structure
|
|
11496
11867
|
*/
|
|
11497
|
-
type Columns$
|
|
11868
|
+
type Columns$a = ColumnModel<IStrategyTickResultClosed>;
|
|
11498
11869
|
/**
|
|
11499
11870
|
* Service for generating and saving backtest markdown reports.
|
|
11500
11871
|
*
|
|
@@ -11588,7 +11959,7 @@ declare class BacktestMarkdownService {
|
|
|
11588
11959
|
* console.log(markdown);
|
|
11589
11960
|
* ```
|
|
11590
11961
|
*/
|
|
11591
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
11962
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$a[]) => Promise<string>;
|
|
11592
11963
|
/**
|
|
11593
11964
|
* Saves symbol-strategy report to disk.
|
|
11594
11965
|
* Creates directory if it doesn't exist.
|
|
@@ -11613,7 +11984,7 @@ declare class BacktestMarkdownService {
|
|
|
11613
11984
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", true, "./custom/path");
|
|
11614
11985
|
* ```
|
|
11615
11986
|
*/
|
|
11616
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
11987
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$a[]) => Promise<void>;
|
|
11617
11988
|
/**
|
|
11618
11989
|
* Clears accumulated signal data from storage.
|
|
11619
11990
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -11852,7 +12223,7 @@ declare class BacktestUtils {
|
|
|
11852
12223
|
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
11853
12224
|
* @returns Effective entry price, or null if no active position
|
|
11854
12225
|
*/
|
|
11855
|
-
|
|
12226
|
+
getPositionEffectivePrice: (symbol: string, context: {
|
|
11856
12227
|
strategyName: StrategyName;
|
|
11857
12228
|
exchangeName: ExchangeName;
|
|
11858
12229
|
frameName: FrameName;
|
|
@@ -11992,60 +12363,180 @@ declare class BacktestUtils {
|
|
|
11992
12363
|
timestamp: number;
|
|
11993
12364
|
}[]>;
|
|
11994
12365
|
/**
|
|
11995
|
-
*
|
|
11996
|
-
* Use this to prevent duplicate DCA entries at the same price area.
|
|
12366
|
+
* Returns the original estimated duration for the current pending signal.
|
|
11997
12367
|
*
|
|
11998
|
-
*
|
|
11999
|
-
*
|
|
12000
|
-
*
|
|
12368
|
+
* Reflects `minuteEstimatedTime` as set in the signal DTO — the maximum
|
|
12369
|
+
* number of minutes the position is expected to be active before `time_expired`.
|
|
12370
|
+
*
|
|
12371
|
+
* Returns null if no pending signal exists.
|
|
12001
12372
|
*
|
|
12002
12373
|
* @param symbol - Trading pair symbol
|
|
12003
|
-
* @param currentPrice - Price to check against existing DCA levels
|
|
12004
12374
|
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12005
|
-
* @
|
|
12006
|
-
* @returns true if price overlaps an existing entry level (DCA not recommended)
|
|
12375
|
+
* @returns Estimated duration in minutes, or null if no active position
|
|
12007
12376
|
*/
|
|
12008
|
-
|
|
12377
|
+
getPositionEstimateMinutes: (symbol: string, context: {
|
|
12009
12378
|
strategyName: StrategyName;
|
|
12010
12379
|
exchangeName: ExchangeName;
|
|
12011
12380
|
frameName: FrameName;
|
|
12012
|
-
}
|
|
12381
|
+
}) => Promise<number>;
|
|
12013
12382
|
/**
|
|
12014
|
-
*
|
|
12015
|
-
* Use this to prevent duplicate partial closes at the same price area.
|
|
12383
|
+
* Returns the remaining time before the position expires, clamped to zero.
|
|
12016
12384
|
*
|
|
12017
|
-
*
|
|
12018
|
-
*
|
|
12019
|
-
*
|
|
12385
|
+
* Computes elapsed minutes since `pendingAt` and subtracts from `minuteEstimatedTime`.
|
|
12386
|
+
* Returns 0 once the estimate is exceeded (never negative).
|
|
12387
|
+
*
|
|
12388
|
+
* Returns null if no pending signal exists.
|
|
12020
12389
|
*
|
|
12021
12390
|
* @param symbol - Trading pair symbol
|
|
12022
|
-
* @param currentPrice - Price to check against existing partial close prices
|
|
12023
12391
|
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12024
|
-
* @
|
|
12025
|
-
* @returns true if price overlaps an existing partial price (partial not recommended)
|
|
12392
|
+
* @returns Remaining minutes (≥ 0), or null if no active position
|
|
12026
12393
|
*/
|
|
12027
|
-
|
|
12394
|
+
getPositionCountdownMinutes: (symbol: string, context: {
|
|
12028
12395
|
strategyName: StrategyName;
|
|
12029
12396
|
exchangeName: ExchangeName;
|
|
12030
12397
|
frameName: FrameName;
|
|
12031
|
-
}
|
|
12398
|
+
}) => Promise<number>;
|
|
12032
12399
|
/**
|
|
12033
|
-
*
|
|
12400
|
+
* Returns the best price reached in the profit direction during this position's life.
|
|
12034
12401
|
*
|
|
12035
|
-
*
|
|
12036
|
-
* Current active signal (if any) will complete normally.
|
|
12037
|
-
* Backtest will stop at the next safe point (idle state or after signal closes).
|
|
12402
|
+
* Returns null if no pending signal exists.
|
|
12038
12403
|
*
|
|
12039
12404
|
* @param symbol - Trading pair symbol
|
|
12040
|
-
* @param
|
|
12041
|
-
* @
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12405
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12406
|
+
* @returns price or null if no active position
|
|
12407
|
+
*/
|
|
12408
|
+
getPositionHighestProfitPrice: (symbol: string, context: {
|
|
12409
|
+
strategyName: StrategyName;
|
|
12410
|
+
exchangeName: ExchangeName;
|
|
12411
|
+
frameName: FrameName;
|
|
12412
|
+
}) => Promise<number>;
|
|
12413
|
+
/**
|
|
12414
|
+
* Returns the timestamp when the best profit price was recorded during this position's life.
|
|
12415
|
+
*
|
|
12416
|
+
* Returns null if no pending signal exists.
|
|
12417
|
+
*
|
|
12418
|
+
* @param symbol - Trading pair symbol
|
|
12419
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12420
|
+
* @returns timestamp in milliseconds or null if no active position
|
|
12421
|
+
*/
|
|
12422
|
+
getPositionHighestProfitTimestamp: (symbol: string, context: {
|
|
12423
|
+
strategyName: StrategyName;
|
|
12424
|
+
exchangeName: ExchangeName;
|
|
12425
|
+
frameName: FrameName;
|
|
12426
|
+
}) => Promise<number>;
|
|
12427
|
+
/**
|
|
12428
|
+
* Returns the PnL percentage at the moment the best profit price was recorded during this position's life.
|
|
12429
|
+
*
|
|
12430
|
+
* Returns null if no pending signal exists.
|
|
12431
|
+
*
|
|
12432
|
+
* @param symbol - Trading pair symbol
|
|
12433
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12434
|
+
* @returns PnL percentage or null if no active position
|
|
12435
|
+
*/
|
|
12436
|
+
getPositionHighestPnlPercentage: (symbol: string, context: {
|
|
12437
|
+
strategyName: StrategyName;
|
|
12438
|
+
exchangeName: ExchangeName;
|
|
12439
|
+
frameName: FrameName;
|
|
12440
|
+
}) => Promise<number>;
|
|
12441
|
+
/**
|
|
12442
|
+
* Returns the PnL cost (in quote currency) at the moment the best profit price was recorded during this position's life.
|
|
12443
|
+
*
|
|
12444
|
+
* Returns null if no pending signal exists.
|
|
12445
|
+
*
|
|
12446
|
+
* @param symbol - Trading pair symbol
|
|
12447
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12448
|
+
* @returns PnL cost or null if no active position
|
|
12449
|
+
*/
|
|
12450
|
+
getPositionHighestPnlCost: (symbol: string, context: {
|
|
12451
|
+
strategyName: StrategyName;
|
|
12452
|
+
exchangeName: ExchangeName;
|
|
12453
|
+
frameName: FrameName;
|
|
12454
|
+
}) => Promise<number>;
|
|
12455
|
+
/**
|
|
12456
|
+
* Returns whether breakeven was mathematically reachable at the highest profit price.
|
|
12457
|
+
*
|
|
12458
|
+
* @param symbol - Trading pair symbol
|
|
12459
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12460
|
+
* @returns true if breakeven was reachable at peak, false otherwise, or null if no active position
|
|
12461
|
+
*/
|
|
12462
|
+
getPositionHighestProfitBreakeven: (symbol: string, context: {
|
|
12463
|
+
strategyName: StrategyName;
|
|
12464
|
+
exchangeName: ExchangeName;
|
|
12465
|
+
frameName: FrameName;
|
|
12466
|
+
}) => Promise<boolean>;
|
|
12467
|
+
/**
|
|
12468
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
12469
|
+
*
|
|
12470
|
+
* Measures how long the position has been pulling back from its peak profit level.
|
|
12471
|
+
* Zero when called at the exact moment the peak was set.
|
|
12472
|
+
* Grows continuously as price moves away from the peak without setting a new record.
|
|
12473
|
+
*
|
|
12474
|
+
* Returns null if no pending signal exists.
|
|
12475
|
+
*
|
|
12476
|
+
* @param symbol - Trading pair symbol
|
|
12477
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12478
|
+
* @returns Drawdown duration in minutes, or null if no active position
|
|
12479
|
+
*/
|
|
12480
|
+
getPositionDrawdownMinutes: (symbol: string, context: {
|
|
12481
|
+
strategyName: StrategyName;
|
|
12482
|
+
exchangeName: ExchangeName;
|
|
12483
|
+
frameName: FrameName;
|
|
12484
|
+
}) => Promise<number>;
|
|
12485
|
+
/**
|
|
12486
|
+
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
12487
|
+
* Use this to prevent duplicate DCA entries at the same price area.
|
|
12488
|
+
*
|
|
12489
|
+
* Returns true if currentPrice is within [level - lowerStep, level + upperStep] for any level,
|
|
12490
|
+
* where step = level * percent / 100.
|
|
12491
|
+
* Returns false if no pending signal exists.
|
|
12492
|
+
*
|
|
12493
|
+
* @param symbol - Trading pair symbol
|
|
12494
|
+
* @param currentPrice - Price to check against existing DCA levels
|
|
12495
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12496
|
+
* @param ladder - Tolerance zone config; percentages in 0–100 format (default: 1.5% up and down)
|
|
12497
|
+
* @returns true if price overlaps an existing entry level (DCA not recommended)
|
|
12498
|
+
*/
|
|
12499
|
+
getPositionEntryOverlap: (symbol: string, currentPrice: number, context: {
|
|
12500
|
+
strategyName: StrategyName;
|
|
12501
|
+
exchangeName: ExchangeName;
|
|
12502
|
+
frameName: FrameName;
|
|
12503
|
+
}, ladder?: IPositionOverlapLadder) => Promise<boolean>;
|
|
12504
|
+
/**
|
|
12505
|
+
* Checks whether the current price falls within the tolerance zone of any existing partial close price.
|
|
12506
|
+
* Use this to prevent duplicate partial closes at the same price area.
|
|
12507
|
+
*
|
|
12508
|
+
* Returns true if currentPrice is within [partial.currentPrice - lowerStep, partial.currentPrice + upperStep]
|
|
12509
|
+
* for any partial, where step = partial.currentPrice * percent / 100.
|
|
12510
|
+
* Returns false if no pending signal exists or no partials have been executed yet.
|
|
12511
|
+
*
|
|
12512
|
+
* @param symbol - Trading pair symbol
|
|
12513
|
+
* @param currentPrice - Price to check against existing partial close prices
|
|
12514
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12515
|
+
* @param ladder - Tolerance zone config; percentages in 0–100 format (default: 1.5% up and down)
|
|
12516
|
+
* @returns true if price overlaps an existing partial price (partial not recommended)
|
|
12517
|
+
*/
|
|
12518
|
+
getPositionPartialOverlap: (symbol: string, currentPrice: number, context: {
|
|
12519
|
+
strategyName: StrategyName;
|
|
12520
|
+
exchangeName: ExchangeName;
|
|
12521
|
+
frameName: FrameName;
|
|
12522
|
+
}, ladder?: IPositionOverlapLadder) => Promise<boolean>;
|
|
12523
|
+
/**
|
|
12524
|
+
* Stops the strategy from generating new signals.
|
|
12525
|
+
*
|
|
12526
|
+
* Sets internal flag to prevent strategy from opening new signals.
|
|
12527
|
+
* Current active signal (if any) will complete normally.
|
|
12528
|
+
* Backtest will stop at the next safe point (idle state or after signal closes).
|
|
12529
|
+
*
|
|
12530
|
+
* @param symbol - Trading pair symbol
|
|
12531
|
+
* @param strategyName - Strategy name to stop
|
|
12532
|
+
* @param context - Execution context with exchangeName and frameName
|
|
12533
|
+
* @returns Promise that resolves when stop flag is set
|
|
12534
|
+
*
|
|
12535
|
+
* @example
|
|
12536
|
+
* ```typescript
|
|
12537
|
+
* // Stop strategy after some condition
|
|
12538
|
+
* await Backtest.stop("BTCUSDT", "my-strategy", {
|
|
12539
|
+
* exchangeName: "binance",
|
|
12049
12540
|
* frameName: "frame1",
|
|
12050
12541
|
* strategyName: "my-strategy"
|
|
12051
12542
|
* });
|
|
@@ -12508,7 +12999,7 @@ declare class BacktestUtils {
|
|
|
12508
12999
|
strategyName: StrategyName;
|
|
12509
13000
|
exchangeName: ExchangeName;
|
|
12510
13001
|
frameName: FrameName;
|
|
12511
|
-
}, columns?: Columns$
|
|
13002
|
+
}, columns?: Columns$a[]) => Promise<string>;
|
|
12512
13003
|
/**
|
|
12513
13004
|
* Saves strategy report to disk.
|
|
12514
13005
|
*
|
|
@@ -12539,7 +13030,7 @@ declare class BacktestUtils {
|
|
|
12539
13030
|
strategyName: StrategyName;
|
|
12540
13031
|
exchangeName: ExchangeName;
|
|
12541
13032
|
frameName: FrameName;
|
|
12542
|
-
}, path?: string, columns?: Columns$
|
|
13033
|
+
}, path?: string, columns?: Columns$a[]) => Promise<void>;
|
|
12543
13034
|
/**
|
|
12544
13035
|
* Lists all active backtest instances with their current status.
|
|
12545
13036
|
*
|
|
@@ -12613,7 +13104,7 @@ declare const Backtest: BacktestUtils;
|
|
|
12613
13104
|
* @see ColumnModel for the base interface
|
|
12614
13105
|
* @see TickEvent for the event data structure
|
|
12615
13106
|
*/
|
|
12616
|
-
type Columns$
|
|
13107
|
+
type Columns$9 = ColumnModel<TickEvent>;
|
|
12617
13108
|
/**
|
|
12618
13109
|
* Service for generating and saving live trading markdown reports.
|
|
12619
13110
|
*
|
|
@@ -12740,7 +13231,7 @@ declare class LiveMarkdownService {
|
|
|
12740
13231
|
* console.log(markdown);
|
|
12741
13232
|
* ```
|
|
12742
13233
|
*/
|
|
12743
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
13234
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$9[]) => Promise<string>;
|
|
12744
13235
|
/**
|
|
12745
13236
|
* Saves symbol-strategy report to disk.
|
|
12746
13237
|
* Creates directory if it doesn't exist.
|
|
@@ -12765,7 +13256,7 @@ declare class LiveMarkdownService {
|
|
|
12765
13256
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
12766
13257
|
* ```
|
|
12767
13258
|
*/
|
|
12768
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
13259
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$9[]) => Promise<void>;
|
|
12769
13260
|
/**
|
|
12770
13261
|
* Clears accumulated event data from storage.
|
|
12771
13262
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -12981,7 +13472,7 @@ declare class LiveUtils {
|
|
|
12981
13472
|
* @param context - Execution context with strategyName and exchangeName
|
|
12982
13473
|
* @returns Effective entry price, or null if no active position
|
|
12983
13474
|
*/
|
|
12984
|
-
|
|
13475
|
+
getPositionEffectivePrice: (symbol: string, context: {
|
|
12985
13476
|
strategyName: StrategyName;
|
|
12986
13477
|
exchangeName: ExchangeName;
|
|
12987
13478
|
}) => Promise<number | null>;
|
|
@@ -13112,6 +13603,118 @@ declare class LiveUtils {
|
|
|
13112
13603
|
cost: number;
|
|
13113
13604
|
timestamp: number;
|
|
13114
13605
|
}[]>;
|
|
13606
|
+
/**
|
|
13607
|
+
* Returns the original estimated duration for the current pending signal.
|
|
13608
|
+
*
|
|
13609
|
+
* Reflects `minuteEstimatedTime` as set in the signal DTO — the maximum
|
|
13610
|
+
* number of minutes the position is expected to be active before `time_expired`.
|
|
13611
|
+
*
|
|
13612
|
+
* Returns null if no pending signal exists.
|
|
13613
|
+
*
|
|
13614
|
+
* @param symbol - Trading pair symbol
|
|
13615
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13616
|
+
* @returns Estimated duration in minutes, or null if no active position
|
|
13617
|
+
*/
|
|
13618
|
+
getPositionEstimateMinutes: (symbol: string, context: {
|
|
13619
|
+
strategyName: StrategyName;
|
|
13620
|
+
exchangeName: ExchangeName;
|
|
13621
|
+
}) => Promise<number>;
|
|
13622
|
+
/**
|
|
13623
|
+
* Returns the remaining time before the position expires, clamped to zero.
|
|
13624
|
+
*
|
|
13625
|
+
* Computes elapsed minutes since `pendingAt` and subtracts from `minuteEstimatedTime`.
|
|
13626
|
+
* Returns 0 once the estimate is exceeded (never negative).
|
|
13627
|
+
*
|
|
13628
|
+
* Returns null if no pending signal exists.
|
|
13629
|
+
*
|
|
13630
|
+
* @param symbol - Trading pair symbol
|
|
13631
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13632
|
+
* @returns Remaining minutes (≥ 0), or null if no active position
|
|
13633
|
+
*/
|
|
13634
|
+
getPositionCountdownMinutes: (symbol: string, context: {
|
|
13635
|
+
strategyName: StrategyName;
|
|
13636
|
+
exchangeName: ExchangeName;
|
|
13637
|
+
}) => Promise<number>;
|
|
13638
|
+
/**
|
|
13639
|
+
* Returns the best price reached in the profit direction during this position's life.
|
|
13640
|
+
*
|
|
13641
|
+
* Returns null if no pending signal exists.
|
|
13642
|
+
*
|
|
13643
|
+
* @param symbol - Trading pair symbol
|
|
13644
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13645
|
+
* @returns price or null if no active position
|
|
13646
|
+
*/
|
|
13647
|
+
getPositionHighestProfitPrice: (symbol: string, context: {
|
|
13648
|
+
strategyName: StrategyName;
|
|
13649
|
+
exchangeName: ExchangeName;
|
|
13650
|
+
}) => Promise<number>;
|
|
13651
|
+
/**
|
|
13652
|
+
* Returns the timestamp when the best profit price was recorded during this position's life.
|
|
13653
|
+
*
|
|
13654
|
+
* Returns null if no pending signal exists.
|
|
13655
|
+
*
|
|
13656
|
+
* @param symbol - Trading pair symbol
|
|
13657
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13658
|
+
* @returns timestamp in milliseconds or null if no active position
|
|
13659
|
+
*/
|
|
13660
|
+
getPositionHighestProfitTimestamp: (symbol: string, context: {
|
|
13661
|
+
strategyName: StrategyName;
|
|
13662
|
+
exchangeName: ExchangeName;
|
|
13663
|
+
}) => Promise<number>;
|
|
13664
|
+
/**
|
|
13665
|
+
* Returns the PnL percentage at the moment the best profit price was recorded during this position's life.
|
|
13666
|
+
*
|
|
13667
|
+
* Returns null if no pending signal exists.
|
|
13668
|
+
*
|
|
13669
|
+
* @param symbol - Trading pair symbol
|
|
13670
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13671
|
+
* @returns PnL percentage or null if no active position
|
|
13672
|
+
*/
|
|
13673
|
+
getPositionHighestPnlPercentage: (symbol: string, context: {
|
|
13674
|
+
strategyName: StrategyName;
|
|
13675
|
+
exchangeName: ExchangeName;
|
|
13676
|
+
}) => Promise<number>;
|
|
13677
|
+
/**
|
|
13678
|
+
* Returns the PnL cost (in quote currency) at the moment the best profit price was recorded during this position's life.
|
|
13679
|
+
*
|
|
13680
|
+
* Returns null if no pending signal exists.
|
|
13681
|
+
*
|
|
13682
|
+
* @param symbol - Trading pair symbol
|
|
13683
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13684
|
+
* @returns PnL cost or null if no active position
|
|
13685
|
+
*/
|
|
13686
|
+
getPositionHighestPnlCost: (symbol: string, context: {
|
|
13687
|
+
strategyName: StrategyName;
|
|
13688
|
+
exchangeName: ExchangeName;
|
|
13689
|
+
}) => Promise<number>;
|
|
13690
|
+
/**
|
|
13691
|
+
* Returns whether breakeven was mathematically reachable at the highest profit price.
|
|
13692
|
+
*
|
|
13693
|
+
* @param symbol - Trading pair symbol
|
|
13694
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13695
|
+
* @returns true if breakeven was reachable at peak, false otherwise, or null if no active position
|
|
13696
|
+
*/
|
|
13697
|
+
getPositionHighestProfitBreakeven: (symbol: string, context: {
|
|
13698
|
+
strategyName: StrategyName;
|
|
13699
|
+
exchangeName: ExchangeName;
|
|
13700
|
+
}) => Promise<boolean>;
|
|
13701
|
+
/**
|
|
13702
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
13703
|
+
*
|
|
13704
|
+
* Measures how long the position has been pulling back from its peak profit level.
|
|
13705
|
+
* Zero when called at the exact moment the peak was set.
|
|
13706
|
+
* Grows continuously as price moves away from the peak without setting a new record.
|
|
13707
|
+
*
|
|
13708
|
+
* Returns null if no pending signal exists.
|
|
13709
|
+
*
|
|
13710
|
+
* @param symbol - Trading pair symbol
|
|
13711
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13712
|
+
* @returns Drawdown duration in minutes, or null if no active position
|
|
13713
|
+
*/
|
|
13714
|
+
getPositionDrawdownMinutes: (symbol: string, context: {
|
|
13715
|
+
strategyName: StrategyName;
|
|
13716
|
+
exchangeName: ExchangeName;
|
|
13717
|
+
}) => Promise<number>;
|
|
13115
13718
|
/**
|
|
13116
13719
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
13117
13720
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -13597,7 +14200,7 @@ declare class LiveUtils {
|
|
|
13597
14200
|
getReport: (symbol: string, context: {
|
|
13598
14201
|
strategyName: StrategyName;
|
|
13599
14202
|
exchangeName: ExchangeName;
|
|
13600
|
-
}, columns?: Columns$
|
|
14203
|
+
}, columns?: Columns$9[]) => Promise<string>;
|
|
13601
14204
|
/**
|
|
13602
14205
|
* Saves strategy report to disk.
|
|
13603
14206
|
*
|
|
@@ -13627,7 +14230,7 @@ declare class LiveUtils {
|
|
|
13627
14230
|
dump: (symbol: string, context: {
|
|
13628
14231
|
strategyName: StrategyName;
|
|
13629
14232
|
exchangeName: ExchangeName;
|
|
13630
|
-
}, path?: string, columns?: Columns$
|
|
14233
|
+
}, path?: string, columns?: Columns$9[]) => Promise<void>;
|
|
13631
14234
|
/**
|
|
13632
14235
|
* Lists all active live trading instances with their current status.
|
|
13633
14236
|
*
|
|
@@ -13697,7 +14300,7 @@ declare const Live: LiveUtils;
|
|
|
13697
14300
|
* @see ColumnModel for the base interface
|
|
13698
14301
|
* @see ScheduledEvent for the event data structure
|
|
13699
14302
|
*/
|
|
13700
|
-
type Columns$
|
|
14303
|
+
type Columns$8 = ColumnModel<ScheduledEvent>;
|
|
13701
14304
|
/**
|
|
13702
14305
|
* Service for generating and saving scheduled signals markdown reports.
|
|
13703
14306
|
*
|
|
@@ -13808,7 +14411,7 @@ declare class ScheduleMarkdownService {
|
|
|
13808
14411
|
* console.log(markdown);
|
|
13809
14412
|
* ```
|
|
13810
14413
|
*/
|
|
13811
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
14414
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$8[]) => Promise<string>;
|
|
13812
14415
|
/**
|
|
13813
14416
|
* Saves symbol-strategy report to disk.
|
|
13814
14417
|
* Creates directory if it doesn't exist.
|
|
@@ -13833,7 +14436,7 @@ declare class ScheduleMarkdownService {
|
|
|
13833
14436
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
13834
14437
|
* ```
|
|
13835
14438
|
*/
|
|
13836
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
14439
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$8[]) => Promise<void>;
|
|
13837
14440
|
/**
|
|
13838
14441
|
* Clears accumulated event data from storage.
|
|
13839
14442
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -13923,7 +14526,7 @@ declare class ScheduleUtils {
|
|
|
13923
14526
|
strategyName: StrategyName;
|
|
13924
14527
|
exchangeName: ExchangeName;
|
|
13925
14528
|
frameName: FrameName;
|
|
13926
|
-
}, backtest?: boolean, columns?: Columns$
|
|
14529
|
+
}, backtest?: boolean, columns?: Columns$8[]) => Promise<string>;
|
|
13927
14530
|
/**
|
|
13928
14531
|
* Saves strategy report to disk.
|
|
13929
14532
|
*
|
|
@@ -13945,7 +14548,7 @@ declare class ScheduleUtils {
|
|
|
13945
14548
|
strategyName: StrategyName;
|
|
13946
14549
|
exchangeName: ExchangeName;
|
|
13947
14550
|
frameName: FrameName;
|
|
13948
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
14551
|
+
}, backtest?: boolean, path?: string, columns?: Columns$8[]) => Promise<void>;
|
|
13949
14552
|
}
|
|
13950
14553
|
/**
|
|
13951
14554
|
* Singleton instance of ScheduleUtils for convenient scheduled signals reporting.
|
|
@@ -13991,7 +14594,7 @@ declare const Schedule: ScheduleUtils;
|
|
|
13991
14594
|
* @see ColumnModel for the base interface
|
|
13992
14595
|
* @see MetricStats for the metric data structure
|
|
13993
14596
|
*/
|
|
13994
|
-
type Columns$
|
|
14597
|
+
type Columns$7 = ColumnModel<MetricStats>;
|
|
13995
14598
|
/**
|
|
13996
14599
|
* Service for collecting and analyzing performance metrics.
|
|
13997
14600
|
*
|
|
@@ -14098,7 +14701,7 @@ declare class PerformanceMarkdownService {
|
|
|
14098
14701
|
* console.log(markdown);
|
|
14099
14702
|
* ```
|
|
14100
14703
|
*/
|
|
14101
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
14704
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$7[]) => Promise<string>;
|
|
14102
14705
|
/**
|
|
14103
14706
|
* Saves performance report to disk.
|
|
14104
14707
|
*
|
|
@@ -14119,7 +14722,7 @@ declare class PerformanceMarkdownService {
|
|
|
14119
14722
|
* await performanceService.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
14120
14723
|
* ```
|
|
14121
14724
|
*/
|
|
14122
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
14725
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$7[]) => Promise<void>;
|
|
14123
14726
|
/**
|
|
14124
14727
|
* Clears accumulated performance data from storage.
|
|
14125
14728
|
*
|
|
@@ -14227,7 +14830,7 @@ declare class Performance {
|
|
|
14227
14830
|
strategyName: StrategyName;
|
|
14228
14831
|
exchangeName: ExchangeName;
|
|
14229
14832
|
frameName: FrameName;
|
|
14230
|
-
}, backtest?: boolean, columns?: Columns$
|
|
14833
|
+
}, backtest?: boolean, columns?: Columns$7[]): Promise<string>;
|
|
14231
14834
|
/**
|
|
14232
14835
|
* Saves performance report to disk.
|
|
14233
14836
|
*
|
|
@@ -14252,7 +14855,7 @@ declare class Performance {
|
|
|
14252
14855
|
strategyName: StrategyName;
|
|
14253
14856
|
exchangeName: ExchangeName;
|
|
14254
14857
|
frameName: FrameName;
|
|
14255
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
14858
|
+
}, backtest?: boolean, path?: string, columns?: Columns$7[]): Promise<void>;
|
|
14256
14859
|
}
|
|
14257
14860
|
|
|
14258
14861
|
/**
|
|
@@ -14683,7 +15286,7 @@ declare const Walker: WalkerUtils;
|
|
|
14683
15286
|
* @see ColumnModel for the base interface
|
|
14684
15287
|
* @see IHeatmapRow for the row data structure
|
|
14685
15288
|
*/
|
|
14686
|
-
type Columns$
|
|
15289
|
+
type Columns$6 = ColumnModel<IHeatmapRow>;
|
|
14687
15290
|
/**
|
|
14688
15291
|
* Portfolio Heatmap Markdown Service.
|
|
14689
15292
|
*
|
|
@@ -14804,7 +15407,7 @@ declare class HeatMarkdownService {
|
|
|
14804
15407
|
* // ...
|
|
14805
15408
|
* ```
|
|
14806
15409
|
*/
|
|
14807
|
-
getReport: (strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
15410
|
+
getReport: (strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$6[]) => Promise<string>;
|
|
14808
15411
|
/**
|
|
14809
15412
|
* Saves heatmap report to disk.
|
|
14810
15413
|
*
|
|
@@ -14829,7 +15432,7 @@ declare class HeatMarkdownService {
|
|
|
14829
15432
|
* await service.dump("my-strategy", "binance", "frame1", true, "./reports");
|
|
14830
15433
|
* ```
|
|
14831
15434
|
*/
|
|
14832
|
-
dump: (strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
15435
|
+
dump: (strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$6[]) => Promise<void>;
|
|
14833
15436
|
/**
|
|
14834
15437
|
* Clears accumulated heatmap data from storage.
|
|
14835
15438
|
* If payload is provided, clears only that exchangeName+frameName+backtest combination's data.
|
|
@@ -14959,7 +15562,7 @@ declare class HeatUtils {
|
|
|
14959
15562
|
strategyName: StrategyName;
|
|
14960
15563
|
exchangeName: ExchangeName;
|
|
14961
15564
|
frameName: FrameName;
|
|
14962
|
-
}, backtest?: boolean, columns?: Columns$
|
|
15565
|
+
}, backtest?: boolean, columns?: Columns$6[]) => Promise<string>;
|
|
14963
15566
|
/**
|
|
14964
15567
|
* Saves heatmap report to disk for a strategy.
|
|
14965
15568
|
*
|
|
@@ -14992,7 +15595,7 @@ declare class HeatUtils {
|
|
|
14992
15595
|
strategyName: StrategyName;
|
|
14993
15596
|
exchangeName: ExchangeName;
|
|
14994
15597
|
frameName: FrameName;
|
|
14995
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
15598
|
+
}, backtest?: boolean, path?: string, columns?: Columns$6[]) => Promise<void>;
|
|
14996
15599
|
}
|
|
14997
15600
|
/**
|
|
14998
15601
|
* Singleton instance of HeatUtils for convenient heatmap operations.
|
|
@@ -15146,7 +15749,7 @@ declare const PositionSize: typeof PositionSizeUtils;
|
|
|
15146
15749
|
* @see ColumnModel for the base interface
|
|
15147
15750
|
* @see PartialEvent for the event data structure
|
|
15148
15751
|
*/
|
|
15149
|
-
type Columns$
|
|
15752
|
+
type Columns$5 = ColumnModel<PartialEvent>;
|
|
15150
15753
|
/**
|
|
15151
15754
|
* Service for generating and saving partial profit/loss markdown reports.
|
|
15152
15755
|
*
|
|
@@ -15268,7 +15871,7 @@ declare class PartialMarkdownService {
|
|
|
15268
15871
|
* console.log(markdown);
|
|
15269
15872
|
* ```
|
|
15270
15873
|
*/
|
|
15271
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
15874
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$5[]) => Promise<string>;
|
|
15272
15875
|
/**
|
|
15273
15876
|
* Saves symbol-strategy report to disk.
|
|
15274
15877
|
* Creates directory if it doesn't exist.
|
|
@@ -15293,7 +15896,7 @@ declare class PartialMarkdownService {
|
|
|
15293
15896
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
15294
15897
|
* ```
|
|
15295
15898
|
*/
|
|
15296
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
15899
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$5[]) => Promise<void>;
|
|
15297
15900
|
/**
|
|
15298
15901
|
* Clears accumulated event data from storage.
|
|
15299
15902
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -15403,27 +16006,153 @@ declare class PartialUtils {
|
|
|
15403
16006
|
* Also includes summary statistics at the end.
|
|
15404
16007
|
*
|
|
15405
16008
|
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
15406
|
-
* @param strategyName - Strategy name (e.g., "my-strategy")
|
|
15407
|
-
* @param columns - Optional columns configuration for the report
|
|
16009
|
+
* @param strategyName - Strategy name (e.g., "my-strategy")
|
|
16010
|
+
* @param columns - Optional columns configuration for the report
|
|
16011
|
+
* @returns Promise resolving to markdown formatted report string
|
|
16012
|
+
*
|
|
16013
|
+
* @example
|
|
16014
|
+
* ```typescript
|
|
16015
|
+
* const markdown = await Partial.getReport("BTCUSDT", "my-strategy");
|
|
16016
|
+
* console.log(markdown);
|
|
16017
|
+
*
|
|
16018
|
+
* // Output:
|
|
16019
|
+
* // # Partial Profit/Loss Report: BTCUSDT:my-strategy
|
|
16020
|
+
* //
|
|
16021
|
+
* // | Action | Symbol | Strategy | Signal ID | Position | Level % | Current Price | Timestamp | Mode |
|
|
16022
|
+
* // | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
16023
|
+
* // | PROFIT | BTCUSDT | my-strategy | abc123 | LONG | +10% | 51500.00000000 USD | 2024-01-15T10:30:00.000Z | Backtest |
|
|
16024
|
+
* // | LOSS | BTCUSDT | my-strategy | abc123 | LONG | -10% | 49000.00000000 USD | 2024-01-15T11:00:00.000Z | Backtest |
|
|
16025
|
+
* //
|
|
16026
|
+
* // **Total events:** 2
|
|
16027
|
+
* // **Profit events:** 1
|
|
16028
|
+
* // **Loss events:** 1
|
|
16029
|
+
* ```
|
|
16030
|
+
*/
|
|
16031
|
+
getReport: (symbol: string, context: {
|
|
16032
|
+
strategyName: StrategyName;
|
|
16033
|
+
exchangeName: ExchangeName;
|
|
16034
|
+
frameName: FrameName;
|
|
16035
|
+
}, backtest?: boolean, columns?: Columns$5[]) => Promise<string>;
|
|
16036
|
+
/**
|
|
16037
|
+
* Generates and saves markdown report to file.
|
|
16038
|
+
*
|
|
16039
|
+
* Creates directory if it doesn't exist.
|
|
16040
|
+
* Filename format: {symbol}_{strategyName}.md (e.g., "BTCUSDT_my-strategy.md")
|
|
16041
|
+
*
|
|
16042
|
+
* Delegates to PartialMarkdownService.dump() which:
|
|
16043
|
+
* 1. Generates markdown report via getReport()
|
|
16044
|
+
* 2. Creates output directory (recursive mkdir)
|
|
16045
|
+
* 3. Writes file with UTF-8 encoding
|
|
16046
|
+
* 4. Logs success/failure to console
|
|
16047
|
+
*
|
|
16048
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
16049
|
+
* @param strategyName - Strategy name (e.g., "my-strategy")
|
|
16050
|
+
* @param path - Output directory path (default: "./dump/partial")
|
|
16051
|
+
* @param columns - Optional columns configuration for the report
|
|
16052
|
+
* @returns Promise that resolves when file is written
|
|
16053
|
+
*
|
|
16054
|
+
* @example
|
|
16055
|
+
* ```typescript
|
|
16056
|
+
* // Save to default path: ./dump/partial/BTCUSDT_my-strategy.md
|
|
16057
|
+
* await Partial.dump("BTCUSDT", "my-strategy");
|
|
16058
|
+
*
|
|
16059
|
+
* // Save to custom path: ./reports/partial/BTCUSDT_my-strategy.md
|
|
16060
|
+
* await Partial.dump("BTCUSDT", "my-strategy", "./reports/partial");
|
|
16061
|
+
*
|
|
16062
|
+
* // After multiple symbols backtested, export all reports
|
|
16063
|
+
* for (const symbol of ["BTCUSDT", "ETHUSDT", "BNBUSDT"]) {
|
|
16064
|
+
* await Partial.dump(symbol, "my-strategy", "./backtest-results");
|
|
16065
|
+
* }
|
|
16066
|
+
* ```
|
|
16067
|
+
*/
|
|
16068
|
+
dump: (symbol: string, context: {
|
|
16069
|
+
strategyName: StrategyName;
|
|
16070
|
+
exchangeName: ExchangeName;
|
|
16071
|
+
frameName: FrameName;
|
|
16072
|
+
}, backtest?: boolean, path?: string, columns?: Columns$5[]) => Promise<void>;
|
|
16073
|
+
}
|
|
16074
|
+
/**
|
|
16075
|
+
* Global singleton instance of PartialUtils.
|
|
16076
|
+
* Provides static-like access to partial profit/loss reporting methods.
|
|
16077
|
+
*
|
|
16078
|
+
* @example
|
|
16079
|
+
* ```typescript
|
|
16080
|
+
* import { Partial } from "backtest-kit";
|
|
16081
|
+
*
|
|
16082
|
+
* // Usage same as PartialUtils methods
|
|
16083
|
+
* const stats = await Partial.getData("BTCUSDT", "my-strategy");
|
|
16084
|
+
* const report = await Partial.getReport("BTCUSDT", "my-strategy");
|
|
16085
|
+
* await Partial.dump("BTCUSDT", "my-strategy");
|
|
16086
|
+
* ```
|
|
16087
|
+
*/
|
|
16088
|
+
declare const Partial$1: PartialUtils;
|
|
16089
|
+
|
|
16090
|
+
/**
|
|
16091
|
+
* Type alias for column configuration used in highest profit markdown reports.
|
|
16092
|
+
*/
|
|
16093
|
+
type Columns$4 = ColumnModel<HighestProfitEvent>;
|
|
16094
|
+
/**
|
|
16095
|
+
* Service for generating and saving highest profit markdown reports.
|
|
16096
|
+
*
|
|
16097
|
+
* Listens to highestProfitSubject and accumulates events per
|
|
16098
|
+
* symbol-strategy-exchange-frame combination. Provides getData(),
|
|
16099
|
+
* getReport(), and dump() methods matching the Partial pattern.
|
|
16100
|
+
*/
|
|
16101
|
+
declare class HighestProfitMarkdownService {
|
|
16102
|
+
private readonly loggerService;
|
|
16103
|
+
private getStorage;
|
|
16104
|
+
subscribe: (() => () => void) & functools_kit.ISingleshotClearable;
|
|
16105
|
+
unsubscribe: () => Promise<void>;
|
|
16106
|
+
private tick;
|
|
16107
|
+
getData: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<HighestProfitStatisticsModel>;
|
|
16108
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$4[]) => Promise<string>;
|
|
16109
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$4[]) => Promise<void>;
|
|
16110
|
+
clear: (payload?: {
|
|
16111
|
+
symbol: string;
|
|
16112
|
+
strategyName: StrategyName;
|
|
16113
|
+
exchangeName: ExchangeName;
|
|
16114
|
+
frameName: FrameName;
|
|
16115
|
+
backtest: boolean;
|
|
16116
|
+
}) => Promise<void>;
|
|
16117
|
+
}
|
|
16118
|
+
|
|
16119
|
+
/**
|
|
16120
|
+
* Utility class for accessing highest profit reports and statistics.
|
|
16121
|
+
*
|
|
16122
|
+
* Provides static-like methods (via singleton instance) to retrieve data
|
|
16123
|
+
* accumulated by HighestProfitMarkdownService from highestProfitSubject events.
|
|
16124
|
+
*
|
|
16125
|
+
* @example
|
|
16126
|
+
* ```typescript
|
|
16127
|
+
* import { HighestProfit } from "backtest-kit";
|
|
16128
|
+
*
|
|
16129
|
+
* const stats = await HighestProfit.getData("BTCUSDT", { strategyName, exchangeName, frameName });
|
|
16130
|
+
* const report = await HighestProfit.getReport("BTCUSDT", { strategyName, exchangeName, frameName });
|
|
16131
|
+
* await HighestProfit.dump("BTCUSDT", { strategyName, exchangeName, frameName });
|
|
16132
|
+
* ```
|
|
16133
|
+
*/
|
|
16134
|
+
declare class HighestProfitUtils {
|
|
16135
|
+
/**
|
|
16136
|
+
* Retrieves statistical data from accumulated highest profit events.
|
|
16137
|
+
*
|
|
16138
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
16139
|
+
* @param context - Execution context
|
|
16140
|
+
* @param backtest - Whether to query backtest data
|
|
16141
|
+
* @returns Promise resolving to HighestProfitStatisticsModel
|
|
16142
|
+
*/
|
|
16143
|
+
getData: (symbol: string, context: {
|
|
16144
|
+
strategyName: StrategyName;
|
|
16145
|
+
exchangeName: ExchangeName;
|
|
16146
|
+
frameName: FrameName;
|
|
16147
|
+
}, backtest?: boolean) => Promise<HighestProfitStatisticsModel>;
|
|
16148
|
+
/**
|
|
16149
|
+
* Generates a markdown report with all highest profit events for a symbol-strategy pair.
|
|
16150
|
+
*
|
|
16151
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
16152
|
+
* @param context - Execution context
|
|
16153
|
+
* @param backtest - Whether to query backtest data
|
|
16154
|
+
* @param columns - Optional column configuration
|
|
15408
16155
|
* @returns Promise resolving to markdown formatted report string
|
|
15409
|
-
*
|
|
15410
|
-
* @example
|
|
15411
|
-
* ```typescript
|
|
15412
|
-
* const markdown = await Partial.getReport("BTCUSDT", "my-strategy");
|
|
15413
|
-
* console.log(markdown);
|
|
15414
|
-
*
|
|
15415
|
-
* // Output:
|
|
15416
|
-
* // # Partial Profit/Loss Report: BTCUSDT:my-strategy
|
|
15417
|
-
* //
|
|
15418
|
-
* // | Action | Symbol | Strategy | Signal ID | Position | Level % | Current Price | Timestamp | Mode |
|
|
15419
|
-
* // | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
15420
|
-
* // | PROFIT | BTCUSDT | my-strategy | abc123 | LONG | +10% | 51500.00000000 USD | 2024-01-15T10:30:00.000Z | Backtest |
|
|
15421
|
-
* // | LOSS | BTCUSDT | my-strategy | abc123 | LONG | -10% | 49000.00000000 USD | 2024-01-15T11:00:00.000Z | Backtest |
|
|
15422
|
-
* //
|
|
15423
|
-
* // **Total events:** 2
|
|
15424
|
-
* // **Profit events:** 1
|
|
15425
|
-
* // **Loss events:** 1
|
|
15426
|
-
* ```
|
|
15427
16156
|
*/
|
|
15428
16157
|
getReport: (symbol: string, context: {
|
|
15429
16158
|
strategyName: StrategyName;
|
|
@@ -15431,36 +16160,13 @@ declare class PartialUtils {
|
|
|
15431
16160
|
frameName: FrameName;
|
|
15432
16161
|
}, backtest?: boolean, columns?: Columns$4[]) => Promise<string>;
|
|
15433
16162
|
/**
|
|
15434
|
-
* Generates and saves markdown report to file.
|
|
15435
|
-
*
|
|
15436
|
-
* Creates directory if it doesn't exist.
|
|
15437
|
-
* Filename format: {symbol}_{strategyName}.md (e.g., "BTCUSDT_my-strategy.md")
|
|
15438
|
-
*
|
|
15439
|
-
* Delegates to PartialMarkdownService.dump() which:
|
|
15440
|
-
* 1. Generates markdown report via getReport()
|
|
15441
|
-
* 2. Creates output directory (recursive mkdir)
|
|
15442
|
-
* 3. Writes file with UTF-8 encoding
|
|
15443
|
-
* 4. Logs success/failure to console
|
|
16163
|
+
* Generates and saves a markdown report to file.
|
|
15444
16164
|
*
|
|
15445
16165
|
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
15446
|
-
* @param
|
|
15447
|
-
* @param
|
|
15448
|
-
* @param
|
|
15449
|
-
* @
|
|
15450
|
-
*
|
|
15451
|
-
* @example
|
|
15452
|
-
* ```typescript
|
|
15453
|
-
* // Save to default path: ./dump/partial/BTCUSDT_my-strategy.md
|
|
15454
|
-
* await Partial.dump("BTCUSDT", "my-strategy");
|
|
15455
|
-
*
|
|
15456
|
-
* // Save to custom path: ./reports/partial/BTCUSDT_my-strategy.md
|
|
15457
|
-
* await Partial.dump("BTCUSDT", "my-strategy", "./reports/partial");
|
|
15458
|
-
*
|
|
15459
|
-
* // After multiple symbols backtested, export all reports
|
|
15460
|
-
* for (const symbol of ["BTCUSDT", "ETHUSDT", "BNBUSDT"]) {
|
|
15461
|
-
* await Partial.dump(symbol, "my-strategy", "./backtest-results");
|
|
15462
|
-
* }
|
|
15463
|
-
* ```
|
|
16166
|
+
* @param context - Execution context
|
|
16167
|
+
* @param backtest - Whether to query backtest data
|
|
16168
|
+
* @param path - Output directory path (default: "./dump/highest_profit")
|
|
16169
|
+
* @param columns - Optional column configuration
|
|
15464
16170
|
*/
|
|
15465
16171
|
dump: (symbol: string, context: {
|
|
15466
16172
|
strategyName: StrategyName;
|
|
@@ -15469,20 +16175,9 @@ declare class PartialUtils {
|
|
|
15469
16175
|
}, backtest?: boolean, path?: string, columns?: Columns$4[]) => Promise<void>;
|
|
15470
16176
|
}
|
|
15471
16177
|
/**
|
|
15472
|
-
* Global singleton instance of
|
|
15473
|
-
* Provides static-like access to partial profit/loss reporting methods.
|
|
15474
|
-
*
|
|
15475
|
-
* @example
|
|
15476
|
-
* ```typescript
|
|
15477
|
-
* import { Partial } from "backtest-kit";
|
|
15478
|
-
*
|
|
15479
|
-
* // Usage same as PartialUtils methods
|
|
15480
|
-
* const stats = await Partial.getData("BTCUSDT", "my-strategy");
|
|
15481
|
-
* const report = await Partial.getReport("BTCUSDT", "my-strategy");
|
|
15482
|
-
* await Partial.dump("BTCUSDT", "my-strategy");
|
|
15483
|
-
* ```
|
|
16178
|
+
* Global singleton instance of HighestProfitUtils.
|
|
15484
16179
|
*/
|
|
15485
|
-
declare const
|
|
16180
|
+
declare const HighestProfit: HighestProfitUtils;
|
|
15486
16181
|
|
|
15487
16182
|
/**
|
|
15488
16183
|
* Utility class containing predefined trading constants for take-profit and stop-loss levels.
|
|
@@ -19778,6 +20473,12 @@ declare const strategyCommitSubject: Subject<StrategyCommitContract>;
|
|
|
19778
20473
|
* BacktestLogicPrivateService::*run
|
|
19779
20474
|
*/
|
|
19780
20475
|
declare const backtestScheduleOpenSubject: Subject<IStrategyTickResultOpened>;
|
|
20476
|
+
/**
|
|
20477
|
+
* Highest profit emitter for real-time profit tracking.
|
|
20478
|
+
* Emits updates on the highest profit achieved for an open position.
|
|
20479
|
+
* Allows users to track profit milestones and implement custom management logic based on profit levels.
|
|
20480
|
+
*/
|
|
20481
|
+
declare const highestProfitSubject: Subject<HighestProfitContract>;
|
|
19781
20482
|
|
|
19782
20483
|
declare const emitters_activePingSubject: typeof activePingSubject;
|
|
19783
20484
|
declare const emitters_backtestScheduleOpenSubject: typeof backtestScheduleOpenSubject;
|
|
@@ -19787,6 +20488,7 @@ declare const emitters_doneLiveSubject: typeof doneLiveSubject;
|
|
|
19787
20488
|
declare const emitters_doneWalkerSubject: typeof doneWalkerSubject;
|
|
19788
20489
|
declare const emitters_errorEmitter: typeof errorEmitter;
|
|
19789
20490
|
declare const emitters_exitEmitter: typeof exitEmitter;
|
|
20491
|
+
declare const emitters_highestProfitSubject: typeof highestProfitSubject;
|
|
19790
20492
|
declare const emitters_partialLossSubject: typeof partialLossSubject;
|
|
19791
20493
|
declare const emitters_partialProfitSubject: typeof partialProfitSubject;
|
|
19792
20494
|
declare const emitters_performanceEmitter: typeof performanceEmitter;
|
|
@@ -19805,7 +20507,7 @@ declare const emitters_walkerCompleteSubject: typeof walkerCompleteSubject;
|
|
|
19805
20507
|
declare const emitters_walkerEmitter: typeof walkerEmitter;
|
|
19806
20508
|
declare const emitters_walkerStopSubject: typeof walkerStopSubject;
|
|
19807
20509
|
declare namespace emitters {
|
|
19808
|
-
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_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 };
|
|
20510
|
+
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 };
|
|
19809
20511
|
}
|
|
19810
20512
|
|
|
19811
20513
|
/**
|
|
@@ -19970,7 +20672,7 @@ declare const investedCostToPercent: (dollarAmount: number, investedCost: number
|
|
|
19970
20672
|
*
|
|
19971
20673
|
* @param newStopLossPrice - Desired absolute stop-loss price
|
|
19972
20674
|
* @param originalStopLossPrice - Original stop-loss price from the pending signal
|
|
19973
|
-
* @param effectivePriceOpen - Effective entry price (from `
|
|
20675
|
+
* @param effectivePriceOpen - Effective entry price (from `getPositionEffectivePrice`)
|
|
19974
20676
|
* @returns percentShift to pass to `commitTrailingStop`
|
|
19975
20677
|
*
|
|
19976
20678
|
* @example
|
|
@@ -19988,7 +20690,7 @@ declare const slPriceToPercentShift: (newStopLossPrice: number, originalStopLoss
|
|
|
19988
20690
|
*
|
|
19989
20691
|
* @param newTakeProfitPrice - Desired absolute take-profit price
|
|
19990
20692
|
* @param originalTakeProfitPrice - Original take-profit price from the pending signal
|
|
19991
|
-
* @param effectivePriceOpen - Effective entry price (from `
|
|
20693
|
+
* @param effectivePriceOpen - Effective entry price (from `getPositionEffectivePrice`)
|
|
19992
20694
|
* @returns percentShift to pass to `commitTrailingTake`
|
|
19993
20695
|
*
|
|
19994
20696
|
* @example
|
|
@@ -20009,7 +20711,7 @@ declare const tpPriceToPercentShift: (newTakeProfitPrice: number, originalTakePr
|
|
|
20009
20711
|
*
|
|
20010
20712
|
* @param percentShift - Value returned by `slPriceToPercentShift` (or passed to `commitTrailingStop`)
|
|
20011
20713
|
* @param originalStopLossPrice - Original stop-loss price from the pending signal
|
|
20012
|
-
* @param effectivePriceOpen - Effective entry price (from `
|
|
20714
|
+
* @param effectivePriceOpen - Effective entry price (from `getPositionEffectivePrice`)
|
|
20013
20715
|
* @param position - Position direction: "long" or "short"
|
|
20014
20716
|
* @returns Absolute stop-loss price corresponding to the given percentShift
|
|
20015
20717
|
*
|
|
@@ -20030,7 +20732,7 @@ declare const slPercentShiftToPrice: (percentShift: number, originalStopLossPric
|
|
|
20030
20732
|
*
|
|
20031
20733
|
* @param percentShift - Value returned by `tpPriceToPercentShift` (or passed to `commitTrailingTake`)
|
|
20032
20734
|
* @param originalTakeProfitPrice - Original take-profit price from the pending signal
|
|
20033
|
-
* @param effectivePriceOpen - Effective entry price (from `
|
|
20735
|
+
* @param effectivePriceOpen - Effective entry price (from `getPositionEffectivePrice`)
|
|
20034
20736
|
* @param position - Position direction: "long" or "short"
|
|
20035
20737
|
* @returns Absolute take-profit price corresponding to the given percentShift
|
|
20036
20738
|
*
|
|
@@ -21330,7 +22032,7 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
21330
22032
|
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
21331
22033
|
* @returns Promise resolving to effective entry price or null
|
|
21332
22034
|
*/
|
|
21333
|
-
|
|
22035
|
+
getPositionEffectivePrice: (backtest: boolean, symbol: string, context: {
|
|
21334
22036
|
strategyName: StrategyName;
|
|
21335
22037
|
exchangeName: ExchangeName;
|
|
21336
22038
|
frameName: FrameName;
|
|
@@ -21619,6 +22321,136 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
21619
22321
|
exchangeName: ExchangeName;
|
|
21620
22322
|
frameName: FrameName;
|
|
21621
22323
|
}) => Promise<boolean>;
|
|
22324
|
+
/**
|
|
22325
|
+
* Returns the original estimated duration for the current pending signal.
|
|
22326
|
+
*
|
|
22327
|
+
* Delegates to ClientStrategy.getPositionEstimateMinutes().
|
|
22328
|
+
* Returns null if no pending signal exists.
|
|
22329
|
+
*
|
|
22330
|
+
* @param backtest - Whether running in backtest mode
|
|
22331
|
+
* @param symbol - Trading pair symbol
|
|
22332
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22333
|
+
* @returns Promise resolving to estimated duration in minutes or null
|
|
22334
|
+
*/
|
|
22335
|
+
getPositionEstimateMinutes: (backtest: boolean, symbol: string, context: {
|
|
22336
|
+
strategyName: StrategyName;
|
|
22337
|
+
exchangeName: ExchangeName;
|
|
22338
|
+
frameName: FrameName;
|
|
22339
|
+
}) => Promise<number | null>;
|
|
22340
|
+
/**
|
|
22341
|
+
* Returns the remaining time before the position expires, clamped to zero.
|
|
22342
|
+
*
|
|
22343
|
+
* Resolves current timestamp via timeMetaService and delegates to
|
|
22344
|
+
* ClientStrategy.getPositionCountdownMinutes().
|
|
22345
|
+
* Returns null if no pending signal exists.
|
|
22346
|
+
*
|
|
22347
|
+
* @param backtest - Whether running in backtest mode
|
|
22348
|
+
* @param symbol - Trading pair symbol
|
|
22349
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22350
|
+
* @returns Promise resolving to remaining minutes (≥ 0) or null
|
|
22351
|
+
*/
|
|
22352
|
+
getPositionCountdownMinutes: (backtest: boolean, symbol: string, context: {
|
|
22353
|
+
strategyName: StrategyName;
|
|
22354
|
+
exchangeName: ExchangeName;
|
|
22355
|
+
frameName: FrameName;
|
|
22356
|
+
}) => Promise<number | null>;
|
|
22357
|
+
/**
|
|
22358
|
+
* Returns the best price reached in the profit direction during this position's life.
|
|
22359
|
+
*
|
|
22360
|
+
* Delegates to ClientStrategy.getPositionHighestProfitPrice().
|
|
22361
|
+
* Returns null if no pending signal exists.
|
|
22362
|
+
*
|
|
22363
|
+
* @param backtest - Whether running in backtest mode
|
|
22364
|
+
* @param symbol - Trading pair symbol
|
|
22365
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22366
|
+
* @returns Promise resolving to price or null
|
|
22367
|
+
*/
|
|
22368
|
+
getPositionHighestProfitPrice: (backtest: boolean, symbol: string, context: {
|
|
22369
|
+
strategyName: StrategyName;
|
|
22370
|
+
exchangeName: ExchangeName;
|
|
22371
|
+
frameName: FrameName;
|
|
22372
|
+
}) => Promise<number | null>;
|
|
22373
|
+
/**
|
|
22374
|
+
* Returns the timestamp when the best profit price was recorded during this position's life.
|
|
22375
|
+
*
|
|
22376
|
+
* Delegates to ClientStrategy.getPositionHighestProfitTimestamp().
|
|
22377
|
+
* Returns null if no pending signal exists.
|
|
22378
|
+
*
|
|
22379
|
+
* @param backtest - Whether running in backtest mode
|
|
22380
|
+
* @param symbol - Trading pair symbol
|
|
22381
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22382
|
+
* @returns Promise resolving to timestamp in milliseconds or null
|
|
22383
|
+
*/
|
|
22384
|
+
getPositionHighestProfitTimestamp: (backtest: boolean, symbol: string, context: {
|
|
22385
|
+
strategyName: StrategyName;
|
|
22386
|
+
exchangeName: ExchangeName;
|
|
22387
|
+
frameName: FrameName;
|
|
22388
|
+
}) => Promise<number | null>;
|
|
22389
|
+
/**
|
|
22390
|
+
* Returns the PnL percentage at the moment the best profit price was recorded during this position's life.
|
|
22391
|
+
*
|
|
22392
|
+
* Delegates to ClientStrategy.getPositionHighestPnlPercentage().
|
|
22393
|
+
* Returns null if no pending signal exists.
|
|
22394
|
+
*
|
|
22395
|
+
* @param backtest - Whether running in backtest mode
|
|
22396
|
+
* @param symbol - Trading pair symbol
|
|
22397
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22398
|
+
* @returns Promise resolving to PnL percentage or null
|
|
22399
|
+
*/
|
|
22400
|
+
getPositionHighestPnlPercentage: (backtest: boolean, symbol: string, context: {
|
|
22401
|
+
strategyName: StrategyName;
|
|
22402
|
+
exchangeName: ExchangeName;
|
|
22403
|
+
frameName: FrameName;
|
|
22404
|
+
}) => Promise<number | null>;
|
|
22405
|
+
/**
|
|
22406
|
+
* Returns the PnL cost (in quote currency) at the moment the best profit price was recorded during this position's life.
|
|
22407
|
+
*
|
|
22408
|
+
* Delegates to ClientStrategy.getPositionHighestPnlCost().
|
|
22409
|
+
* Returns null if no pending signal exists.
|
|
22410
|
+
*
|
|
22411
|
+
* @param backtest - Whether running in backtest mode
|
|
22412
|
+
* @param symbol - Trading pair symbol
|
|
22413
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22414
|
+
* @returns Promise resolving to PnL cost or null
|
|
22415
|
+
*/
|
|
22416
|
+
getPositionHighestPnlCost: (backtest: boolean, symbol: string, context: {
|
|
22417
|
+
strategyName: StrategyName;
|
|
22418
|
+
exchangeName: ExchangeName;
|
|
22419
|
+
frameName: FrameName;
|
|
22420
|
+
}) => Promise<number | null>;
|
|
22421
|
+
/**
|
|
22422
|
+
* Returns whether breakeven was mathematically reachable at the highest profit price.
|
|
22423
|
+
*
|
|
22424
|
+
* Delegates to ClientStrategy.getPositionHighestProfitBreakeven().
|
|
22425
|
+
* Returns null if no pending signal exists.
|
|
22426
|
+
*
|
|
22427
|
+
* @param backtest - Whether running in backtest mode
|
|
22428
|
+
* @param symbol - Trading pair symbol
|
|
22429
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22430
|
+
* @returns Promise resolving to true if breakeven was reachable at peak, false otherwise, or null
|
|
22431
|
+
*/
|
|
22432
|
+
getPositionHighestProfitBreakeven: (backtest: boolean, symbol: string, context: {
|
|
22433
|
+
strategyName: StrategyName;
|
|
22434
|
+
exchangeName: ExchangeName;
|
|
22435
|
+
frameName: FrameName;
|
|
22436
|
+
}) => Promise<boolean | null>;
|
|
22437
|
+
/**
|
|
22438
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
22439
|
+
*
|
|
22440
|
+
* Resolves current timestamp via timeMetaService and delegates to
|
|
22441
|
+
* ClientStrategy.getPositionDrawdownMinutes().
|
|
22442
|
+
* Returns null if no pending signal exists.
|
|
22443
|
+
*
|
|
22444
|
+
* @param backtest - Whether running in backtest mode
|
|
22445
|
+
* @param symbol - Trading pair symbol
|
|
22446
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22447
|
+
* @returns Promise resolving to drawdown duration in minutes or null
|
|
22448
|
+
*/
|
|
22449
|
+
getPositionDrawdownMinutes: (backtest: boolean, symbol: string, context: {
|
|
22450
|
+
strategyName: StrategyName;
|
|
22451
|
+
exchangeName: ExchangeName;
|
|
22452
|
+
frameName: FrameName;
|
|
22453
|
+
}) => Promise<number | null>;
|
|
21622
22454
|
/**
|
|
21623
22455
|
* Disposes the ClientStrategy instance for the given context.
|
|
21624
22456
|
*
|
|
@@ -22694,7 +23526,7 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
22694
23526
|
exchangeName: ExchangeName;
|
|
22695
23527
|
frameName: FrameName;
|
|
22696
23528
|
}) => Promise<number | null>;
|
|
22697
|
-
|
|
23529
|
+
getPositionEffectivePrice: (backtest: boolean, symbol: string, context: {
|
|
22698
23530
|
strategyName: StrategyName;
|
|
22699
23531
|
exchangeName: ExchangeName;
|
|
22700
23532
|
frameName: FrameName;
|
|
@@ -23243,6 +24075,119 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
23243
24075
|
exchangeName: ExchangeName;
|
|
23244
24076
|
frameName: FrameName;
|
|
23245
24077
|
}) => Promise<boolean>;
|
|
24078
|
+
/**
|
|
24079
|
+
* Returns the original estimated duration for the current pending signal.
|
|
24080
|
+
*
|
|
24081
|
+
* Validates strategy existence and delegates to connection service.
|
|
24082
|
+
* Returns null if no pending signal exists.
|
|
24083
|
+
*
|
|
24084
|
+
* @param backtest - Whether running in backtest mode
|
|
24085
|
+
* @param symbol - Trading pair symbol
|
|
24086
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24087
|
+
* @returns Promise resolving to estimated duration in minutes or null
|
|
24088
|
+
*/
|
|
24089
|
+
getPositionEstimateMinutes: (backtest: boolean, symbol: string, context: {
|
|
24090
|
+
strategyName: StrategyName;
|
|
24091
|
+
exchangeName: ExchangeName;
|
|
24092
|
+
frameName: FrameName;
|
|
24093
|
+
}) => Promise<number | null>;
|
|
24094
|
+
/**
|
|
24095
|
+
* Returns the remaining time before the position expires, clamped to zero.
|
|
24096
|
+
*
|
|
24097
|
+
* Validates strategy existence and delegates to connection service.
|
|
24098
|
+
* Returns null if no pending signal exists.
|
|
24099
|
+
*
|
|
24100
|
+
* @param backtest - Whether running in backtest mode
|
|
24101
|
+
* @param symbol - Trading pair symbol
|
|
24102
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24103
|
+
* @returns Promise resolving to remaining minutes (≥ 0) or null
|
|
24104
|
+
*/
|
|
24105
|
+
getPositionCountdownMinutes: (backtest: boolean, symbol: string, context: {
|
|
24106
|
+
strategyName: StrategyName;
|
|
24107
|
+
exchangeName: ExchangeName;
|
|
24108
|
+
frameName: FrameName;
|
|
24109
|
+
}) => Promise<number | null>;
|
|
24110
|
+
/**
|
|
24111
|
+
* Returns the best price reached in the profit direction during this position's life.
|
|
24112
|
+
*
|
|
24113
|
+
* @param backtest - Whether running in backtest mode
|
|
24114
|
+
* @param symbol - Trading pair symbol
|
|
24115
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24116
|
+
* @returns Promise resolving to price or null
|
|
24117
|
+
*/
|
|
24118
|
+
getPositionHighestProfitPrice: (backtest: boolean, symbol: string, context: {
|
|
24119
|
+
strategyName: StrategyName;
|
|
24120
|
+
exchangeName: ExchangeName;
|
|
24121
|
+
frameName: FrameName;
|
|
24122
|
+
}) => Promise<number | null>;
|
|
24123
|
+
/**
|
|
24124
|
+
* Returns the timestamp when the best profit price was recorded during this position's life.
|
|
24125
|
+
*
|
|
24126
|
+
* @param backtest - Whether running in backtest mode
|
|
24127
|
+
* @param symbol - Trading pair symbol
|
|
24128
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24129
|
+
* @returns Promise resolving to timestamp in milliseconds or null
|
|
24130
|
+
*/
|
|
24131
|
+
getPositionHighestProfitTimestamp: (backtest: boolean, symbol: string, context: {
|
|
24132
|
+
strategyName: StrategyName;
|
|
24133
|
+
exchangeName: ExchangeName;
|
|
24134
|
+
frameName: FrameName;
|
|
24135
|
+
}) => Promise<number | null>;
|
|
24136
|
+
/**
|
|
24137
|
+
* Returns the PnL percentage at the moment the best profit price was recorded during this position's life.
|
|
24138
|
+
*
|
|
24139
|
+
* @param backtest - Whether running in backtest mode
|
|
24140
|
+
* @param symbol - Trading pair symbol
|
|
24141
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24142
|
+
* @returns Promise resolving to PnL percentage or null
|
|
24143
|
+
*/
|
|
24144
|
+
getPositionHighestPnlPercentage: (backtest: boolean, symbol: string, context: {
|
|
24145
|
+
strategyName: StrategyName;
|
|
24146
|
+
exchangeName: ExchangeName;
|
|
24147
|
+
frameName: FrameName;
|
|
24148
|
+
}) => Promise<number | null>;
|
|
24149
|
+
/**
|
|
24150
|
+
* Returns the PnL cost (in quote currency) at the moment the best profit price was recorded during this position's life.
|
|
24151
|
+
*
|
|
24152
|
+
* @param backtest - Whether running in backtest mode
|
|
24153
|
+
* @param symbol - Trading pair symbol
|
|
24154
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24155
|
+
* @returns Promise resolving to PnL cost or null
|
|
24156
|
+
*/
|
|
24157
|
+
getPositionHighestPnlCost: (backtest: boolean, symbol: string, context: {
|
|
24158
|
+
strategyName: StrategyName;
|
|
24159
|
+
exchangeName: ExchangeName;
|
|
24160
|
+
frameName: FrameName;
|
|
24161
|
+
}) => Promise<number | null>;
|
|
24162
|
+
/**
|
|
24163
|
+
* Returns whether breakeven was mathematically reachable at the highest profit price.
|
|
24164
|
+
*
|
|
24165
|
+
* @param backtest - Whether running in backtest mode
|
|
24166
|
+
* @param symbol - Trading pair symbol
|
|
24167
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24168
|
+
* @returns Promise resolving to true if breakeven was reachable at peak, false otherwise, or null
|
|
24169
|
+
*/
|
|
24170
|
+
getPositionHighestProfitBreakeven: (backtest: boolean, symbol: string, context: {
|
|
24171
|
+
strategyName: StrategyName;
|
|
24172
|
+
exchangeName: ExchangeName;
|
|
24173
|
+
frameName: FrameName;
|
|
24174
|
+
}) => Promise<boolean | null>;
|
|
24175
|
+
/**
|
|
24176
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
24177
|
+
*
|
|
24178
|
+
* Validates strategy existence and delegates to connection service.
|
|
24179
|
+
* Returns null if no pending signal exists.
|
|
24180
|
+
*
|
|
24181
|
+
* @param backtest - Whether running in backtest mode
|
|
24182
|
+
* @param symbol - Trading pair symbol
|
|
24183
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24184
|
+
* @returns Promise resolving to drawdown duration in minutes or null
|
|
24185
|
+
*/
|
|
24186
|
+
getPositionDrawdownMinutes: (backtest: boolean, symbol: string, context: {
|
|
24187
|
+
strategyName: StrategyName;
|
|
24188
|
+
exchangeName: ExchangeName;
|
|
24189
|
+
frameName: FrameName;
|
|
24190
|
+
}) => Promise<number | null>;
|
|
23246
24191
|
}
|
|
23247
24192
|
|
|
23248
24193
|
/**
|
|
@@ -25717,6 +26662,19 @@ declare class SyncReportService {
|
|
|
25717
26662
|
unsubscribe: () => Promise<void>;
|
|
25718
26663
|
}
|
|
25719
26664
|
|
|
26665
|
+
/**
|
|
26666
|
+
* Service for logging highest profit events to the JSONL report database.
|
|
26667
|
+
*
|
|
26668
|
+
* Listens to highestProfitSubject and writes each new price record to
|
|
26669
|
+
* Report.writeData() for persistence and analytics.
|
|
26670
|
+
*/
|
|
26671
|
+
declare class HighestProfitReportService {
|
|
26672
|
+
private readonly loggerService;
|
|
26673
|
+
private tick;
|
|
26674
|
+
subscribe: (() => () => void) & functools_kit.ISingleshotClearable;
|
|
26675
|
+
unsubscribe: () => Promise<void>;
|
|
26676
|
+
}
|
|
26677
|
+
|
|
25720
26678
|
declare const backtest: {
|
|
25721
26679
|
exchangeValidationService: ExchangeValidationService;
|
|
25722
26680
|
strategyValidationService: StrategyValidationService;
|
|
@@ -25738,6 +26696,7 @@ declare const backtest: {
|
|
|
25738
26696
|
riskReportService: RiskReportService;
|
|
25739
26697
|
strategyReportService: StrategyReportService;
|
|
25740
26698
|
syncReportService: SyncReportService;
|
|
26699
|
+
highestProfitReportService: HighestProfitReportService;
|
|
25741
26700
|
backtestMarkdownService: BacktestMarkdownService;
|
|
25742
26701
|
liveMarkdownService: LiveMarkdownService;
|
|
25743
26702
|
scheduleMarkdownService: ScheduleMarkdownService;
|
|
@@ -25749,6 +26708,7 @@ declare const backtest: {
|
|
|
25749
26708
|
riskMarkdownService: RiskMarkdownService;
|
|
25750
26709
|
strategyMarkdownService: StrategyMarkdownService;
|
|
25751
26710
|
syncMarkdownService: SyncMarkdownService;
|
|
26711
|
+
highestProfitMarkdownService: HighestProfitMarkdownService;
|
|
25752
26712
|
backtestLogicPublicService: BacktestLogicPublicService;
|
|
25753
26713
|
liveLogicPublicService: LiveLogicPublicService;
|
|
25754
26714
|
walkerLogicPublicService: WalkerLogicPublicService;
|
|
@@ -25868,4 +26828,4 @@ declare const getTotalClosed: (signal: Signal) => {
|
|
|
25868
26828
|
remainingCostBasis: number;
|
|
25869
26829
|
};
|
|
25870
26830
|
|
|
25871
|
-
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, 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, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, type IActionSchema, type IActivateScheduledCommitRow, type IAggregatedTradeData, type IBidData, type IBreakevenCommitRow, type IBroker, type ICandleData, type ICommitRow, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type ILog, type ILogEntry, type ILogger, type IMarkdownDumpOptions, 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, 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, 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 TLogCtor, type TMarkdownBase, 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, dumpMessages, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getMode, getNextCandles, getOrderBook, getPendingSignal,
|
|
26831
|
+
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, 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, 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 IExchangeSchema, type IFrameSchema, type IHeatmapRow, type ILog, type ILogEntry, type ILogger, type IMarkdownDumpOptions, 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, 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, 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 TLogCtor, type TMarkdownBase, 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, dumpMessages, 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, hasTradeContext, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, 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, roundTicks, set, setColumns, setConfig, setLogger, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, waitForCandle, warmCandles };
|