backtest-kit 5.5.3 → 5.6.1
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 +1999 -173
- package/build/index.mjs +1987 -173
- package/package.json +1 -1
- package/types.d.ts +1141 -179
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.
|
|
@@ -5133,72 +5414,6 @@ declare function stopStrategy(symbol: string): Promise<void>;
|
|
|
5133
5414
|
*/
|
|
5134
5415
|
declare function shutdown(): void;
|
|
5135
5416
|
|
|
5136
|
-
/**
|
|
5137
|
-
* Unified breakeven event data for report generation.
|
|
5138
|
-
* Contains all information about when signals reached breakeven.
|
|
5139
|
-
*/
|
|
5140
|
-
interface BreakevenEvent {
|
|
5141
|
-
/** Event timestamp in milliseconds */
|
|
5142
|
-
timestamp: number;
|
|
5143
|
-
/** Trading pair symbol */
|
|
5144
|
-
symbol: string;
|
|
5145
|
-
/** Strategy name */
|
|
5146
|
-
strategyName: StrategyName;
|
|
5147
|
-
/** Signal ID */
|
|
5148
|
-
signalId: string;
|
|
5149
|
-
/** Position type */
|
|
5150
|
-
position: string;
|
|
5151
|
-
/** Current market price when breakeven was reached */
|
|
5152
|
-
currentPrice: number;
|
|
5153
|
-
/** Entry price (breakeven level) */
|
|
5154
|
-
priceOpen: number;
|
|
5155
|
-
/** Take profit target price */
|
|
5156
|
-
priceTakeProfit?: number;
|
|
5157
|
-
/** Stop loss exit price */
|
|
5158
|
-
priceStopLoss?: number;
|
|
5159
|
-
/** Original take profit price set at signal creation */
|
|
5160
|
-
originalPriceTakeProfit?: number;
|
|
5161
|
-
/** Original stop loss price set at signal creation */
|
|
5162
|
-
originalPriceStopLoss?: number;
|
|
5163
|
-
/** Total number of DCA entries (present when averageBuy was applied) */
|
|
5164
|
-
totalEntries?: number;
|
|
5165
|
-
/** Total number of partial closes executed (_partial.length) */
|
|
5166
|
-
totalPartials?: number;
|
|
5167
|
-
/** Original entry price before DCA averaging (present when averageBuy was applied) */
|
|
5168
|
-
originalPriceOpen?: number;
|
|
5169
|
-
/** Total executed percentage from partial closes */
|
|
5170
|
-
partialExecuted?: number;
|
|
5171
|
-
/** Unrealized PNL at the moment breakeven was reached */
|
|
5172
|
-
pnl?: IStrategyPnL;
|
|
5173
|
-
/** Human-readable description of signal reason */
|
|
5174
|
-
note?: string;
|
|
5175
|
-
/** Timestamp when position became active (ms) */
|
|
5176
|
-
pendingAt?: number;
|
|
5177
|
-
/** Timestamp when signal was created/scheduled (ms) */
|
|
5178
|
-
scheduledAt?: number;
|
|
5179
|
-
/** True if backtest mode, false if live mode */
|
|
5180
|
-
backtest: boolean;
|
|
5181
|
-
}
|
|
5182
|
-
/**
|
|
5183
|
-
* Statistical data calculated from breakeven events.
|
|
5184
|
-
*
|
|
5185
|
-
* Provides metrics for breakeven milestone tracking.
|
|
5186
|
-
*
|
|
5187
|
-
* @example
|
|
5188
|
-
* ```typescript
|
|
5189
|
-
* const stats = await Breakeven.getData("BTCUSDT", "my-strategy");
|
|
5190
|
-
*
|
|
5191
|
-
* console.log(`Total breakeven events: ${stats.totalEvents}`);
|
|
5192
|
-
* console.log(`Average threshold: ${stats.averageThreshold}%`);
|
|
5193
|
-
* ```
|
|
5194
|
-
*/
|
|
5195
|
-
interface BreakevenStatisticsModel {
|
|
5196
|
-
/** Array of all breakeven events with full details */
|
|
5197
|
-
eventList: BreakevenEvent[];
|
|
5198
|
-
/** Total number of breakeven events */
|
|
5199
|
-
totalEvents: number;
|
|
5200
|
-
}
|
|
5201
|
-
|
|
5202
5417
|
declare const GLOBAL_CONFIG: {
|
|
5203
5418
|
/**
|
|
5204
5419
|
* Time to wait for scheduled signal to activate (in minutes)
|
|
@@ -5435,6 +5650,8 @@ declare const COLUMN_CONFIG: {
|
|
|
5435
5650
|
strategy_columns: ColumnModel<StrategyEvent>[];
|
|
5436
5651
|
/** Columns for signal sync lifecycle events (signal-open, signal-close) */
|
|
5437
5652
|
sync_columns: ColumnModel<SyncEvent>[];
|
|
5653
|
+
/** Columns for highest profit milestone tracking events */
|
|
5654
|
+
highest_profit_columns: ColumnModel<HighestProfitEvent>[];
|
|
5438
5655
|
/** Walker: PnL summary columns */
|
|
5439
5656
|
walker_pnl_columns: ColumnModel<SignalData$1>[];
|
|
5440
5657
|
/** Walker: strategy-level summary columns */
|
|
@@ -5611,6 +5828,7 @@ declare function getColumns(): {
|
|
|
5611
5828
|
schedule_columns: ColumnModel<ScheduledEvent>[];
|
|
5612
5829
|
strategy_columns: ColumnModel<StrategyEvent>[];
|
|
5613
5830
|
sync_columns: ColumnModel<SyncEvent>[];
|
|
5831
|
+
highest_profit_columns: ColumnModel<HighestProfitEvent>[];
|
|
5614
5832
|
walker_pnl_columns: ColumnModel<SignalData$1>[];
|
|
5615
5833
|
walker_strategy_columns: ColumnModel<IStrategyResult>[];
|
|
5616
5834
|
};
|
|
@@ -5639,6 +5857,7 @@ declare function getDefaultColumns(): Readonly<{
|
|
|
5639
5857
|
schedule_columns: ColumnModel<ScheduledEvent>[];
|
|
5640
5858
|
strategy_columns: ColumnModel<StrategyEvent>[];
|
|
5641
5859
|
sync_columns: ColumnModel<SyncEvent>[];
|
|
5860
|
+
highest_profit_columns: ColumnModel<HighestProfitEvent>[];
|
|
5642
5861
|
walker_pnl_columns: ColumnModel<SignalData$1>[];
|
|
5643
5862
|
walker_strategy_columns: ColumnModel<IStrategyResult>[];
|
|
5644
5863
|
}>;
|
|
@@ -6686,6 +6905,32 @@ interface WalkerContract {
|
|
|
6686
6905
|
totalStrategies: number;
|
|
6687
6906
|
}
|
|
6688
6907
|
|
|
6908
|
+
/**
|
|
6909
|
+
* Contract for highest profit updates emitted by the framework.
|
|
6910
|
+
* This contract defines the structure of the data emitted when a new highest profit is achieved for an open position.
|
|
6911
|
+
* It includes contextual information about the strategy, exchange, frame, and the associated signal.
|
|
6912
|
+
* Consumers can use this information to implement custom logic based on profit milestones (e.g. trailing stops, partial profit-taking).
|
|
6913
|
+
* The backtest flag allows consumers to differentiate between live and backtest updates for appropriate handling.
|
|
6914
|
+
*/
|
|
6915
|
+
interface HighestProfitContract {
|
|
6916
|
+
/** Trading symbol (e.g. "BTC/USDT") */
|
|
6917
|
+
symbol: string;
|
|
6918
|
+
/** Current price at the time of the highest profit update */
|
|
6919
|
+
currentPrice: number;
|
|
6920
|
+
/** Timestamp of the highest profit update (milliseconds since epoch) */
|
|
6921
|
+
timestamp: number;
|
|
6922
|
+
/** Strategy name for context */
|
|
6923
|
+
strategyName: StrategyName;
|
|
6924
|
+
/** Exchange name for context */
|
|
6925
|
+
exchangeName: ExchangeName;
|
|
6926
|
+
/** Frame name for context (e.g. "1m", "5m") */
|
|
6927
|
+
frameName: FrameName;
|
|
6928
|
+
/** Public signal data for the position associated with this highest profit update */
|
|
6929
|
+
signal: IPublicSignalRow;
|
|
6930
|
+
/** Indicates if the update is from a backtest or live trading (true for backtest, false for live) */
|
|
6931
|
+
backtest: boolean;
|
|
6932
|
+
}
|
|
6933
|
+
|
|
6689
6934
|
/**
|
|
6690
6935
|
* Subscribes to all signal events with queued async processing.
|
|
6691
6936
|
*
|
|
@@ -7701,15 +7946,36 @@ declare function listenSync(fn: (event: SignalSyncContract) => void): () => void
|
|
|
7701
7946
|
* @returns Unsubscribe function to cancel the listener before it fires
|
|
7702
7947
|
*/
|
|
7703
7948
|
declare function listenSyncOnce(filterFn: (event: SignalSyncContract) => boolean, fn: (event: SignalSyncContract) => void): () => void;
|
|
7704
|
-
|
|
7705
7949
|
/**
|
|
7706
|
-
*
|
|
7950
|
+
* Subscribes to highest profit events with queued async processing.
|
|
7951
|
+
* Emits when a signal reaches a new highest profit level during its lifecycle.
|
|
7952
|
+
* Events are processed sequentially in order received, even if callback is async.
|
|
7953
|
+
* Uses queued wrapper to prevent concurrent execution of the callback.
|
|
7954
|
+
* Useful for tracking profit milestones and implementing dynamic management logic.
|
|
7707
7955
|
*
|
|
7708
|
-
*
|
|
7709
|
-
*
|
|
7710
|
-
|
|
7956
|
+
* @param fn - Callback function to handle highest profit events
|
|
7957
|
+
* @return Unsubscribe function to stop listening to events
|
|
7958
|
+
*/
|
|
7959
|
+
declare function listenHighestProfit(fn: (event: HighestProfitContract) => void): () => void;
|
|
7960
|
+
/**
|
|
7961
|
+
* Subscribes to filtered highest profit events with one-time execution.
|
|
7962
|
+
* Listens for events matching the filter predicate, then executes callback once
|
|
7963
|
+
* and automatically unsubscribes. Useful for waiting for specific profit conditions.
|
|
7711
7964
|
*
|
|
7712
|
-
* @
|
|
7965
|
+
* @param filterFn - Predicate to filter which events trigger the callback
|
|
7966
|
+
* @param fn - Callback function to handle the filtered event (called only once)
|
|
7967
|
+
* @returns Unsubscribe function to cancel the listener before it fires
|
|
7968
|
+
*/
|
|
7969
|
+
declare function listenHighestProfitOnce(filterFn: (event: HighestProfitContract) => boolean, fn: (event: HighestProfitContract) => void): () => void;
|
|
7970
|
+
|
|
7971
|
+
/**
|
|
7972
|
+
* Checks if trade context is active (execution and method contexts).
|
|
7973
|
+
*
|
|
7974
|
+
* Returns true when both contexts are active, which is required for calling
|
|
7975
|
+
* exchange functions like getCandles, getAveragePrice, formatPrice, formatQuantity,
|
|
7976
|
+
* getDate, and getMode.
|
|
7977
|
+
*
|
|
7978
|
+
* @returns true if trade context is active, false otherwise
|
|
7713
7979
|
*
|
|
7714
7980
|
* @example
|
|
7715
7981
|
* ```typescript
|
|
@@ -9660,6 +9926,43 @@ interface PartialStatisticsModel {
|
|
|
9660
9926
|
totalLoss: number;
|
|
9661
9927
|
}
|
|
9662
9928
|
|
|
9929
|
+
/**
|
|
9930
|
+
* Single highest profit event recorded for a position.
|
|
9931
|
+
*/
|
|
9932
|
+
interface HighestProfitEvent {
|
|
9933
|
+
/** Unix timestamp in milliseconds when the record was set */
|
|
9934
|
+
timestamp: number;
|
|
9935
|
+
/** Trading pair symbol */
|
|
9936
|
+
symbol: string;
|
|
9937
|
+
/** Strategy name */
|
|
9938
|
+
strategyName: string;
|
|
9939
|
+
/** Signal unique identifier */
|
|
9940
|
+
signalId: string;
|
|
9941
|
+
/** Position direction */
|
|
9942
|
+
position: IPublicSignalRow["position"];
|
|
9943
|
+
/** Unrealized PNL at the time the record was set */
|
|
9944
|
+
pnl: IStrategyPnL;
|
|
9945
|
+
/** Record price reached in the profit direction */
|
|
9946
|
+
currentPrice: number;
|
|
9947
|
+
/** Effective entry price at the time of the update */
|
|
9948
|
+
priceOpen: number;
|
|
9949
|
+
/** Take profit price */
|
|
9950
|
+
priceTakeProfit: number;
|
|
9951
|
+
/** Stop loss price */
|
|
9952
|
+
priceStopLoss: number;
|
|
9953
|
+
/** Whether the event occurred in backtest mode */
|
|
9954
|
+
backtest: boolean;
|
|
9955
|
+
}
|
|
9956
|
+
/**
|
|
9957
|
+
* Aggregated statistics model for highest profit events.
|
|
9958
|
+
*/
|
|
9959
|
+
interface HighestProfitStatisticsModel {
|
|
9960
|
+
/** Full list of recorded events (newest first) */
|
|
9961
|
+
eventList: HighestProfitEvent[];
|
|
9962
|
+
/** Total number of recorded events */
|
|
9963
|
+
totalEvents: number;
|
|
9964
|
+
}
|
|
9965
|
+
|
|
9663
9966
|
/**
|
|
9664
9967
|
* Risk rejection event data for report generation.
|
|
9665
9968
|
* Contains all information about rejected signals due to risk limits.
|
|
@@ -9712,6 +10015,72 @@ interface RiskStatisticsModel {
|
|
|
9712
10015
|
byStrategy: Record<string, number>;
|
|
9713
10016
|
}
|
|
9714
10017
|
|
|
10018
|
+
/**
|
|
10019
|
+
* Unified breakeven event data for report generation.
|
|
10020
|
+
* Contains all information about when signals reached breakeven.
|
|
10021
|
+
*/
|
|
10022
|
+
interface BreakevenEvent {
|
|
10023
|
+
/** Event timestamp in milliseconds */
|
|
10024
|
+
timestamp: number;
|
|
10025
|
+
/** Trading pair symbol */
|
|
10026
|
+
symbol: string;
|
|
10027
|
+
/** Strategy name */
|
|
10028
|
+
strategyName: StrategyName;
|
|
10029
|
+
/** Signal ID */
|
|
10030
|
+
signalId: string;
|
|
10031
|
+
/** Position type */
|
|
10032
|
+
position: string;
|
|
10033
|
+
/** Current market price when breakeven was reached */
|
|
10034
|
+
currentPrice: number;
|
|
10035
|
+
/** Entry price (breakeven level) */
|
|
10036
|
+
priceOpen: number;
|
|
10037
|
+
/** Take profit target price */
|
|
10038
|
+
priceTakeProfit?: number;
|
|
10039
|
+
/** Stop loss exit price */
|
|
10040
|
+
priceStopLoss?: number;
|
|
10041
|
+
/** Original take profit price set at signal creation */
|
|
10042
|
+
originalPriceTakeProfit?: number;
|
|
10043
|
+
/** Original stop loss price set at signal creation */
|
|
10044
|
+
originalPriceStopLoss?: number;
|
|
10045
|
+
/** Total number of DCA entries (present when averageBuy was applied) */
|
|
10046
|
+
totalEntries?: number;
|
|
10047
|
+
/** Total number of partial closes executed (_partial.length) */
|
|
10048
|
+
totalPartials?: number;
|
|
10049
|
+
/** Original entry price before DCA averaging (present when averageBuy was applied) */
|
|
10050
|
+
originalPriceOpen?: number;
|
|
10051
|
+
/** Total executed percentage from partial closes */
|
|
10052
|
+
partialExecuted?: number;
|
|
10053
|
+
/** Unrealized PNL at the moment breakeven was reached */
|
|
10054
|
+
pnl?: IStrategyPnL;
|
|
10055
|
+
/** Human-readable description of signal reason */
|
|
10056
|
+
note?: string;
|
|
10057
|
+
/** Timestamp when position became active (ms) */
|
|
10058
|
+
pendingAt?: number;
|
|
10059
|
+
/** Timestamp when signal was created/scheduled (ms) */
|
|
10060
|
+
scheduledAt?: number;
|
|
10061
|
+
/** True if backtest mode, false if live mode */
|
|
10062
|
+
backtest: boolean;
|
|
10063
|
+
}
|
|
10064
|
+
/**
|
|
10065
|
+
* Statistical data calculated from breakeven events.
|
|
10066
|
+
*
|
|
10067
|
+
* Provides metrics for breakeven milestone tracking.
|
|
10068
|
+
*
|
|
10069
|
+
* @example
|
|
10070
|
+
* ```typescript
|
|
10071
|
+
* const stats = await Breakeven.getData("BTCUSDT", "my-strategy");
|
|
10072
|
+
*
|
|
10073
|
+
* console.log(`Total breakeven events: ${stats.totalEvents}`);
|
|
10074
|
+
* console.log(`Average threshold: ${stats.averageThreshold}%`);
|
|
10075
|
+
* ```
|
|
10076
|
+
*/
|
|
10077
|
+
interface BreakevenStatisticsModel {
|
|
10078
|
+
/** Array of all breakeven events with full details */
|
|
10079
|
+
eventList: BreakevenEvent[];
|
|
10080
|
+
/** Total number of breakeven events */
|
|
10081
|
+
totalEvents: number;
|
|
10082
|
+
}
|
|
10083
|
+
|
|
9715
10084
|
/**
|
|
9716
10085
|
* Action types for strategy events.
|
|
9717
10086
|
* Represents all possible strategy management actions.
|
|
@@ -10781,6 +11150,8 @@ interface IReportTarget {
|
|
|
10781
11150
|
backtest: boolean;
|
|
10782
11151
|
/** Enable signal synchronization event logging (signal-open, signal-close) */
|
|
10783
11152
|
sync: boolean;
|
|
11153
|
+
/** Enable highest profit milestone event logging */
|
|
11154
|
+
highest_profit: boolean;
|
|
10784
11155
|
}
|
|
10785
11156
|
/**
|
|
10786
11157
|
* Union type of all valid report names.
|
|
@@ -10932,7 +11303,7 @@ declare class ReportUtils {
|
|
|
10932
11303
|
*
|
|
10933
11304
|
* @returns Cleanup function that unsubscribes from all enabled services
|
|
10934
11305
|
*/
|
|
10935
|
-
enable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, schedule, walker, strategy, sync, }?: Partial<IReportTarget>) => (...args: any[]) => any;
|
|
11306
|
+
enable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, schedule, walker, strategy, sync, highest_profit, }?: Partial<IReportTarget>) => (...args: any[]) => any;
|
|
10936
11307
|
/**
|
|
10937
11308
|
* Disables report services selectively.
|
|
10938
11309
|
*
|
|
@@ -10969,7 +11340,7 @@ declare class ReportUtils {
|
|
|
10969
11340
|
* Report.disable();
|
|
10970
11341
|
* ```
|
|
10971
11342
|
*/
|
|
10972
|
-
disable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, schedule, walker, strategy, sync, }?: Partial<IReportTarget>) => void;
|
|
11343
|
+
disable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, schedule, walker, strategy, sync, highest_profit, }?: Partial<IReportTarget>) => void;
|
|
10973
11344
|
}
|
|
10974
11345
|
/**
|
|
10975
11346
|
* Report adapter with pluggable storage backend and instance memoization.
|
|
@@ -11061,6 +11432,8 @@ interface IMarkdownTarget {
|
|
|
11061
11432
|
backtest: boolean;
|
|
11062
11433
|
/** Enable signal sync lifecycle reports (signal-open and signal-close events) */
|
|
11063
11434
|
sync: boolean;
|
|
11435
|
+
/** Enable highest profit milestone tracking reports */
|
|
11436
|
+
highest_profit: boolean;
|
|
11064
11437
|
}
|
|
11065
11438
|
declare const WAIT_FOR_INIT_SYMBOL: unique symbol;
|
|
11066
11439
|
declare const WRITE_SAFE_SYMBOL: unique symbol;
|
|
@@ -11256,7 +11629,7 @@ declare class MarkdownUtils {
|
|
|
11256
11629
|
*
|
|
11257
11630
|
* @returns Cleanup function that unsubscribes from all enabled services
|
|
11258
11631
|
*/
|
|
11259
|
-
enable: ({ backtest: bt, breakeven, heat, live, partial, performance, strategy, risk, schedule, walker, sync, }?: Partial<IMarkdownTarget>) => (...args: any[]) => any;
|
|
11632
|
+
enable: ({ backtest: bt, breakeven, heat, live, partial, performance, strategy, risk, schedule, walker, sync, highest_profit, }?: Partial<IMarkdownTarget>) => (...args: any[]) => any;
|
|
11260
11633
|
/**
|
|
11261
11634
|
* Disables markdown report services selectively.
|
|
11262
11635
|
*
|
|
@@ -11294,7 +11667,7 @@ declare class MarkdownUtils {
|
|
|
11294
11667
|
* Markdown.disable();
|
|
11295
11668
|
* ```
|
|
11296
11669
|
*/
|
|
11297
|
-
disable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, strategy, schedule, walker, sync, }?: Partial<IMarkdownTarget>) => void;
|
|
11670
|
+
disable: ({ backtest: bt, breakeven, heat, live, partial, performance, risk, strategy, schedule, walker, sync, highest_profit, }?: Partial<IMarkdownTarget>) => void;
|
|
11298
11671
|
}
|
|
11299
11672
|
/**
|
|
11300
11673
|
* Markdown adapter with pluggable storage backend and instance memoization.
|
|
@@ -11494,7 +11867,7 @@ declare const Log: LogAdapter;
|
|
|
11494
11867
|
* @see ColumnModel for the base interface
|
|
11495
11868
|
* @see IStrategyTickResultClosed for the signal data structure
|
|
11496
11869
|
*/
|
|
11497
|
-
type Columns$
|
|
11870
|
+
type Columns$a = ColumnModel<IStrategyTickResultClosed>;
|
|
11498
11871
|
/**
|
|
11499
11872
|
* Service for generating and saving backtest markdown reports.
|
|
11500
11873
|
*
|
|
@@ -11588,7 +11961,7 @@ declare class BacktestMarkdownService {
|
|
|
11588
11961
|
* console.log(markdown);
|
|
11589
11962
|
* ```
|
|
11590
11963
|
*/
|
|
11591
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
11964
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$a[]) => Promise<string>;
|
|
11592
11965
|
/**
|
|
11593
11966
|
* Saves symbol-strategy report to disk.
|
|
11594
11967
|
* Creates directory if it doesn't exist.
|
|
@@ -11613,7 +11986,7 @@ declare class BacktestMarkdownService {
|
|
|
11613
11986
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", true, "./custom/path");
|
|
11614
11987
|
* ```
|
|
11615
11988
|
*/
|
|
11616
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
11989
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$a[]) => Promise<void>;
|
|
11617
11990
|
/**
|
|
11618
11991
|
* Clears accumulated signal data from storage.
|
|
11619
11992
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -11852,7 +12225,7 @@ declare class BacktestUtils {
|
|
|
11852
12225
|
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
11853
12226
|
* @returns Effective entry price, or null if no active position
|
|
11854
12227
|
*/
|
|
11855
|
-
|
|
12228
|
+
getPositionEffectivePrice: (symbol: string, context: {
|
|
11856
12229
|
strategyName: StrategyName;
|
|
11857
12230
|
exchangeName: ExchangeName;
|
|
11858
12231
|
frameName: FrameName;
|
|
@@ -11991,6 +12364,126 @@ declare class BacktestUtils {
|
|
|
11991
12364
|
cost: number;
|
|
11992
12365
|
timestamp: number;
|
|
11993
12366
|
}[]>;
|
|
12367
|
+
/**
|
|
12368
|
+
* Returns the original estimated duration for the current pending signal.
|
|
12369
|
+
*
|
|
12370
|
+
* Reflects `minuteEstimatedTime` as set in the signal DTO — the maximum
|
|
12371
|
+
* number of minutes the position is expected to be active before `time_expired`.
|
|
12372
|
+
*
|
|
12373
|
+
* Returns null if no pending signal exists.
|
|
12374
|
+
*
|
|
12375
|
+
* @param symbol - Trading pair symbol
|
|
12376
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12377
|
+
* @returns Estimated duration in minutes, or null if no active position
|
|
12378
|
+
*/
|
|
12379
|
+
getPositionEstimateMinutes: (symbol: string, context: {
|
|
12380
|
+
strategyName: StrategyName;
|
|
12381
|
+
exchangeName: ExchangeName;
|
|
12382
|
+
frameName: FrameName;
|
|
12383
|
+
}) => Promise<number>;
|
|
12384
|
+
/**
|
|
12385
|
+
* Returns the remaining time before the position expires, clamped to zero.
|
|
12386
|
+
*
|
|
12387
|
+
* Computes elapsed minutes since `pendingAt` and subtracts from `minuteEstimatedTime`.
|
|
12388
|
+
* Returns 0 once the estimate is exceeded (never negative).
|
|
12389
|
+
*
|
|
12390
|
+
* Returns null if no pending signal exists.
|
|
12391
|
+
*
|
|
12392
|
+
* @param symbol - Trading pair symbol
|
|
12393
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12394
|
+
* @returns Remaining minutes (≥ 0), or null if no active position
|
|
12395
|
+
*/
|
|
12396
|
+
getPositionCountdownMinutes: (symbol: string, context: {
|
|
12397
|
+
strategyName: StrategyName;
|
|
12398
|
+
exchangeName: ExchangeName;
|
|
12399
|
+
frameName: FrameName;
|
|
12400
|
+
}) => Promise<number>;
|
|
12401
|
+
/**
|
|
12402
|
+
* Returns the best price reached in the profit direction during this position's life.
|
|
12403
|
+
*
|
|
12404
|
+
* Returns null if no pending signal exists.
|
|
12405
|
+
*
|
|
12406
|
+
* @param symbol - Trading pair symbol
|
|
12407
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12408
|
+
* @returns price or null if no active position
|
|
12409
|
+
*/
|
|
12410
|
+
getPositionHighestProfitPrice: (symbol: string, context: {
|
|
12411
|
+
strategyName: StrategyName;
|
|
12412
|
+
exchangeName: ExchangeName;
|
|
12413
|
+
frameName: FrameName;
|
|
12414
|
+
}) => Promise<number>;
|
|
12415
|
+
/**
|
|
12416
|
+
* Returns the timestamp when the best profit price was recorded during this position's life.
|
|
12417
|
+
*
|
|
12418
|
+
* Returns null if no pending signal exists.
|
|
12419
|
+
*
|
|
12420
|
+
* @param symbol - Trading pair symbol
|
|
12421
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12422
|
+
* @returns timestamp in milliseconds or null if no active position
|
|
12423
|
+
*/
|
|
12424
|
+
getPositionHighestProfitTimestamp: (symbol: string, context: {
|
|
12425
|
+
strategyName: StrategyName;
|
|
12426
|
+
exchangeName: ExchangeName;
|
|
12427
|
+
frameName: FrameName;
|
|
12428
|
+
}) => Promise<number>;
|
|
12429
|
+
/**
|
|
12430
|
+
* Returns the PnL percentage at the moment the best profit price was recorded during this position's life.
|
|
12431
|
+
*
|
|
12432
|
+
* Returns null if no pending signal exists.
|
|
12433
|
+
*
|
|
12434
|
+
* @param symbol - Trading pair symbol
|
|
12435
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12436
|
+
* @returns PnL percentage or null if no active position
|
|
12437
|
+
*/
|
|
12438
|
+
getPositionHighestPnlPercentage: (symbol: string, context: {
|
|
12439
|
+
strategyName: StrategyName;
|
|
12440
|
+
exchangeName: ExchangeName;
|
|
12441
|
+
frameName: FrameName;
|
|
12442
|
+
}) => Promise<number>;
|
|
12443
|
+
/**
|
|
12444
|
+
* Returns the PnL cost (in quote currency) at the moment the best profit price was recorded during this position's life.
|
|
12445
|
+
*
|
|
12446
|
+
* Returns null if no pending signal exists.
|
|
12447
|
+
*
|
|
12448
|
+
* @param symbol - Trading pair symbol
|
|
12449
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12450
|
+
* @returns PnL cost or null if no active position
|
|
12451
|
+
*/
|
|
12452
|
+
getPositionHighestPnlCost: (symbol: string, context: {
|
|
12453
|
+
strategyName: StrategyName;
|
|
12454
|
+
exchangeName: ExchangeName;
|
|
12455
|
+
frameName: FrameName;
|
|
12456
|
+
}) => Promise<number>;
|
|
12457
|
+
/**
|
|
12458
|
+
* Returns whether breakeven was mathematically reachable at the highest profit price.
|
|
12459
|
+
*
|
|
12460
|
+
* @param symbol - Trading pair symbol
|
|
12461
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12462
|
+
* @returns true if breakeven was reachable at peak, false otherwise, or null if no active position
|
|
12463
|
+
*/
|
|
12464
|
+
getPositionHighestProfitBreakeven: (symbol: string, context: {
|
|
12465
|
+
strategyName: StrategyName;
|
|
12466
|
+
exchangeName: ExchangeName;
|
|
12467
|
+
frameName: FrameName;
|
|
12468
|
+
}) => Promise<boolean>;
|
|
12469
|
+
/**
|
|
12470
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
12471
|
+
*
|
|
12472
|
+
* Measures how long the position has been pulling back from its peak profit level.
|
|
12473
|
+
* Zero when called at the exact moment the peak was set.
|
|
12474
|
+
* Grows continuously as price moves away from the peak without setting a new record.
|
|
12475
|
+
*
|
|
12476
|
+
* Returns null if no pending signal exists.
|
|
12477
|
+
*
|
|
12478
|
+
* @param symbol - Trading pair symbol
|
|
12479
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
12480
|
+
* @returns Drawdown duration in minutes, or null if no active position
|
|
12481
|
+
*/
|
|
12482
|
+
getPositionDrawdownMinutes: (symbol: string, context: {
|
|
12483
|
+
strategyName: StrategyName;
|
|
12484
|
+
exchangeName: ExchangeName;
|
|
12485
|
+
frameName: FrameName;
|
|
12486
|
+
}) => Promise<number>;
|
|
11994
12487
|
/**
|
|
11995
12488
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
11996
12489
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -12508,7 +13001,7 @@ declare class BacktestUtils {
|
|
|
12508
13001
|
strategyName: StrategyName;
|
|
12509
13002
|
exchangeName: ExchangeName;
|
|
12510
13003
|
frameName: FrameName;
|
|
12511
|
-
}, columns?: Columns$
|
|
13004
|
+
}, columns?: Columns$a[]) => Promise<string>;
|
|
12512
13005
|
/**
|
|
12513
13006
|
* Saves strategy report to disk.
|
|
12514
13007
|
*
|
|
@@ -12539,7 +13032,7 @@ declare class BacktestUtils {
|
|
|
12539
13032
|
strategyName: StrategyName;
|
|
12540
13033
|
exchangeName: ExchangeName;
|
|
12541
13034
|
frameName: FrameName;
|
|
12542
|
-
}, path?: string, columns?: Columns$
|
|
13035
|
+
}, path?: string, columns?: Columns$a[]) => Promise<void>;
|
|
12543
13036
|
/**
|
|
12544
13037
|
* Lists all active backtest instances with their current status.
|
|
12545
13038
|
*
|
|
@@ -12613,7 +13106,7 @@ declare const Backtest: BacktestUtils;
|
|
|
12613
13106
|
* @see ColumnModel for the base interface
|
|
12614
13107
|
* @see TickEvent for the event data structure
|
|
12615
13108
|
*/
|
|
12616
|
-
type Columns$
|
|
13109
|
+
type Columns$9 = ColumnModel<TickEvent>;
|
|
12617
13110
|
/**
|
|
12618
13111
|
* Service for generating and saving live trading markdown reports.
|
|
12619
13112
|
*
|
|
@@ -12740,7 +13233,7 @@ declare class LiveMarkdownService {
|
|
|
12740
13233
|
* console.log(markdown);
|
|
12741
13234
|
* ```
|
|
12742
13235
|
*/
|
|
12743
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
13236
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$9[]) => Promise<string>;
|
|
12744
13237
|
/**
|
|
12745
13238
|
* Saves symbol-strategy report to disk.
|
|
12746
13239
|
* Creates directory if it doesn't exist.
|
|
@@ -12765,7 +13258,7 @@ declare class LiveMarkdownService {
|
|
|
12765
13258
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
12766
13259
|
* ```
|
|
12767
13260
|
*/
|
|
12768
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
13261
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$9[]) => Promise<void>;
|
|
12769
13262
|
/**
|
|
12770
13263
|
* Clears accumulated event data from storage.
|
|
12771
13264
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -12981,7 +13474,7 @@ declare class LiveUtils {
|
|
|
12981
13474
|
* @param context - Execution context with strategyName and exchangeName
|
|
12982
13475
|
* @returns Effective entry price, or null if no active position
|
|
12983
13476
|
*/
|
|
12984
|
-
|
|
13477
|
+
getPositionEffectivePrice: (symbol: string, context: {
|
|
12985
13478
|
strategyName: StrategyName;
|
|
12986
13479
|
exchangeName: ExchangeName;
|
|
12987
13480
|
}) => Promise<number | null>;
|
|
@@ -13112,6 +13605,118 @@ declare class LiveUtils {
|
|
|
13112
13605
|
cost: number;
|
|
13113
13606
|
timestamp: number;
|
|
13114
13607
|
}[]>;
|
|
13608
|
+
/**
|
|
13609
|
+
* Returns the original estimated duration for the current pending signal.
|
|
13610
|
+
*
|
|
13611
|
+
* Reflects `minuteEstimatedTime` as set in the signal DTO — the maximum
|
|
13612
|
+
* number of minutes the position is expected to be active before `time_expired`.
|
|
13613
|
+
*
|
|
13614
|
+
* Returns null if no pending signal exists.
|
|
13615
|
+
*
|
|
13616
|
+
* @param symbol - Trading pair symbol
|
|
13617
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13618
|
+
* @returns Estimated duration in minutes, or null if no active position
|
|
13619
|
+
*/
|
|
13620
|
+
getPositionEstimateMinutes: (symbol: string, context: {
|
|
13621
|
+
strategyName: StrategyName;
|
|
13622
|
+
exchangeName: ExchangeName;
|
|
13623
|
+
}) => Promise<number>;
|
|
13624
|
+
/**
|
|
13625
|
+
* Returns the remaining time before the position expires, clamped to zero.
|
|
13626
|
+
*
|
|
13627
|
+
* Computes elapsed minutes since `pendingAt` and subtracts from `minuteEstimatedTime`.
|
|
13628
|
+
* Returns 0 once the estimate is exceeded (never negative).
|
|
13629
|
+
*
|
|
13630
|
+
* Returns null if no pending signal exists.
|
|
13631
|
+
*
|
|
13632
|
+
* @param symbol - Trading pair symbol
|
|
13633
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13634
|
+
* @returns Remaining minutes (≥ 0), or null if no active position
|
|
13635
|
+
*/
|
|
13636
|
+
getPositionCountdownMinutes: (symbol: string, context: {
|
|
13637
|
+
strategyName: StrategyName;
|
|
13638
|
+
exchangeName: ExchangeName;
|
|
13639
|
+
}) => Promise<number>;
|
|
13640
|
+
/**
|
|
13641
|
+
* Returns the best price reached in the profit direction during this position's life.
|
|
13642
|
+
*
|
|
13643
|
+
* Returns null if no pending signal exists.
|
|
13644
|
+
*
|
|
13645
|
+
* @param symbol - Trading pair symbol
|
|
13646
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13647
|
+
* @returns price or null if no active position
|
|
13648
|
+
*/
|
|
13649
|
+
getPositionHighestProfitPrice: (symbol: string, context: {
|
|
13650
|
+
strategyName: StrategyName;
|
|
13651
|
+
exchangeName: ExchangeName;
|
|
13652
|
+
}) => Promise<number>;
|
|
13653
|
+
/**
|
|
13654
|
+
* Returns the timestamp when the best profit price was recorded during this position's life.
|
|
13655
|
+
*
|
|
13656
|
+
* Returns null if no pending signal exists.
|
|
13657
|
+
*
|
|
13658
|
+
* @param symbol - Trading pair symbol
|
|
13659
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13660
|
+
* @returns timestamp in milliseconds or null if no active position
|
|
13661
|
+
*/
|
|
13662
|
+
getPositionHighestProfitTimestamp: (symbol: string, context: {
|
|
13663
|
+
strategyName: StrategyName;
|
|
13664
|
+
exchangeName: ExchangeName;
|
|
13665
|
+
}) => Promise<number>;
|
|
13666
|
+
/**
|
|
13667
|
+
* Returns the PnL percentage at the moment the best profit price was recorded during this position's life.
|
|
13668
|
+
*
|
|
13669
|
+
* Returns null if no pending signal exists.
|
|
13670
|
+
*
|
|
13671
|
+
* @param symbol - Trading pair symbol
|
|
13672
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13673
|
+
* @returns PnL percentage or null if no active position
|
|
13674
|
+
*/
|
|
13675
|
+
getPositionHighestPnlPercentage: (symbol: string, context: {
|
|
13676
|
+
strategyName: StrategyName;
|
|
13677
|
+
exchangeName: ExchangeName;
|
|
13678
|
+
}) => Promise<number>;
|
|
13679
|
+
/**
|
|
13680
|
+
* Returns the PnL cost (in quote currency) at the moment the best profit price was recorded during this position's life.
|
|
13681
|
+
*
|
|
13682
|
+
* Returns null if no pending signal exists.
|
|
13683
|
+
*
|
|
13684
|
+
* @param symbol - Trading pair symbol
|
|
13685
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13686
|
+
* @returns PnL cost or null if no active position
|
|
13687
|
+
*/
|
|
13688
|
+
getPositionHighestPnlCost: (symbol: string, context: {
|
|
13689
|
+
strategyName: StrategyName;
|
|
13690
|
+
exchangeName: ExchangeName;
|
|
13691
|
+
}) => Promise<number>;
|
|
13692
|
+
/**
|
|
13693
|
+
* Returns whether breakeven was mathematically reachable at the highest profit price.
|
|
13694
|
+
*
|
|
13695
|
+
* @param symbol - Trading pair symbol
|
|
13696
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13697
|
+
* @returns true if breakeven was reachable at peak, false otherwise, or null if no active position
|
|
13698
|
+
*/
|
|
13699
|
+
getPositionHighestProfitBreakeven: (symbol: string, context: {
|
|
13700
|
+
strategyName: StrategyName;
|
|
13701
|
+
exchangeName: ExchangeName;
|
|
13702
|
+
}) => Promise<boolean>;
|
|
13703
|
+
/**
|
|
13704
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
13705
|
+
*
|
|
13706
|
+
* Measures how long the position has been pulling back from its peak profit level.
|
|
13707
|
+
* Zero when called at the exact moment the peak was set.
|
|
13708
|
+
* Grows continuously as price moves away from the peak without setting a new record.
|
|
13709
|
+
*
|
|
13710
|
+
* Returns null if no pending signal exists.
|
|
13711
|
+
*
|
|
13712
|
+
* @param symbol - Trading pair symbol
|
|
13713
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13714
|
+
* @returns Drawdown duration in minutes, or null if no active position
|
|
13715
|
+
*/
|
|
13716
|
+
getPositionDrawdownMinutes: (symbol: string, context: {
|
|
13717
|
+
strategyName: StrategyName;
|
|
13718
|
+
exchangeName: ExchangeName;
|
|
13719
|
+
}) => Promise<number>;
|
|
13115
13720
|
/**
|
|
13116
13721
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
13117
13722
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -13597,7 +14202,7 @@ declare class LiveUtils {
|
|
|
13597
14202
|
getReport: (symbol: string, context: {
|
|
13598
14203
|
strategyName: StrategyName;
|
|
13599
14204
|
exchangeName: ExchangeName;
|
|
13600
|
-
}, columns?: Columns$
|
|
14205
|
+
}, columns?: Columns$9[]) => Promise<string>;
|
|
13601
14206
|
/**
|
|
13602
14207
|
* Saves strategy report to disk.
|
|
13603
14208
|
*
|
|
@@ -13627,7 +14232,7 @@ declare class LiveUtils {
|
|
|
13627
14232
|
dump: (symbol: string, context: {
|
|
13628
14233
|
strategyName: StrategyName;
|
|
13629
14234
|
exchangeName: ExchangeName;
|
|
13630
|
-
}, path?: string, columns?: Columns$
|
|
14235
|
+
}, path?: string, columns?: Columns$9[]) => Promise<void>;
|
|
13631
14236
|
/**
|
|
13632
14237
|
* Lists all active live trading instances with their current status.
|
|
13633
14238
|
*
|
|
@@ -13697,7 +14302,7 @@ declare const Live: LiveUtils;
|
|
|
13697
14302
|
* @see ColumnModel for the base interface
|
|
13698
14303
|
* @see ScheduledEvent for the event data structure
|
|
13699
14304
|
*/
|
|
13700
|
-
type Columns$
|
|
14305
|
+
type Columns$8 = ColumnModel<ScheduledEvent>;
|
|
13701
14306
|
/**
|
|
13702
14307
|
* Service for generating and saving scheduled signals markdown reports.
|
|
13703
14308
|
*
|
|
@@ -13808,7 +14413,7 @@ declare class ScheduleMarkdownService {
|
|
|
13808
14413
|
* console.log(markdown);
|
|
13809
14414
|
* ```
|
|
13810
14415
|
*/
|
|
13811
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
14416
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$8[]) => Promise<string>;
|
|
13812
14417
|
/**
|
|
13813
14418
|
* Saves symbol-strategy report to disk.
|
|
13814
14419
|
* Creates directory if it doesn't exist.
|
|
@@ -13833,7 +14438,7 @@ declare class ScheduleMarkdownService {
|
|
|
13833
14438
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
13834
14439
|
* ```
|
|
13835
14440
|
*/
|
|
13836
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
14441
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$8[]) => Promise<void>;
|
|
13837
14442
|
/**
|
|
13838
14443
|
* Clears accumulated event data from storage.
|
|
13839
14444
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -13923,7 +14528,7 @@ declare class ScheduleUtils {
|
|
|
13923
14528
|
strategyName: StrategyName;
|
|
13924
14529
|
exchangeName: ExchangeName;
|
|
13925
14530
|
frameName: FrameName;
|
|
13926
|
-
}, backtest?: boolean, columns?: Columns$
|
|
14531
|
+
}, backtest?: boolean, columns?: Columns$8[]) => Promise<string>;
|
|
13927
14532
|
/**
|
|
13928
14533
|
* Saves strategy report to disk.
|
|
13929
14534
|
*
|
|
@@ -13945,7 +14550,7 @@ declare class ScheduleUtils {
|
|
|
13945
14550
|
strategyName: StrategyName;
|
|
13946
14551
|
exchangeName: ExchangeName;
|
|
13947
14552
|
frameName: FrameName;
|
|
13948
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
14553
|
+
}, backtest?: boolean, path?: string, columns?: Columns$8[]) => Promise<void>;
|
|
13949
14554
|
}
|
|
13950
14555
|
/**
|
|
13951
14556
|
* Singleton instance of ScheduleUtils for convenient scheduled signals reporting.
|
|
@@ -13991,7 +14596,7 @@ declare const Schedule: ScheduleUtils;
|
|
|
13991
14596
|
* @see ColumnModel for the base interface
|
|
13992
14597
|
* @see MetricStats for the metric data structure
|
|
13993
14598
|
*/
|
|
13994
|
-
type Columns$
|
|
14599
|
+
type Columns$7 = ColumnModel<MetricStats>;
|
|
13995
14600
|
/**
|
|
13996
14601
|
* Service for collecting and analyzing performance metrics.
|
|
13997
14602
|
*
|
|
@@ -14098,7 +14703,7 @@ declare class PerformanceMarkdownService {
|
|
|
14098
14703
|
* console.log(markdown);
|
|
14099
14704
|
* ```
|
|
14100
14705
|
*/
|
|
14101
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
14706
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$7[]) => Promise<string>;
|
|
14102
14707
|
/**
|
|
14103
14708
|
* Saves performance report to disk.
|
|
14104
14709
|
*
|
|
@@ -14119,7 +14724,7 @@ declare class PerformanceMarkdownService {
|
|
|
14119
14724
|
* await performanceService.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
14120
14725
|
* ```
|
|
14121
14726
|
*/
|
|
14122
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
14727
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$7[]) => Promise<void>;
|
|
14123
14728
|
/**
|
|
14124
14729
|
* Clears accumulated performance data from storage.
|
|
14125
14730
|
*
|
|
@@ -14227,7 +14832,7 @@ declare class Performance {
|
|
|
14227
14832
|
strategyName: StrategyName;
|
|
14228
14833
|
exchangeName: ExchangeName;
|
|
14229
14834
|
frameName: FrameName;
|
|
14230
|
-
}, backtest?: boolean, columns?: Columns$
|
|
14835
|
+
}, backtest?: boolean, columns?: Columns$7[]): Promise<string>;
|
|
14231
14836
|
/**
|
|
14232
14837
|
* Saves performance report to disk.
|
|
14233
14838
|
*
|
|
@@ -14252,7 +14857,7 @@ declare class Performance {
|
|
|
14252
14857
|
strategyName: StrategyName;
|
|
14253
14858
|
exchangeName: ExchangeName;
|
|
14254
14859
|
frameName: FrameName;
|
|
14255
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
14860
|
+
}, backtest?: boolean, path?: string, columns?: Columns$7[]): Promise<void>;
|
|
14256
14861
|
}
|
|
14257
14862
|
|
|
14258
14863
|
/**
|
|
@@ -14683,7 +15288,7 @@ declare const Walker: WalkerUtils;
|
|
|
14683
15288
|
* @see ColumnModel for the base interface
|
|
14684
15289
|
* @see IHeatmapRow for the row data structure
|
|
14685
15290
|
*/
|
|
14686
|
-
type Columns$
|
|
15291
|
+
type Columns$6 = ColumnModel<IHeatmapRow>;
|
|
14687
15292
|
/**
|
|
14688
15293
|
* Portfolio Heatmap Markdown Service.
|
|
14689
15294
|
*
|
|
@@ -14804,7 +15409,7 @@ declare class HeatMarkdownService {
|
|
|
14804
15409
|
* // ...
|
|
14805
15410
|
* ```
|
|
14806
15411
|
*/
|
|
14807
|
-
getReport: (strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
15412
|
+
getReport: (strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$6[]) => Promise<string>;
|
|
14808
15413
|
/**
|
|
14809
15414
|
* Saves heatmap report to disk.
|
|
14810
15415
|
*
|
|
@@ -14829,7 +15434,7 @@ declare class HeatMarkdownService {
|
|
|
14829
15434
|
* await service.dump("my-strategy", "binance", "frame1", true, "./reports");
|
|
14830
15435
|
* ```
|
|
14831
15436
|
*/
|
|
14832
|
-
dump: (strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
15437
|
+
dump: (strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$6[]) => Promise<void>;
|
|
14833
15438
|
/**
|
|
14834
15439
|
* Clears accumulated heatmap data from storage.
|
|
14835
15440
|
* If payload is provided, clears only that exchangeName+frameName+backtest combination's data.
|
|
@@ -14959,7 +15564,7 @@ declare class HeatUtils {
|
|
|
14959
15564
|
strategyName: StrategyName;
|
|
14960
15565
|
exchangeName: ExchangeName;
|
|
14961
15566
|
frameName: FrameName;
|
|
14962
|
-
}, backtest?: boolean, columns?: Columns$
|
|
15567
|
+
}, backtest?: boolean, columns?: Columns$6[]) => Promise<string>;
|
|
14963
15568
|
/**
|
|
14964
15569
|
* Saves heatmap report to disk for a strategy.
|
|
14965
15570
|
*
|
|
@@ -14992,7 +15597,7 @@ declare class HeatUtils {
|
|
|
14992
15597
|
strategyName: StrategyName;
|
|
14993
15598
|
exchangeName: ExchangeName;
|
|
14994
15599
|
frameName: FrameName;
|
|
14995
|
-
}, backtest?: boolean, path?: string, columns?: Columns$
|
|
15600
|
+
}, backtest?: boolean, path?: string, columns?: Columns$6[]) => Promise<void>;
|
|
14996
15601
|
}
|
|
14997
15602
|
/**
|
|
14998
15603
|
* Singleton instance of HeatUtils for convenient heatmap operations.
|
|
@@ -15146,7 +15751,7 @@ declare const PositionSize: typeof PositionSizeUtils;
|
|
|
15146
15751
|
* @see ColumnModel for the base interface
|
|
15147
15752
|
* @see PartialEvent for the event data structure
|
|
15148
15753
|
*/
|
|
15149
|
-
type Columns$
|
|
15754
|
+
type Columns$5 = ColumnModel<PartialEvent>;
|
|
15150
15755
|
/**
|
|
15151
15756
|
* Service for generating and saving partial profit/loss markdown reports.
|
|
15152
15757
|
*
|
|
@@ -15268,7 +15873,7 @@ declare class PartialMarkdownService {
|
|
|
15268
15873
|
* console.log(markdown);
|
|
15269
15874
|
* ```
|
|
15270
15875
|
*/
|
|
15271
|
-
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$
|
|
15876
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$5[]) => Promise<string>;
|
|
15272
15877
|
/**
|
|
15273
15878
|
* Saves symbol-strategy report to disk.
|
|
15274
15879
|
* Creates directory if it doesn't exist.
|
|
@@ -15293,7 +15898,7 @@ declare class PartialMarkdownService {
|
|
|
15293
15898
|
* await service.dump("BTCUSDT", "my-strategy", "binance", "1h", false, "./custom/path");
|
|
15294
15899
|
* ```
|
|
15295
15900
|
*/
|
|
15296
|
-
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$
|
|
15901
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$5[]) => Promise<void>;
|
|
15297
15902
|
/**
|
|
15298
15903
|
* Clears accumulated event data from storage.
|
|
15299
15904
|
* If payload is provided, clears only that specific symbol-strategy-exchange-frame-backtest combination's data.
|
|
@@ -15403,27 +16008,153 @@ declare class PartialUtils {
|
|
|
15403
16008
|
* Also includes summary statistics at the end.
|
|
15404
16009
|
*
|
|
15405
16010
|
* @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
|
|
16011
|
+
* @param strategyName - Strategy name (e.g., "my-strategy")
|
|
16012
|
+
* @param columns - Optional columns configuration for the report
|
|
16013
|
+
* @returns Promise resolving to markdown formatted report string
|
|
16014
|
+
*
|
|
16015
|
+
* @example
|
|
16016
|
+
* ```typescript
|
|
16017
|
+
* const markdown = await Partial.getReport("BTCUSDT", "my-strategy");
|
|
16018
|
+
* console.log(markdown);
|
|
16019
|
+
*
|
|
16020
|
+
* // Output:
|
|
16021
|
+
* // # Partial Profit/Loss Report: BTCUSDT:my-strategy
|
|
16022
|
+
* //
|
|
16023
|
+
* // | Action | Symbol | Strategy | Signal ID | Position | Level % | Current Price | Timestamp | Mode |
|
|
16024
|
+
* // | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
|
16025
|
+
* // | PROFIT | BTCUSDT | my-strategy | abc123 | LONG | +10% | 51500.00000000 USD | 2024-01-15T10:30:00.000Z | Backtest |
|
|
16026
|
+
* // | LOSS | BTCUSDT | my-strategy | abc123 | LONG | -10% | 49000.00000000 USD | 2024-01-15T11:00:00.000Z | Backtest |
|
|
16027
|
+
* //
|
|
16028
|
+
* // **Total events:** 2
|
|
16029
|
+
* // **Profit events:** 1
|
|
16030
|
+
* // **Loss events:** 1
|
|
16031
|
+
* ```
|
|
16032
|
+
*/
|
|
16033
|
+
getReport: (symbol: string, context: {
|
|
16034
|
+
strategyName: StrategyName;
|
|
16035
|
+
exchangeName: ExchangeName;
|
|
16036
|
+
frameName: FrameName;
|
|
16037
|
+
}, backtest?: boolean, columns?: Columns$5[]) => Promise<string>;
|
|
16038
|
+
/**
|
|
16039
|
+
* Generates and saves markdown report to file.
|
|
16040
|
+
*
|
|
16041
|
+
* Creates directory if it doesn't exist.
|
|
16042
|
+
* Filename format: {symbol}_{strategyName}.md (e.g., "BTCUSDT_my-strategy.md")
|
|
16043
|
+
*
|
|
16044
|
+
* Delegates to PartialMarkdownService.dump() which:
|
|
16045
|
+
* 1. Generates markdown report via getReport()
|
|
16046
|
+
* 2. Creates output directory (recursive mkdir)
|
|
16047
|
+
* 3. Writes file with UTF-8 encoding
|
|
16048
|
+
* 4. Logs success/failure to console
|
|
16049
|
+
*
|
|
16050
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
16051
|
+
* @param strategyName - Strategy name (e.g., "my-strategy")
|
|
16052
|
+
* @param path - Output directory path (default: "./dump/partial")
|
|
16053
|
+
* @param columns - Optional columns configuration for the report
|
|
16054
|
+
* @returns Promise that resolves when file is written
|
|
16055
|
+
*
|
|
16056
|
+
* @example
|
|
16057
|
+
* ```typescript
|
|
16058
|
+
* // Save to default path: ./dump/partial/BTCUSDT_my-strategy.md
|
|
16059
|
+
* await Partial.dump("BTCUSDT", "my-strategy");
|
|
16060
|
+
*
|
|
16061
|
+
* // Save to custom path: ./reports/partial/BTCUSDT_my-strategy.md
|
|
16062
|
+
* await Partial.dump("BTCUSDT", "my-strategy", "./reports/partial");
|
|
16063
|
+
*
|
|
16064
|
+
* // After multiple symbols backtested, export all reports
|
|
16065
|
+
* for (const symbol of ["BTCUSDT", "ETHUSDT", "BNBUSDT"]) {
|
|
16066
|
+
* await Partial.dump(symbol, "my-strategy", "./backtest-results");
|
|
16067
|
+
* }
|
|
16068
|
+
* ```
|
|
16069
|
+
*/
|
|
16070
|
+
dump: (symbol: string, context: {
|
|
16071
|
+
strategyName: StrategyName;
|
|
16072
|
+
exchangeName: ExchangeName;
|
|
16073
|
+
frameName: FrameName;
|
|
16074
|
+
}, backtest?: boolean, path?: string, columns?: Columns$5[]) => Promise<void>;
|
|
16075
|
+
}
|
|
16076
|
+
/**
|
|
16077
|
+
* Global singleton instance of PartialUtils.
|
|
16078
|
+
* Provides static-like access to partial profit/loss reporting methods.
|
|
16079
|
+
*
|
|
16080
|
+
* @example
|
|
16081
|
+
* ```typescript
|
|
16082
|
+
* import { Partial } from "backtest-kit";
|
|
16083
|
+
*
|
|
16084
|
+
* // Usage same as PartialUtils methods
|
|
16085
|
+
* const stats = await Partial.getData("BTCUSDT", "my-strategy");
|
|
16086
|
+
* const report = await Partial.getReport("BTCUSDT", "my-strategy");
|
|
16087
|
+
* await Partial.dump("BTCUSDT", "my-strategy");
|
|
16088
|
+
* ```
|
|
16089
|
+
*/
|
|
16090
|
+
declare const Partial$1: PartialUtils;
|
|
16091
|
+
|
|
16092
|
+
/**
|
|
16093
|
+
* Type alias for column configuration used in highest profit markdown reports.
|
|
16094
|
+
*/
|
|
16095
|
+
type Columns$4 = ColumnModel<HighestProfitEvent>;
|
|
16096
|
+
/**
|
|
16097
|
+
* Service for generating and saving highest profit markdown reports.
|
|
16098
|
+
*
|
|
16099
|
+
* Listens to highestProfitSubject and accumulates events per
|
|
16100
|
+
* symbol-strategy-exchange-frame combination. Provides getData(),
|
|
16101
|
+
* getReport(), and dump() methods matching the Partial pattern.
|
|
16102
|
+
*/
|
|
16103
|
+
declare class HighestProfitMarkdownService {
|
|
16104
|
+
private readonly loggerService;
|
|
16105
|
+
private getStorage;
|
|
16106
|
+
subscribe: (() => () => void) & functools_kit.ISingleshotClearable;
|
|
16107
|
+
unsubscribe: () => Promise<void>;
|
|
16108
|
+
private tick;
|
|
16109
|
+
getData: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean) => Promise<HighestProfitStatisticsModel>;
|
|
16110
|
+
getReport: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, columns?: Columns$4[]) => Promise<string>;
|
|
16111
|
+
dump: (symbol: string, strategyName: StrategyName, exchangeName: ExchangeName, frameName: FrameName, backtest: boolean, path?: string, columns?: Columns$4[]) => Promise<void>;
|
|
16112
|
+
clear: (payload?: {
|
|
16113
|
+
symbol: string;
|
|
16114
|
+
strategyName: StrategyName;
|
|
16115
|
+
exchangeName: ExchangeName;
|
|
16116
|
+
frameName: FrameName;
|
|
16117
|
+
backtest: boolean;
|
|
16118
|
+
}) => Promise<void>;
|
|
16119
|
+
}
|
|
16120
|
+
|
|
16121
|
+
/**
|
|
16122
|
+
* Utility class for accessing highest profit reports and statistics.
|
|
16123
|
+
*
|
|
16124
|
+
* Provides static-like methods (via singleton instance) to retrieve data
|
|
16125
|
+
* accumulated by HighestProfitMarkdownService from highestProfitSubject events.
|
|
16126
|
+
*
|
|
16127
|
+
* @example
|
|
16128
|
+
* ```typescript
|
|
16129
|
+
* import { HighestProfit } from "backtest-kit";
|
|
16130
|
+
*
|
|
16131
|
+
* const stats = await HighestProfit.getData("BTCUSDT", { strategyName, exchangeName, frameName });
|
|
16132
|
+
* const report = await HighestProfit.getReport("BTCUSDT", { strategyName, exchangeName, frameName });
|
|
16133
|
+
* await HighestProfit.dump("BTCUSDT", { strategyName, exchangeName, frameName });
|
|
16134
|
+
* ```
|
|
16135
|
+
*/
|
|
16136
|
+
declare class HighestProfitUtils {
|
|
16137
|
+
/**
|
|
16138
|
+
* Retrieves statistical data from accumulated highest profit events.
|
|
16139
|
+
*
|
|
16140
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
16141
|
+
* @param context - Execution context
|
|
16142
|
+
* @param backtest - Whether to query backtest data
|
|
16143
|
+
* @returns Promise resolving to HighestProfitStatisticsModel
|
|
16144
|
+
*/
|
|
16145
|
+
getData: (symbol: string, context: {
|
|
16146
|
+
strategyName: StrategyName;
|
|
16147
|
+
exchangeName: ExchangeName;
|
|
16148
|
+
frameName: FrameName;
|
|
16149
|
+
}, backtest?: boolean) => Promise<HighestProfitStatisticsModel>;
|
|
16150
|
+
/**
|
|
16151
|
+
* Generates a markdown report with all highest profit events for a symbol-strategy pair.
|
|
16152
|
+
*
|
|
16153
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
16154
|
+
* @param context - Execution context
|
|
16155
|
+
* @param backtest - Whether to query backtest data
|
|
16156
|
+
* @param columns - Optional column configuration
|
|
15408
16157
|
* @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
16158
|
*/
|
|
15428
16159
|
getReport: (symbol: string, context: {
|
|
15429
16160
|
strategyName: StrategyName;
|
|
@@ -15431,36 +16162,13 @@ declare class PartialUtils {
|
|
|
15431
16162
|
frameName: FrameName;
|
|
15432
16163
|
}, backtest?: boolean, columns?: Columns$4[]) => Promise<string>;
|
|
15433
16164
|
/**
|
|
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
|
|
16165
|
+
* Generates and saves a markdown report to file.
|
|
15444
16166
|
*
|
|
15445
16167
|
* @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
|
-
* ```
|
|
16168
|
+
* @param context - Execution context
|
|
16169
|
+
* @param backtest - Whether to query backtest data
|
|
16170
|
+
* @param path - Output directory path (default: "./dump/highest_profit")
|
|
16171
|
+
* @param columns - Optional column configuration
|
|
15464
16172
|
*/
|
|
15465
16173
|
dump: (symbol: string, context: {
|
|
15466
16174
|
strategyName: StrategyName;
|
|
@@ -15469,20 +16177,9 @@ declare class PartialUtils {
|
|
|
15469
16177
|
}, backtest?: boolean, path?: string, columns?: Columns$4[]) => Promise<void>;
|
|
15470
16178
|
}
|
|
15471
16179
|
/**
|
|
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
|
-
* ```
|
|
16180
|
+
* Global singleton instance of HighestProfitUtils.
|
|
15484
16181
|
*/
|
|
15485
|
-
declare const
|
|
16182
|
+
declare const HighestProfit: HighestProfitUtils;
|
|
15486
16183
|
|
|
15487
16184
|
/**
|
|
15488
16185
|
* Utility class containing predefined trading constants for take-profit and stop-loss levels.
|
|
@@ -19778,6 +20475,12 @@ declare const strategyCommitSubject: Subject<StrategyCommitContract>;
|
|
|
19778
20475
|
* BacktestLogicPrivateService::*run
|
|
19779
20476
|
*/
|
|
19780
20477
|
declare const backtestScheduleOpenSubject: Subject<IStrategyTickResultOpened>;
|
|
20478
|
+
/**
|
|
20479
|
+
* Highest profit emitter for real-time profit tracking.
|
|
20480
|
+
* Emits updates on the highest profit achieved for an open position.
|
|
20481
|
+
* Allows users to track profit milestones and implement custom management logic based on profit levels.
|
|
20482
|
+
*/
|
|
20483
|
+
declare const highestProfitSubject: Subject<HighestProfitContract>;
|
|
19781
20484
|
|
|
19782
20485
|
declare const emitters_activePingSubject: typeof activePingSubject;
|
|
19783
20486
|
declare const emitters_backtestScheduleOpenSubject: typeof backtestScheduleOpenSubject;
|
|
@@ -19787,6 +20490,7 @@ declare const emitters_doneLiveSubject: typeof doneLiveSubject;
|
|
|
19787
20490
|
declare const emitters_doneWalkerSubject: typeof doneWalkerSubject;
|
|
19788
20491
|
declare const emitters_errorEmitter: typeof errorEmitter;
|
|
19789
20492
|
declare const emitters_exitEmitter: typeof exitEmitter;
|
|
20493
|
+
declare const emitters_highestProfitSubject: typeof highestProfitSubject;
|
|
19790
20494
|
declare const emitters_partialLossSubject: typeof partialLossSubject;
|
|
19791
20495
|
declare const emitters_partialProfitSubject: typeof partialProfitSubject;
|
|
19792
20496
|
declare const emitters_performanceEmitter: typeof performanceEmitter;
|
|
@@ -19805,7 +20509,7 @@ declare const emitters_walkerCompleteSubject: typeof walkerCompleteSubject;
|
|
|
19805
20509
|
declare const emitters_walkerEmitter: typeof walkerEmitter;
|
|
19806
20510
|
declare const emitters_walkerStopSubject: typeof walkerStopSubject;
|
|
19807
20511
|
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 };
|
|
20512
|
+
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
20513
|
}
|
|
19810
20514
|
|
|
19811
20515
|
/**
|
|
@@ -19970,7 +20674,7 @@ declare const investedCostToPercent: (dollarAmount: number, investedCost: number
|
|
|
19970
20674
|
*
|
|
19971
20675
|
* @param newStopLossPrice - Desired absolute stop-loss price
|
|
19972
20676
|
* @param originalStopLossPrice - Original stop-loss price from the pending signal
|
|
19973
|
-
* @param effectivePriceOpen - Effective entry price (from `
|
|
20677
|
+
* @param effectivePriceOpen - Effective entry price (from `getPositionEffectivePrice`)
|
|
19974
20678
|
* @returns percentShift to pass to `commitTrailingStop`
|
|
19975
20679
|
*
|
|
19976
20680
|
* @example
|
|
@@ -19988,7 +20692,7 @@ declare const slPriceToPercentShift: (newStopLossPrice: number, originalStopLoss
|
|
|
19988
20692
|
*
|
|
19989
20693
|
* @param newTakeProfitPrice - Desired absolute take-profit price
|
|
19990
20694
|
* @param originalTakeProfitPrice - Original take-profit price from the pending signal
|
|
19991
|
-
* @param effectivePriceOpen - Effective entry price (from `
|
|
20695
|
+
* @param effectivePriceOpen - Effective entry price (from `getPositionEffectivePrice`)
|
|
19992
20696
|
* @returns percentShift to pass to `commitTrailingTake`
|
|
19993
20697
|
*
|
|
19994
20698
|
* @example
|
|
@@ -20009,7 +20713,7 @@ declare const tpPriceToPercentShift: (newTakeProfitPrice: number, originalTakePr
|
|
|
20009
20713
|
*
|
|
20010
20714
|
* @param percentShift - Value returned by `slPriceToPercentShift` (or passed to `commitTrailingStop`)
|
|
20011
20715
|
* @param originalStopLossPrice - Original stop-loss price from the pending signal
|
|
20012
|
-
* @param effectivePriceOpen - Effective entry price (from `
|
|
20716
|
+
* @param effectivePriceOpen - Effective entry price (from `getPositionEffectivePrice`)
|
|
20013
20717
|
* @param position - Position direction: "long" or "short"
|
|
20014
20718
|
* @returns Absolute stop-loss price corresponding to the given percentShift
|
|
20015
20719
|
*
|
|
@@ -20030,7 +20734,7 @@ declare const slPercentShiftToPrice: (percentShift: number, originalStopLossPric
|
|
|
20030
20734
|
*
|
|
20031
20735
|
* @param percentShift - Value returned by `tpPriceToPercentShift` (or passed to `commitTrailingTake`)
|
|
20032
20736
|
* @param originalTakeProfitPrice - Original take-profit price from the pending signal
|
|
20033
|
-
* @param effectivePriceOpen - Effective entry price (from `
|
|
20737
|
+
* @param effectivePriceOpen - Effective entry price (from `getPositionEffectivePrice`)
|
|
20034
20738
|
* @param position - Position direction: "long" or "short"
|
|
20035
20739
|
* @returns Absolute take-profit price corresponding to the given percentShift
|
|
20036
20740
|
*
|
|
@@ -21330,7 +22034,7 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
21330
22034
|
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
21331
22035
|
* @returns Promise resolving to effective entry price or null
|
|
21332
22036
|
*/
|
|
21333
|
-
|
|
22037
|
+
getPositionEffectivePrice: (backtest: boolean, symbol: string, context: {
|
|
21334
22038
|
strategyName: StrategyName;
|
|
21335
22039
|
exchangeName: ExchangeName;
|
|
21336
22040
|
frameName: FrameName;
|
|
@@ -21619,6 +22323,136 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
21619
22323
|
exchangeName: ExchangeName;
|
|
21620
22324
|
frameName: FrameName;
|
|
21621
22325
|
}) => Promise<boolean>;
|
|
22326
|
+
/**
|
|
22327
|
+
* Returns the original estimated duration for the current pending signal.
|
|
22328
|
+
*
|
|
22329
|
+
* Delegates to ClientStrategy.getPositionEstimateMinutes().
|
|
22330
|
+
* Returns null if no pending signal exists.
|
|
22331
|
+
*
|
|
22332
|
+
* @param backtest - Whether running in backtest mode
|
|
22333
|
+
* @param symbol - Trading pair symbol
|
|
22334
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22335
|
+
* @returns Promise resolving to estimated duration in minutes or null
|
|
22336
|
+
*/
|
|
22337
|
+
getPositionEstimateMinutes: (backtest: boolean, symbol: string, context: {
|
|
22338
|
+
strategyName: StrategyName;
|
|
22339
|
+
exchangeName: ExchangeName;
|
|
22340
|
+
frameName: FrameName;
|
|
22341
|
+
}) => Promise<number | null>;
|
|
22342
|
+
/**
|
|
22343
|
+
* Returns the remaining time before the position expires, clamped to zero.
|
|
22344
|
+
*
|
|
22345
|
+
* Resolves current timestamp via timeMetaService and delegates to
|
|
22346
|
+
* ClientStrategy.getPositionCountdownMinutes().
|
|
22347
|
+
* Returns null if no pending signal exists.
|
|
22348
|
+
*
|
|
22349
|
+
* @param backtest - Whether running in backtest mode
|
|
22350
|
+
* @param symbol - Trading pair symbol
|
|
22351
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22352
|
+
* @returns Promise resolving to remaining minutes (≥ 0) or null
|
|
22353
|
+
*/
|
|
22354
|
+
getPositionCountdownMinutes: (backtest: boolean, symbol: string, context: {
|
|
22355
|
+
strategyName: StrategyName;
|
|
22356
|
+
exchangeName: ExchangeName;
|
|
22357
|
+
frameName: FrameName;
|
|
22358
|
+
}) => Promise<number | null>;
|
|
22359
|
+
/**
|
|
22360
|
+
* Returns the best price reached in the profit direction during this position's life.
|
|
22361
|
+
*
|
|
22362
|
+
* Delegates to ClientStrategy.getPositionHighestProfitPrice().
|
|
22363
|
+
* Returns null if no pending signal exists.
|
|
22364
|
+
*
|
|
22365
|
+
* @param backtest - Whether running in backtest mode
|
|
22366
|
+
* @param symbol - Trading pair symbol
|
|
22367
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22368
|
+
* @returns Promise resolving to price or null
|
|
22369
|
+
*/
|
|
22370
|
+
getPositionHighestProfitPrice: (backtest: boolean, symbol: string, context: {
|
|
22371
|
+
strategyName: StrategyName;
|
|
22372
|
+
exchangeName: ExchangeName;
|
|
22373
|
+
frameName: FrameName;
|
|
22374
|
+
}) => Promise<number | null>;
|
|
22375
|
+
/**
|
|
22376
|
+
* Returns the timestamp when the best profit price was recorded during this position's life.
|
|
22377
|
+
*
|
|
22378
|
+
* Delegates to ClientStrategy.getPositionHighestProfitTimestamp().
|
|
22379
|
+
* Returns null if no pending signal exists.
|
|
22380
|
+
*
|
|
22381
|
+
* @param backtest - Whether running in backtest mode
|
|
22382
|
+
* @param symbol - Trading pair symbol
|
|
22383
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22384
|
+
* @returns Promise resolving to timestamp in milliseconds or null
|
|
22385
|
+
*/
|
|
22386
|
+
getPositionHighestProfitTimestamp: (backtest: boolean, symbol: string, context: {
|
|
22387
|
+
strategyName: StrategyName;
|
|
22388
|
+
exchangeName: ExchangeName;
|
|
22389
|
+
frameName: FrameName;
|
|
22390
|
+
}) => Promise<number | null>;
|
|
22391
|
+
/**
|
|
22392
|
+
* Returns the PnL percentage at the moment the best profit price was recorded during this position's life.
|
|
22393
|
+
*
|
|
22394
|
+
* Delegates to ClientStrategy.getPositionHighestPnlPercentage().
|
|
22395
|
+
* Returns null if no pending signal exists.
|
|
22396
|
+
*
|
|
22397
|
+
* @param backtest - Whether running in backtest mode
|
|
22398
|
+
* @param symbol - Trading pair symbol
|
|
22399
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22400
|
+
* @returns Promise resolving to PnL percentage or null
|
|
22401
|
+
*/
|
|
22402
|
+
getPositionHighestPnlPercentage: (backtest: boolean, symbol: string, context: {
|
|
22403
|
+
strategyName: StrategyName;
|
|
22404
|
+
exchangeName: ExchangeName;
|
|
22405
|
+
frameName: FrameName;
|
|
22406
|
+
}) => Promise<number | null>;
|
|
22407
|
+
/**
|
|
22408
|
+
* Returns the PnL cost (in quote currency) at the moment the best profit price was recorded during this position's life.
|
|
22409
|
+
*
|
|
22410
|
+
* Delegates to ClientStrategy.getPositionHighestPnlCost().
|
|
22411
|
+
* Returns null if no pending signal exists.
|
|
22412
|
+
*
|
|
22413
|
+
* @param backtest - Whether running in backtest mode
|
|
22414
|
+
* @param symbol - Trading pair symbol
|
|
22415
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22416
|
+
* @returns Promise resolving to PnL cost or null
|
|
22417
|
+
*/
|
|
22418
|
+
getPositionHighestPnlCost: (backtest: boolean, symbol: string, context: {
|
|
22419
|
+
strategyName: StrategyName;
|
|
22420
|
+
exchangeName: ExchangeName;
|
|
22421
|
+
frameName: FrameName;
|
|
22422
|
+
}) => Promise<number | null>;
|
|
22423
|
+
/**
|
|
22424
|
+
* Returns whether breakeven was mathematically reachable at the highest profit price.
|
|
22425
|
+
*
|
|
22426
|
+
* Delegates to ClientStrategy.getPositionHighestProfitBreakeven().
|
|
22427
|
+
* Returns null if no pending signal exists.
|
|
22428
|
+
*
|
|
22429
|
+
* @param backtest - Whether running in backtest mode
|
|
22430
|
+
* @param symbol - Trading pair symbol
|
|
22431
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22432
|
+
* @returns Promise resolving to true if breakeven was reachable at peak, false otherwise, or null
|
|
22433
|
+
*/
|
|
22434
|
+
getPositionHighestProfitBreakeven: (backtest: boolean, symbol: string, context: {
|
|
22435
|
+
strategyName: StrategyName;
|
|
22436
|
+
exchangeName: ExchangeName;
|
|
22437
|
+
frameName: FrameName;
|
|
22438
|
+
}) => Promise<boolean | null>;
|
|
22439
|
+
/**
|
|
22440
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
22441
|
+
*
|
|
22442
|
+
* Resolves current timestamp via timeMetaService and delegates to
|
|
22443
|
+
* ClientStrategy.getPositionDrawdownMinutes().
|
|
22444
|
+
* Returns null if no pending signal exists.
|
|
22445
|
+
*
|
|
22446
|
+
* @param backtest - Whether running in backtest mode
|
|
22447
|
+
* @param symbol - Trading pair symbol
|
|
22448
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22449
|
+
* @returns Promise resolving to drawdown duration in minutes or null
|
|
22450
|
+
*/
|
|
22451
|
+
getPositionDrawdownMinutes: (backtest: boolean, symbol: string, context: {
|
|
22452
|
+
strategyName: StrategyName;
|
|
22453
|
+
exchangeName: ExchangeName;
|
|
22454
|
+
frameName: FrameName;
|
|
22455
|
+
}) => Promise<number | null>;
|
|
21622
22456
|
/**
|
|
21623
22457
|
* Disposes the ClientStrategy instance for the given context.
|
|
21624
22458
|
*
|
|
@@ -22694,7 +23528,7 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
22694
23528
|
exchangeName: ExchangeName;
|
|
22695
23529
|
frameName: FrameName;
|
|
22696
23530
|
}) => Promise<number | null>;
|
|
22697
|
-
|
|
23531
|
+
getPositionEffectivePrice: (backtest: boolean, symbol: string, context: {
|
|
22698
23532
|
strategyName: StrategyName;
|
|
22699
23533
|
exchangeName: ExchangeName;
|
|
22700
23534
|
frameName: FrameName;
|
|
@@ -23243,6 +24077,119 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
23243
24077
|
exchangeName: ExchangeName;
|
|
23244
24078
|
frameName: FrameName;
|
|
23245
24079
|
}) => Promise<boolean>;
|
|
24080
|
+
/**
|
|
24081
|
+
* Returns the original estimated duration for the current pending signal.
|
|
24082
|
+
*
|
|
24083
|
+
* Validates strategy existence and delegates to connection service.
|
|
24084
|
+
* Returns null if no pending signal exists.
|
|
24085
|
+
*
|
|
24086
|
+
* @param backtest - Whether running in backtest mode
|
|
24087
|
+
* @param symbol - Trading pair symbol
|
|
24088
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24089
|
+
* @returns Promise resolving to estimated duration in minutes or null
|
|
24090
|
+
*/
|
|
24091
|
+
getPositionEstimateMinutes: (backtest: boolean, symbol: string, context: {
|
|
24092
|
+
strategyName: StrategyName;
|
|
24093
|
+
exchangeName: ExchangeName;
|
|
24094
|
+
frameName: FrameName;
|
|
24095
|
+
}) => Promise<number | null>;
|
|
24096
|
+
/**
|
|
24097
|
+
* Returns the remaining time before the position expires, clamped to zero.
|
|
24098
|
+
*
|
|
24099
|
+
* Validates strategy existence and delegates to connection service.
|
|
24100
|
+
* Returns null if no pending signal exists.
|
|
24101
|
+
*
|
|
24102
|
+
* @param backtest - Whether running in backtest mode
|
|
24103
|
+
* @param symbol - Trading pair symbol
|
|
24104
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24105
|
+
* @returns Promise resolving to remaining minutes (≥ 0) or null
|
|
24106
|
+
*/
|
|
24107
|
+
getPositionCountdownMinutes: (backtest: boolean, symbol: string, context: {
|
|
24108
|
+
strategyName: StrategyName;
|
|
24109
|
+
exchangeName: ExchangeName;
|
|
24110
|
+
frameName: FrameName;
|
|
24111
|
+
}) => Promise<number | null>;
|
|
24112
|
+
/**
|
|
24113
|
+
* Returns the best price reached in the profit direction during this position's life.
|
|
24114
|
+
*
|
|
24115
|
+
* @param backtest - Whether running in backtest mode
|
|
24116
|
+
* @param symbol - Trading pair symbol
|
|
24117
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24118
|
+
* @returns Promise resolving to price or null
|
|
24119
|
+
*/
|
|
24120
|
+
getPositionHighestProfitPrice: (backtest: boolean, symbol: string, context: {
|
|
24121
|
+
strategyName: StrategyName;
|
|
24122
|
+
exchangeName: ExchangeName;
|
|
24123
|
+
frameName: FrameName;
|
|
24124
|
+
}) => Promise<number | null>;
|
|
24125
|
+
/**
|
|
24126
|
+
* Returns the timestamp when the best profit price was recorded during this position's life.
|
|
24127
|
+
*
|
|
24128
|
+
* @param backtest - Whether running in backtest mode
|
|
24129
|
+
* @param symbol - Trading pair symbol
|
|
24130
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24131
|
+
* @returns Promise resolving to timestamp in milliseconds or null
|
|
24132
|
+
*/
|
|
24133
|
+
getPositionHighestProfitTimestamp: (backtest: boolean, symbol: string, context: {
|
|
24134
|
+
strategyName: StrategyName;
|
|
24135
|
+
exchangeName: ExchangeName;
|
|
24136
|
+
frameName: FrameName;
|
|
24137
|
+
}) => Promise<number | null>;
|
|
24138
|
+
/**
|
|
24139
|
+
* Returns the PnL percentage at the moment the best profit price was recorded during this position's life.
|
|
24140
|
+
*
|
|
24141
|
+
* @param backtest - Whether running in backtest mode
|
|
24142
|
+
* @param symbol - Trading pair symbol
|
|
24143
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24144
|
+
* @returns Promise resolving to PnL percentage or null
|
|
24145
|
+
*/
|
|
24146
|
+
getPositionHighestPnlPercentage: (backtest: boolean, symbol: string, context: {
|
|
24147
|
+
strategyName: StrategyName;
|
|
24148
|
+
exchangeName: ExchangeName;
|
|
24149
|
+
frameName: FrameName;
|
|
24150
|
+
}) => Promise<number | null>;
|
|
24151
|
+
/**
|
|
24152
|
+
* Returns the PnL cost (in quote currency) at the moment the best profit price was recorded during this position's life.
|
|
24153
|
+
*
|
|
24154
|
+
* @param backtest - Whether running in backtest mode
|
|
24155
|
+
* @param symbol - Trading pair symbol
|
|
24156
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24157
|
+
* @returns Promise resolving to PnL cost or null
|
|
24158
|
+
*/
|
|
24159
|
+
getPositionHighestPnlCost: (backtest: boolean, symbol: string, context: {
|
|
24160
|
+
strategyName: StrategyName;
|
|
24161
|
+
exchangeName: ExchangeName;
|
|
24162
|
+
frameName: FrameName;
|
|
24163
|
+
}) => Promise<number | null>;
|
|
24164
|
+
/**
|
|
24165
|
+
* Returns whether breakeven was mathematically reachable at the highest profit price.
|
|
24166
|
+
*
|
|
24167
|
+
* @param backtest - Whether running in backtest mode
|
|
24168
|
+
* @param symbol - Trading pair symbol
|
|
24169
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24170
|
+
* @returns Promise resolving to true if breakeven was reachable at peak, false otherwise, or null
|
|
24171
|
+
*/
|
|
24172
|
+
getPositionHighestProfitBreakeven: (backtest: boolean, symbol: string, context: {
|
|
24173
|
+
strategyName: StrategyName;
|
|
24174
|
+
exchangeName: ExchangeName;
|
|
24175
|
+
frameName: FrameName;
|
|
24176
|
+
}) => Promise<boolean | null>;
|
|
24177
|
+
/**
|
|
24178
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
24179
|
+
*
|
|
24180
|
+
* Validates strategy existence and delegates to connection service.
|
|
24181
|
+
* Returns null if no pending signal exists.
|
|
24182
|
+
*
|
|
24183
|
+
* @param backtest - Whether running in backtest mode
|
|
24184
|
+
* @param symbol - Trading pair symbol
|
|
24185
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24186
|
+
* @returns Promise resolving to drawdown duration in minutes or null
|
|
24187
|
+
*/
|
|
24188
|
+
getPositionDrawdownMinutes: (backtest: boolean, symbol: string, context: {
|
|
24189
|
+
strategyName: StrategyName;
|
|
24190
|
+
exchangeName: ExchangeName;
|
|
24191
|
+
frameName: FrameName;
|
|
24192
|
+
}) => Promise<number | null>;
|
|
23246
24193
|
}
|
|
23247
24194
|
|
|
23248
24195
|
/**
|
|
@@ -25717,6 +26664,19 @@ declare class SyncReportService {
|
|
|
25717
26664
|
unsubscribe: () => Promise<void>;
|
|
25718
26665
|
}
|
|
25719
26666
|
|
|
26667
|
+
/**
|
|
26668
|
+
* Service for logging highest profit events to the JSONL report database.
|
|
26669
|
+
*
|
|
26670
|
+
* Listens to highestProfitSubject and writes each new price record to
|
|
26671
|
+
* Report.writeData() for persistence and analytics.
|
|
26672
|
+
*/
|
|
26673
|
+
declare class HighestProfitReportService {
|
|
26674
|
+
private readonly loggerService;
|
|
26675
|
+
private tick;
|
|
26676
|
+
subscribe: (() => () => void) & functools_kit.ISingleshotClearable;
|
|
26677
|
+
unsubscribe: () => Promise<void>;
|
|
26678
|
+
}
|
|
26679
|
+
|
|
25720
26680
|
declare const backtest: {
|
|
25721
26681
|
exchangeValidationService: ExchangeValidationService;
|
|
25722
26682
|
strategyValidationService: StrategyValidationService;
|
|
@@ -25738,6 +26698,7 @@ declare const backtest: {
|
|
|
25738
26698
|
riskReportService: RiskReportService;
|
|
25739
26699
|
strategyReportService: StrategyReportService;
|
|
25740
26700
|
syncReportService: SyncReportService;
|
|
26701
|
+
highestProfitReportService: HighestProfitReportService;
|
|
25741
26702
|
backtestMarkdownService: BacktestMarkdownService;
|
|
25742
26703
|
liveMarkdownService: LiveMarkdownService;
|
|
25743
26704
|
scheduleMarkdownService: ScheduleMarkdownService;
|
|
@@ -25749,6 +26710,7 @@ declare const backtest: {
|
|
|
25749
26710
|
riskMarkdownService: RiskMarkdownService;
|
|
25750
26711
|
strategyMarkdownService: StrategyMarkdownService;
|
|
25751
26712
|
syncMarkdownService: SyncMarkdownService;
|
|
26713
|
+
highestProfitMarkdownService: HighestProfitMarkdownService;
|
|
25752
26714
|
backtestLogicPublicService: BacktestLogicPublicService;
|
|
25753
26715
|
liveLogicPublicService: LiveLogicPublicService;
|
|
25754
26716
|
walkerLogicPublicService: WalkerLogicPublicService;
|
|
@@ -25868,4 +26830,4 @@ declare const getTotalClosed: (signal: Signal) => {
|
|
|
25868
26830
|
remainingCostBasis: number;
|
|
25869
26831
|
};
|
|
25870
26832
|
|
|
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,
|
|
26833
|
+
export { ActionBase, type ActivateScheduledCommit, type ActivateScheduledCommitNotification, type ActivePingContract, type AverageBuyCommit, type AverageBuyCommitNotification, Backtest, type BacktestStatisticsModel, Breakeven, type BreakevenAvailableNotification, type BreakevenCommit, type BreakevenCommitNotification, type BreakevenContract, type BreakevenData, type BreakevenEvent, type BreakevenStatisticsModel, Broker, type BrokerAverageBuyPayload, BrokerBase, type BrokerBreakevenPayload, type BrokerPartialLossPayload, type BrokerPartialProfitPayload, type BrokerSignalClosePayload, type BrokerSignalOpenPayload, type BrokerTrailingStopPayload, type BrokerTrailingTakePayload, Cache, type CancelScheduledCommit, type CancelScheduledCommitNotification, type CandleData, type CandleInterval, type ClosePendingCommit, type ClosePendingCommitNotification, type ColumnConfig, type ColumnModel, Constant, type CriticalErrorNotification, type DoneContract, 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 };
|