backtest-kit 6.10.0 → 6.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.cjs +1356 -191
- package/build/index.mjs +1354 -192
- package/package.json +2 -2
- package/types.d.ts +953 -118
package/types.d.ts
CHANGED
|
@@ -1900,6 +1900,8 @@ interface SignalCommitBase {
|
|
|
1900
1900
|
totalPartials: number;
|
|
1901
1901
|
/** Original entry price at signal creation (unchanged by DCA averaging). */
|
|
1902
1902
|
originalPriceOpen: number;
|
|
1903
|
+
/** Optional human-readable description of signal reason */
|
|
1904
|
+
note?: string;
|
|
1903
1905
|
}
|
|
1904
1906
|
/**
|
|
1905
1907
|
* Cancel scheduled signal event.
|
|
@@ -2142,6 +2144,16 @@ interface ActivateScheduledCommit extends SignalCommitBase {
|
|
|
2142
2144
|
*/
|
|
2143
2145
|
type StrategyCommitContract = CancelScheduledCommit | ClosePendingCommit | PartialProfitCommit | PartialLossCommit | TrailingStopCommit | TrailingTakeCommit | BreakevenCommit | AverageBuyCommit | ActivateScheduledCommit;
|
|
2144
2146
|
|
|
2147
|
+
/**
|
|
2148
|
+
* Commit payload for strategy commits.
|
|
2149
|
+
* Used in activateScheduled, closePending, cancelScheduled
|
|
2150
|
+
*/
|
|
2151
|
+
type CommitPayload = {
|
|
2152
|
+
/** Commit id */
|
|
2153
|
+
id: string;
|
|
2154
|
+
/** Note describing the commit */
|
|
2155
|
+
note: string;
|
|
2156
|
+
};
|
|
2145
2157
|
/**
|
|
2146
2158
|
* Signal generation interval for throttling.
|
|
2147
2159
|
* Enforces minimum time between getSignal calls.
|
|
@@ -2443,6 +2455,8 @@ interface IRiskSignalRow extends IPublicSignalRow {
|
|
|
2443
2455
|
interface IScheduledSignalCancelRow extends IScheduledSignalRow {
|
|
2444
2456
|
/** Cancellation ID (only for user-initiated cancellations) */
|
|
2445
2457
|
cancelId?: string;
|
|
2458
|
+
/** Note from user payload (only for user-initiated cancellations) */
|
|
2459
|
+
cancelNote?: string;
|
|
2446
2460
|
}
|
|
2447
2461
|
/**
|
|
2448
2462
|
* Base interface for queued commit events.
|
|
@@ -2577,14 +2591,18 @@ interface IStrategySchema {
|
|
|
2577
2591
|
strategyName: StrategyName;
|
|
2578
2592
|
/** Optional developer note for documentation */
|
|
2579
2593
|
note?: string;
|
|
2580
|
-
/**
|
|
2581
|
-
|
|
2594
|
+
/**
|
|
2595
|
+
* Minimum interval between getSignal calls (throttling)
|
|
2596
|
+
*
|
|
2597
|
+
* Default: 1m
|
|
2598
|
+
*/
|
|
2599
|
+
interval?: SignalInterval;
|
|
2582
2600
|
/**
|
|
2583
2601
|
* Signal generation function (returns null if no signal, validated DTO if signal).
|
|
2584
2602
|
* If priceOpen is provided - becomes scheduled signal waiting for price to reach entry point.
|
|
2585
2603
|
* If priceOpen is omitted - opens immediately at current price.
|
|
2586
2604
|
*/
|
|
2587
|
-
getSignal: (symbol: string, when: Date) => Promise<ISignalDto | null>;
|
|
2605
|
+
getSignal: (symbol: string, when: Date, currentPrice: number) => Promise<ISignalDto | null>;
|
|
2588
2606
|
/** Optional lifecycle event callbacks (onOpen, onClose) */
|
|
2589
2607
|
callbacks?: Partial<IStrategyCallbacks>;
|
|
2590
2608
|
/** Optional risk profile identifier for risk management */
|
|
@@ -3046,7 +3064,7 @@ interface IStrategy {
|
|
|
3046
3064
|
* // Strategy continues, can generate new signals
|
|
3047
3065
|
* ```
|
|
3048
3066
|
*/
|
|
3049
|
-
cancelScheduled: (symbol: string, backtest: boolean,
|
|
3067
|
+
cancelScheduled: (symbol: string, backtest: boolean, payload: Partial<CommitPayload>) => Promise<void>;
|
|
3050
3068
|
/**
|
|
3051
3069
|
* Activates the scheduled signal without waiting for price to reach priceOpen.
|
|
3052
3070
|
*
|
|
@@ -3068,7 +3086,7 @@ interface IStrategy {
|
|
|
3068
3086
|
* // Scheduled signal becomes pending signal immediately
|
|
3069
3087
|
* ```
|
|
3070
3088
|
*/
|
|
3071
|
-
activateScheduled: (symbol: string, backtest: boolean,
|
|
3089
|
+
activateScheduled: (symbol: string, backtest: boolean, payload: Partial<CommitPayload>) => Promise<void>;
|
|
3072
3090
|
/**
|
|
3073
3091
|
* Closes the pending signal without stopping the strategy.
|
|
3074
3092
|
*
|
|
@@ -3090,7 +3108,7 @@ interface IStrategy {
|
|
|
3090
3108
|
* // Strategy continues, can generate new signals
|
|
3091
3109
|
* ```
|
|
3092
3110
|
*/
|
|
3093
|
-
closePending: (symbol: string, backtest: boolean,
|
|
3111
|
+
closePending: (symbol: string, backtest: boolean, payload: Partial<CommitPayload>) => Promise<void>;
|
|
3094
3112
|
/**
|
|
3095
3113
|
* Executes partial close at profit level (moving toward TP).
|
|
3096
3114
|
*
|
|
@@ -3670,6 +3688,26 @@ interface IStrategy {
|
|
|
3670
3688
|
* @returns Promise resolving to recovery distance in PnL cost (≥ 0) or null
|
|
3671
3689
|
*/
|
|
3672
3690
|
getPositionHighestMaxDrawdownPnlCost: (symbol: string, currentPrice: number) => Promise<number | null>;
|
|
3691
|
+
/**
|
|
3692
|
+
* Returns the peak-to-trough PnL percentage distance between the position's highest profit and deepest drawdown.
|
|
3693
|
+
*
|
|
3694
|
+
* Computed as: max(0, peakPnlPercentage - fallPnlPercentage).
|
|
3695
|
+
*
|
|
3696
|
+
* @param symbol - Trading pair symbol
|
|
3697
|
+
* @param currentPrice - Current market price
|
|
3698
|
+
* @returns Promise resolving to peak-to-trough PnL percentage distance (≥ 0) or null
|
|
3699
|
+
*/
|
|
3700
|
+
getMaxDrawdownDistancePnlPercentage: (symbol: string, currentPrice: number) => Promise<number | null>;
|
|
3701
|
+
/**
|
|
3702
|
+
* Returns the peak-to-trough PnL cost distance between the position's highest profit and deepest drawdown.
|
|
3703
|
+
*
|
|
3704
|
+
* Computed as: max(0, peakPnlCost - fallPnlCost).
|
|
3705
|
+
*
|
|
3706
|
+
* @param symbol - Trading pair symbol
|
|
3707
|
+
* @param currentPrice - Current market price
|
|
3708
|
+
* @returns Promise resolving to peak-to-trough PnL cost distance (≥ 0) or null
|
|
3709
|
+
*/
|
|
3710
|
+
getMaxDrawdownDistancePnlCost: (symbol: string, currentPrice: number) => Promise<number | null>;
|
|
3673
3711
|
/**
|
|
3674
3712
|
* Disposes the strategy instance and cleans up resources.
|
|
3675
3713
|
*
|
|
@@ -4721,7 +4759,7 @@ interface IPositionOverlapLadder {
|
|
|
4721
4759
|
*
|
|
4722
4760
|
* @param symbol - Trading pair symbol
|
|
4723
4761
|
* @param strategyName - Strategy name
|
|
4724
|
-
* @param
|
|
4762
|
+
* @param payload - Optional commit payload with id and note
|
|
4725
4763
|
* @returns Promise that resolves when scheduled signal is cancelled
|
|
4726
4764
|
*
|
|
4727
4765
|
* @example
|
|
@@ -4729,10 +4767,10 @@ interface IPositionOverlapLadder {
|
|
|
4729
4767
|
* import { commitCancelScheduled } from "backtest-kit";
|
|
4730
4768
|
*
|
|
4731
4769
|
* // Cancel scheduled signal with custom ID
|
|
4732
|
-
* await commitCancelScheduled("BTCUSDT", "manual-cancel-001");
|
|
4770
|
+
* await commitCancelScheduled("BTCUSDT", { id: "manual-cancel-001" });
|
|
4733
4771
|
* ```
|
|
4734
4772
|
*/
|
|
4735
|
-
declare function commitCancelScheduled(symbol: string,
|
|
4773
|
+
declare function commitCancelScheduled(symbol: string, payload?: Partial<CommitPayload>): Promise<void>;
|
|
4736
4774
|
/**
|
|
4737
4775
|
* Closes the pending signal without stopping the strategy.
|
|
4738
4776
|
*
|
|
@@ -4743,7 +4781,7 @@ declare function commitCancelScheduled(symbol: string, cancelId?: string): Promi
|
|
|
4743
4781
|
* Automatically detects backtest/live mode from execution context.
|
|
4744
4782
|
*
|
|
4745
4783
|
* @param symbol - Trading pair symbol
|
|
4746
|
-
* @param
|
|
4784
|
+
* @param payload - Optional commit payload with id and note
|
|
4747
4785
|
* @returns Promise that resolves when pending signal is closed
|
|
4748
4786
|
*
|
|
4749
4787
|
* @example
|
|
@@ -4751,10 +4789,10 @@ declare function commitCancelScheduled(symbol: string, cancelId?: string): Promi
|
|
|
4751
4789
|
* import { commitClosePending } from "backtest-kit";
|
|
4752
4790
|
*
|
|
4753
4791
|
* // Close pending signal with custom ID
|
|
4754
|
-
* await commitClosePending("BTCUSDT", "manual-close-001");
|
|
4792
|
+
* await commitClosePending("BTCUSDT", { id: "manual-close-001" });
|
|
4755
4793
|
* ```
|
|
4756
4794
|
*/
|
|
4757
|
-
declare function commitClosePending(symbol: string,
|
|
4795
|
+
declare function commitClosePending(symbol: string, payload?: Partial<CommitPayload>): Promise<void>;
|
|
4758
4796
|
/**
|
|
4759
4797
|
* Executes partial close at profit level (moving toward TP).
|
|
4760
4798
|
*
|
|
@@ -4962,7 +5000,7 @@ declare function commitBreakeven(symbol: string): Promise<boolean>;
|
|
|
4962
5000
|
* Automatically detects backtest/live mode from execution context.
|
|
4963
5001
|
*
|
|
4964
5002
|
* @param symbol - Trading pair symbol
|
|
4965
|
-
* @param
|
|
5003
|
+
* @param payload - Optional commit payload with id and note
|
|
4966
5004
|
* @returns Promise that resolves when activation flag is set
|
|
4967
5005
|
*
|
|
4968
5006
|
* @example
|
|
@@ -4970,10 +5008,10 @@ declare function commitBreakeven(symbol: string): Promise<boolean>;
|
|
|
4970
5008
|
* import { commitActivateScheduled } from "backtest-kit";
|
|
4971
5009
|
*
|
|
4972
5010
|
* // Activate scheduled signal early with custom ID
|
|
4973
|
-
* await commitActivateScheduled("BTCUSDT", "manual-activate-001");
|
|
5011
|
+
* await commitActivateScheduled("BTCUSDT", { id: "manual-activate-001" });
|
|
4974
5012
|
* ```
|
|
4975
5013
|
*/
|
|
4976
|
-
declare function commitActivateScheduled(symbol: string,
|
|
5014
|
+
declare function commitActivateScheduled(symbol: string, payload?: Partial<CommitPayload>): Promise<void>;
|
|
4977
5015
|
/**
|
|
4978
5016
|
* Adds a new DCA entry to the active pending signal.
|
|
4979
5017
|
*
|
|
@@ -5702,6 +5740,42 @@ declare function getPositionHighestMaxDrawdownPnlPercentage(symbol: string): Pro
|
|
|
5702
5740
|
* ```
|
|
5703
5741
|
*/
|
|
5704
5742
|
declare function getPositionHighestMaxDrawdownPnlCost(symbol: string): Promise<number>;
|
|
5743
|
+
/**
|
|
5744
|
+
* Returns the peak-to-trough PnL percentage distance between the position's highest profit and deepest drawdown.
|
|
5745
|
+
*
|
|
5746
|
+
* Computed as: max(0, peakPnlPercentage - fallPnlPercentage).
|
|
5747
|
+
* Returns null if no pending signal exists.
|
|
5748
|
+
*
|
|
5749
|
+
* @param symbol - Trading pair symbol
|
|
5750
|
+
* @returns Promise resolving to peak-to-trough PnL percentage distance (≥ 0) or null
|
|
5751
|
+
*
|
|
5752
|
+
* @example
|
|
5753
|
+
* ```typescript
|
|
5754
|
+
* import { getMaxDrawdownDistancePnlPercentage } from "backtest-kit";
|
|
5755
|
+
*
|
|
5756
|
+
* const dist = await getMaxDrawdownDistancePnlPercentage("BTCUSDT");
|
|
5757
|
+
* // e.g. 3.5 (peak was +3.5% above trough)
|
|
5758
|
+
* ```
|
|
5759
|
+
*/
|
|
5760
|
+
declare function getMaxDrawdownDistancePnlPercentage(symbol: string): Promise<number>;
|
|
5761
|
+
/**
|
|
5762
|
+
* Returns the peak-to-trough PnL cost distance between the position's highest profit and deepest drawdown.
|
|
5763
|
+
*
|
|
5764
|
+
* Computed as: max(0, peakPnlCost - fallPnlCost).
|
|
5765
|
+
* Returns null if no pending signal exists.
|
|
5766
|
+
*
|
|
5767
|
+
* @param symbol - Trading pair symbol
|
|
5768
|
+
* @returns Promise resolving to peak-to-trough PnL cost distance (≥ 0) or null
|
|
5769
|
+
*
|
|
5770
|
+
* @example
|
|
5771
|
+
* ```typescript
|
|
5772
|
+
* import { getMaxDrawdownDistancePnlCost } from "backtest-kit";
|
|
5773
|
+
*
|
|
5774
|
+
* const dist = await getMaxDrawdownDistancePnlCost("BTCUSDT");
|
|
5775
|
+
* // e.g. 7.2 (peak was $7.2 above trough)
|
|
5776
|
+
* ```
|
|
5777
|
+
*/
|
|
5778
|
+
declare function getMaxDrawdownDistancePnlCost(symbol: string): Promise<number>;
|
|
5705
5779
|
/**
|
|
5706
5780
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
5707
5781
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -9173,7 +9247,7 @@ interface IRunContext extends IMethodContext, IExecutionContext {
|
|
|
9173
9247
|
*
|
|
9174
9248
|
* @template T - Return type of the function.
|
|
9175
9249
|
*/
|
|
9176
|
-
type Function$
|
|
9250
|
+
type Function$2<T extends unknown = any> = () => T | Promise<T>;
|
|
9177
9251
|
/**
|
|
9178
9252
|
* Runs a function inside a mock method and execution context.
|
|
9179
9253
|
*
|
|
@@ -9201,7 +9275,7 @@ type Function$1<T extends unknown = any> = () => T | Promise<T>;
|
|
|
9201
9275
|
* );
|
|
9202
9276
|
* ```
|
|
9203
9277
|
*/
|
|
9204
|
-
declare function runInMockContext<T extends unknown = any>(run: Function$
|
|
9278
|
+
declare function runInMockContext<T extends unknown = any>(run: Function$2<T>, { exchangeName, frameName, strategyName, symbol, backtest: isBacktest, when, }: Partial<IRunContext>): Promise<T>;
|
|
9205
9279
|
|
|
9206
9280
|
/**
|
|
9207
9281
|
* Portfolio heatmap statistics for a single symbol.
|
|
@@ -9465,6 +9539,8 @@ interface PartialProfitAvailableNotification {
|
|
|
9465
9539
|
pnlCost: number;
|
|
9466
9540
|
/** Total invested capital in USD */
|
|
9467
9541
|
pnlEntries: number;
|
|
9542
|
+
/** Optional human-readable description of signal reason */
|
|
9543
|
+
note?: string;
|
|
9468
9544
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9469
9545
|
scheduledAt: number;
|
|
9470
9546
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9527,6 +9603,8 @@ interface PartialLossAvailableNotification {
|
|
|
9527
9603
|
pnlCost: number;
|
|
9528
9604
|
/** Total invested capital in USD */
|
|
9529
9605
|
pnlEntries: number;
|
|
9606
|
+
/** Optional human-readable description of signal reason */
|
|
9607
|
+
note?: string;
|
|
9530
9608
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9531
9609
|
scheduledAt: number;
|
|
9532
9610
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9587,6 +9665,8 @@ interface BreakevenAvailableNotification {
|
|
|
9587
9665
|
pnlCost: number;
|
|
9588
9666
|
/** Total invested capital in USD */
|
|
9589
9667
|
pnlEntries: number;
|
|
9668
|
+
/** Optional human-readable description of signal reason */
|
|
9669
|
+
note?: string;
|
|
9590
9670
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9591
9671
|
scheduledAt: number;
|
|
9592
9672
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9649,6 +9729,8 @@ interface PartialProfitCommitNotification {
|
|
|
9649
9729
|
pnlCost: number;
|
|
9650
9730
|
/** Total invested capital in USD */
|
|
9651
9731
|
pnlEntries: number;
|
|
9732
|
+
/** Optional human-readable description of signal reason */
|
|
9733
|
+
note?: string;
|
|
9652
9734
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9653
9735
|
scheduledAt: number;
|
|
9654
9736
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9711,6 +9793,8 @@ interface PartialLossCommitNotification {
|
|
|
9711
9793
|
pnlCost: number;
|
|
9712
9794
|
/** Total invested capital in USD */
|
|
9713
9795
|
pnlEntries: number;
|
|
9796
|
+
/** Optional human-readable description of signal reason */
|
|
9797
|
+
note?: string;
|
|
9714
9798
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9715
9799
|
scheduledAt: number;
|
|
9716
9800
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9771,6 +9855,8 @@ interface BreakevenCommitNotification {
|
|
|
9771
9855
|
pnlCost: number;
|
|
9772
9856
|
/** Total invested capital in USD */
|
|
9773
9857
|
pnlEntries: number;
|
|
9858
|
+
/** Optional human-readable description of signal reason */
|
|
9859
|
+
note?: string;
|
|
9774
9860
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9775
9861
|
scheduledAt: number;
|
|
9776
9862
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9835,6 +9921,8 @@ interface AverageBuyCommitNotification {
|
|
|
9835
9921
|
pnlCost: number;
|
|
9836
9922
|
/** Total invested capital in USD */
|
|
9837
9923
|
pnlEntries: number;
|
|
9924
|
+
/** Optional human-readable description of signal reason */
|
|
9925
|
+
note?: string;
|
|
9838
9926
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9839
9927
|
scheduledAt: number;
|
|
9840
9928
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -9901,6 +9989,8 @@ interface ActivateScheduledCommitNotification {
|
|
|
9901
9989
|
pendingAt: number;
|
|
9902
9990
|
/** Current market price when activation was executed */
|
|
9903
9991
|
currentPrice: number;
|
|
9992
|
+
/** Optional human-readable description of signal reason */
|
|
9993
|
+
note?: string;
|
|
9904
9994
|
/** Unix timestamp in milliseconds when the notification was created */
|
|
9905
9995
|
createdAt: number;
|
|
9906
9996
|
}
|
|
@@ -9959,6 +10049,8 @@ interface TrailingStopCommitNotification {
|
|
|
9959
10049
|
pnlCost: number;
|
|
9960
10050
|
/** Total invested capital in USD */
|
|
9961
10051
|
pnlEntries: number;
|
|
10052
|
+
/** Optional human-readable description of signal reason */
|
|
10053
|
+
note?: string;
|
|
9962
10054
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
9963
10055
|
scheduledAt: number;
|
|
9964
10056
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -10021,6 +10113,8 @@ interface TrailingTakeCommitNotification {
|
|
|
10021
10113
|
pnlCost: number;
|
|
10022
10114
|
/** Total invested capital in USD */
|
|
10023
10115
|
pnlEntries: number;
|
|
10116
|
+
/** Optional human-readable description of signal reason */
|
|
10117
|
+
note?: string;
|
|
10024
10118
|
/** Signal creation timestamp in milliseconds (when signal was first created/scheduled) */
|
|
10025
10119
|
scheduledAt: number;
|
|
10026
10120
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
@@ -10087,6 +10181,8 @@ interface SignalSyncOpenNotification {
|
|
|
10087
10181
|
scheduledAt: number;
|
|
10088
10182
|
/** Position activation timestamp in milliseconds */
|
|
10089
10183
|
pendingAt: number;
|
|
10184
|
+
/** Optional human-readable description of signal reason */
|
|
10185
|
+
note?: string;
|
|
10090
10186
|
/** Unix timestamp in milliseconds when the notification was created */
|
|
10091
10187
|
createdAt: number;
|
|
10092
10188
|
}
|
|
@@ -10149,6 +10245,8 @@ interface SignalSyncCloseNotification {
|
|
|
10149
10245
|
pendingAt: number;
|
|
10150
10246
|
/** Why the signal was closed (take_profit | stop_loss | time_expired | closed) */
|
|
10151
10247
|
closeReason: string;
|
|
10248
|
+
/** Optional human-readable description of signal reason */
|
|
10249
|
+
note?: string;
|
|
10152
10250
|
/** Unix timestamp in milliseconds when the notification was created */
|
|
10153
10251
|
createdAt: number;
|
|
10154
10252
|
}
|
|
@@ -10253,6 +10351,8 @@ interface SignalScheduledNotification {
|
|
|
10253
10351
|
scheduledAt: number;
|
|
10254
10352
|
/** Current market price when signal was scheduled */
|
|
10255
10353
|
currentPrice: number;
|
|
10354
|
+
/** Optional human-readable description of signal reason */
|
|
10355
|
+
note?: string;
|
|
10256
10356
|
/** Unix timestamp in milliseconds when the tick result was created (from candle timestamp in backtest or execution context when in live) */
|
|
10257
10357
|
createdAt: number;
|
|
10258
10358
|
}
|
|
@@ -10305,6 +10405,8 @@ interface SignalCancelledNotification {
|
|
|
10305
10405
|
scheduledAt: number;
|
|
10306
10406
|
/** Pending timestamp in milliseconds (when position became pending/active at priceOpen) */
|
|
10307
10407
|
pendingAt: number;
|
|
10408
|
+
/** Optional human-readable description of signal reason */
|
|
10409
|
+
note?: string;
|
|
10308
10410
|
/** Unix timestamp in milliseconds when the tick result was created (from candle timestamp in backtest or execution context when in live) */
|
|
10309
10411
|
createdAt: number;
|
|
10310
10412
|
}
|
|
@@ -10397,6 +10499,8 @@ interface CancelScheduledCommitNotification {
|
|
|
10397
10499
|
pnlCost: number;
|
|
10398
10500
|
/** Total invested capital in USD */
|
|
10399
10501
|
pnlEntries: number;
|
|
10502
|
+
/** Optional human-readable description of signal reason */
|
|
10503
|
+
note?: string;
|
|
10400
10504
|
/** Unix timestamp in milliseconds when the notification was created */
|
|
10401
10505
|
createdAt: number;
|
|
10402
10506
|
}
|
|
@@ -10441,6 +10545,8 @@ interface ClosePendingCommitNotification {
|
|
|
10441
10545
|
pnlCost: number;
|
|
10442
10546
|
/** Total invested capital in USD */
|
|
10443
10547
|
pnlEntries: number;
|
|
10548
|
+
/** Optional human-readable description of signal reason */
|
|
10549
|
+
note?: string;
|
|
10444
10550
|
/** Unix timestamp in milliseconds when the notification was created */
|
|
10445
10551
|
createdAt: number;
|
|
10446
10552
|
}
|
|
@@ -11138,6 +11244,8 @@ interface StrategyEvent {
|
|
|
11138
11244
|
pnl?: IStrategyPnL;
|
|
11139
11245
|
/** Cost of this entry in USD (average-buy action only) */
|
|
11140
11246
|
cost?: number;
|
|
11247
|
+
/** Optional note from commit payload */
|
|
11248
|
+
note?: string;
|
|
11141
11249
|
}
|
|
11142
11250
|
/**
|
|
11143
11251
|
* Statistical data calculated from strategy events.
|
|
@@ -14071,6 +14179,36 @@ declare class BacktestUtils {
|
|
|
14071
14179
|
exchangeName: ExchangeName;
|
|
14072
14180
|
frameName: FrameName;
|
|
14073
14181
|
}) => Promise<number>;
|
|
14182
|
+
/**
|
|
14183
|
+
* Returns the peak-to-trough PnL percentage distance between the position's highest profit and deepest drawdown.
|
|
14184
|
+
*
|
|
14185
|
+
* Computed as: max(0, peakPnlPercentage - fallPnlPercentage).
|
|
14186
|
+
* Returns null if no pending signal exists.
|
|
14187
|
+
*
|
|
14188
|
+
* @param symbol - Trading pair symbol
|
|
14189
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
14190
|
+
* @returns peak-to-trough PnL percentage distance (≥ 0) or null if no active position
|
|
14191
|
+
*/
|
|
14192
|
+
getMaxDrawdownDistancePnlPercentage: (symbol: string, context: {
|
|
14193
|
+
strategyName: StrategyName;
|
|
14194
|
+
exchangeName: ExchangeName;
|
|
14195
|
+
frameName: FrameName;
|
|
14196
|
+
}) => Promise<number>;
|
|
14197
|
+
/**
|
|
14198
|
+
* Returns the peak-to-trough PnL cost distance between the position's highest profit and deepest drawdown.
|
|
14199
|
+
*
|
|
14200
|
+
* Computed as: max(0, peakPnlCost - fallPnlCost).
|
|
14201
|
+
* Returns null if no pending signal exists.
|
|
14202
|
+
*
|
|
14203
|
+
* @param symbol - Trading pair symbol
|
|
14204
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
14205
|
+
* @returns peak-to-trough PnL cost distance (≥ 0) or null if no active position
|
|
14206
|
+
*/
|
|
14207
|
+
getMaxDrawdownDistancePnlCost: (symbol: string, context: {
|
|
14208
|
+
strategyName: StrategyName;
|
|
14209
|
+
exchangeName: ExchangeName;
|
|
14210
|
+
frameName: FrameName;
|
|
14211
|
+
}) => Promise<number>;
|
|
14074
14212
|
/**
|
|
14075
14213
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
14076
14214
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -14146,7 +14284,7 @@ declare class BacktestUtils {
|
|
|
14146
14284
|
* @param symbol - Trading pair symbol
|
|
14147
14285
|
* @param strategyName - Strategy name
|
|
14148
14286
|
* @param context - Execution context with exchangeName and frameName
|
|
14149
|
-
* @param
|
|
14287
|
+
* @param payload - Optional commit payload with id and note
|
|
14150
14288
|
* @returns Promise that resolves when scheduled signal is cancelled
|
|
14151
14289
|
*
|
|
14152
14290
|
* @example
|
|
@@ -14156,14 +14294,14 @@ declare class BacktestUtils {
|
|
|
14156
14294
|
* exchangeName: "binance",
|
|
14157
14295
|
* frameName: "frame1",
|
|
14158
14296
|
* strategyName: "my-strategy"
|
|
14159
|
-
* }, "manual-cancel-001");
|
|
14297
|
+
* }, { id: "manual-cancel-001" });
|
|
14160
14298
|
* ```
|
|
14161
14299
|
*/
|
|
14162
14300
|
commitCancelScheduled: (symbol: string, context: {
|
|
14163
14301
|
strategyName: StrategyName;
|
|
14164
14302
|
exchangeName: ExchangeName;
|
|
14165
14303
|
frameName: FrameName;
|
|
14166
|
-
},
|
|
14304
|
+
}, payload?: Partial<CommitPayload>) => Promise<void>;
|
|
14167
14305
|
/**
|
|
14168
14306
|
* Closes the pending signal without stopping the strategy.
|
|
14169
14307
|
*
|
|
@@ -14173,7 +14311,7 @@ declare class BacktestUtils {
|
|
|
14173
14311
|
*
|
|
14174
14312
|
* @param symbol - Trading pair symbol
|
|
14175
14313
|
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
14176
|
-
* @param
|
|
14314
|
+
* @param payload - Optional commit payload with id and note
|
|
14177
14315
|
* @returns Promise that resolves when pending signal is closed
|
|
14178
14316
|
*
|
|
14179
14317
|
* @example
|
|
@@ -14183,14 +14321,14 @@ declare class BacktestUtils {
|
|
|
14183
14321
|
* exchangeName: "binance",
|
|
14184
14322
|
* strategyName: "my-strategy",
|
|
14185
14323
|
* frameName: "1m"
|
|
14186
|
-
* }, "manual-close-001");
|
|
14324
|
+
* }, { id: "manual-close-001" });
|
|
14187
14325
|
* ```
|
|
14188
14326
|
*/
|
|
14189
14327
|
commitClosePending: (symbol: string, context: {
|
|
14190
14328
|
strategyName: StrategyName;
|
|
14191
14329
|
exchangeName: ExchangeName;
|
|
14192
14330
|
frameName: FrameName;
|
|
14193
|
-
},
|
|
14331
|
+
}, payload?: Partial<CommitPayload>) => Promise<void>;
|
|
14194
14332
|
/**
|
|
14195
14333
|
* Executes partial close at profit level (moving toward TP).
|
|
14196
14334
|
*
|
|
@@ -14495,7 +14633,7 @@ declare class BacktestUtils {
|
|
|
14495
14633
|
*
|
|
14496
14634
|
* @param symbol - Trading pair symbol
|
|
14497
14635
|
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
14498
|
-
* @param
|
|
14636
|
+
* @param payload - Optional commit payload with id and note
|
|
14499
14637
|
* @returns Promise that resolves when activation flag is set
|
|
14500
14638
|
*
|
|
14501
14639
|
* @example
|
|
@@ -14505,14 +14643,14 @@ declare class BacktestUtils {
|
|
|
14505
14643
|
* strategyName: "my-strategy",
|
|
14506
14644
|
* exchangeName: "binance",
|
|
14507
14645
|
* frameName: "1h"
|
|
14508
|
-
* }, "manual-activate-001");
|
|
14646
|
+
* }, { id: "manual-activate-001" });
|
|
14509
14647
|
* ```
|
|
14510
14648
|
*/
|
|
14511
14649
|
commitActivateScheduled: (symbol: string, context: {
|
|
14512
14650
|
strategyName: StrategyName;
|
|
14513
14651
|
exchangeName: ExchangeName;
|
|
14514
14652
|
frameName: FrameName;
|
|
14515
|
-
},
|
|
14653
|
+
}, payload?: Partial<CommitPayload>) => Promise<void>;
|
|
14516
14654
|
/**
|
|
14517
14655
|
* Adds a new DCA entry to the active pending signal.
|
|
14518
14656
|
*
|
|
@@ -15485,6 +15623,34 @@ declare class LiveUtils {
|
|
|
15485
15623
|
strategyName: StrategyName;
|
|
15486
15624
|
exchangeName: ExchangeName;
|
|
15487
15625
|
}) => Promise<number>;
|
|
15626
|
+
/**
|
|
15627
|
+
* Returns the peak-to-trough PnL percentage distance between the position's highest profit and deepest drawdown.
|
|
15628
|
+
*
|
|
15629
|
+
* Computed as: max(0, peakPnlPercentage - fallPnlPercentage).
|
|
15630
|
+
* Returns null if no pending signal exists.
|
|
15631
|
+
*
|
|
15632
|
+
* @param symbol - Trading pair symbol
|
|
15633
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
15634
|
+
* @returns peak-to-trough PnL percentage distance (≥ 0) or null if no active position
|
|
15635
|
+
*/
|
|
15636
|
+
getMaxDrawdownDistancePnlPercentage: (symbol: string, context: {
|
|
15637
|
+
strategyName: StrategyName;
|
|
15638
|
+
exchangeName: ExchangeName;
|
|
15639
|
+
}) => Promise<number>;
|
|
15640
|
+
/**
|
|
15641
|
+
* Returns the peak-to-trough PnL cost distance between the position's highest profit and deepest drawdown.
|
|
15642
|
+
*
|
|
15643
|
+
* Computed as: max(0, peakPnlCost - fallPnlCost).
|
|
15644
|
+
* Returns null if no pending signal exists.
|
|
15645
|
+
*
|
|
15646
|
+
* @param symbol - Trading pair symbol
|
|
15647
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
15648
|
+
* @returns peak-to-trough PnL cost distance (≥ 0) or null if no active position
|
|
15649
|
+
*/
|
|
15650
|
+
getMaxDrawdownDistancePnlCost: (symbol: string, context: {
|
|
15651
|
+
strategyName: StrategyName;
|
|
15652
|
+
exchangeName: ExchangeName;
|
|
15653
|
+
}) => Promise<number>;
|
|
15488
15654
|
/**
|
|
15489
15655
|
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
15490
15656
|
* Use this to prevent duplicate DCA entries at the same price area.
|
|
@@ -15552,7 +15718,7 @@ declare class LiveUtils {
|
|
|
15552
15718
|
* @param symbol - Trading pair symbol
|
|
15553
15719
|
* @param strategyName - Strategy name
|
|
15554
15720
|
* @param context - Execution context with exchangeName and frameName
|
|
15555
|
-
* @param
|
|
15721
|
+
* @param payload - Optional commit payload with id and note
|
|
15556
15722
|
* @returns Promise that resolves when scheduled signal is cancelled
|
|
15557
15723
|
*
|
|
15558
15724
|
* @example
|
|
@@ -15562,13 +15728,13 @@ declare class LiveUtils {
|
|
|
15562
15728
|
* exchangeName: "binance",
|
|
15563
15729
|
* frameName: "",
|
|
15564
15730
|
* strategyName: "my-strategy"
|
|
15565
|
-
* }, "manual-cancel-001");
|
|
15731
|
+
* }, { id: "manual-cancel-001" });
|
|
15566
15732
|
* ```
|
|
15567
15733
|
*/
|
|
15568
15734
|
commitCancelScheduled: (symbol: string, context: {
|
|
15569
15735
|
strategyName: StrategyName;
|
|
15570
15736
|
exchangeName: ExchangeName;
|
|
15571
|
-
},
|
|
15737
|
+
}, payload?: Partial<CommitPayload>) => Promise<void>;
|
|
15572
15738
|
/**
|
|
15573
15739
|
* Closes the pending signal without stopping the strategy.
|
|
15574
15740
|
*
|
|
@@ -15578,7 +15744,7 @@ declare class LiveUtils {
|
|
|
15578
15744
|
*
|
|
15579
15745
|
* @param symbol - Trading pair symbol
|
|
15580
15746
|
* @param context - Execution context with strategyName and exchangeName
|
|
15581
|
-
* @param
|
|
15747
|
+
* @param payload - Optional commit payload with id and note
|
|
15582
15748
|
* @returns Promise that resolves when pending signal is closed
|
|
15583
15749
|
*
|
|
15584
15750
|
* @example
|
|
@@ -15587,13 +15753,13 @@ declare class LiveUtils {
|
|
|
15587
15753
|
* await Live.commitClose("BTCUSDT", {
|
|
15588
15754
|
* exchangeName: "binance",
|
|
15589
15755
|
* strategyName: "my-strategy"
|
|
15590
|
-
* }, "manual-close-001");
|
|
15756
|
+
* }, { id: "manual-close-001" });
|
|
15591
15757
|
* ```
|
|
15592
15758
|
*/
|
|
15593
15759
|
commitClosePending: (symbol: string, context: {
|
|
15594
15760
|
strategyName: StrategyName;
|
|
15595
15761
|
exchangeName: ExchangeName;
|
|
15596
|
-
},
|
|
15762
|
+
}, payload?: Partial<CommitPayload>) => Promise<void>;
|
|
15597
15763
|
/**
|
|
15598
15764
|
* Executes partial close at profit level (moving toward TP).
|
|
15599
15765
|
*
|
|
@@ -15883,7 +16049,7 @@ declare class LiveUtils {
|
|
|
15883
16049
|
*
|
|
15884
16050
|
* @param symbol - Trading pair symbol
|
|
15885
16051
|
* @param context - Execution context with strategyName and exchangeName
|
|
15886
|
-
* @param
|
|
16052
|
+
* @param payload - Optional commit payload with id and note
|
|
15887
16053
|
* @returns Promise that resolves when activation flag is set
|
|
15888
16054
|
*
|
|
15889
16055
|
* @example
|
|
@@ -15892,13 +16058,13 @@ declare class LiveUtils {
|
|
|
15892
16058
|
* await Live.commitActivateScheduled("BTCUSDT", {
|
|
15893
16059
|
* strategyName: "my-strategy",
|
|
15894
16060
|
* exchangeName: "binance"
|
|
15895
|
-
* }, "manual-activate-001");
|
|
16061
|
+
* }, { id: "manual-activate-001" });
|
|
15896
16062
|
* ```
|
|
15897
16063
|
*/
|
|
15898
16064
|
commitActivateScheduled: (symbol: string, context: {
|
|
15899
16065
|
strategyName: StrategyName;
|
|
15900
16066
|
exchangeName: ExchangeName;
|
|
15901
|
-
},
|
|
16067
|
+
}, payload?: Partial<CommitPayload>) => Promise<void>;
|
|
15902
16068
|
/**
|
|
15903
16069
|
* Adds a new DCA entry to the active pending signal.
|
|
15904
16070
|
*
|
|
@@ -18253,55 +18419,608 @@ declare class MaxDrawdownUtils {
|
|
|
18253
18419
|
declare const MaxDrawdown: MaxDrawdownUtils;
|
|
18254
18420
|
|
|
18255
18421
|
/**
|
|
18256
|
-
* Utility class
|
|
18422
|
+
* Utility class for real-time position reflection: PNL, peak profit, and drawdown queries.
|
|
18257
18423
|
*
|
|
18258
|
-
*
|
|
18259
|
-
*
|
|
18424
|
+
* Provides unified access to strategyCoreService position state methods with logging
|
|
18425
|
+
* and full validation (strategy, exchange, frame, risk, actions).
|
|
18426
|
+
* Works for both live and backtest modes via the `backtest` parameter.
|
|
18427
|
+
* Exported as singleton instance for convenient usage.
|
|
18260
18428
|
*
|
|
18261
|
-
*
|
|
18262
|
-
*
|
|
18263
|
-
*
|
|
18264
|
-
*
|
|
18429
|
+
* @example
|
|
18430
|
+
* ```typescript
|
|
18431
|
+
* import { Reflect } from "backtest-kit";
|
|
18432
|
+
*
|
|
18433
|
+
* // Get current unrealized PNL percentage
|
|
18434
|
+
* const pnl = await Reflect.getPositionPnlPercent(
|
|
18435
|
+
* "BTCUSDT",
|
|
18436
|
+
* 45000,
|
|
18437
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18438
|
+
* );
|
|
18439
|
+
* console.log(`PNL: ${pnl}%`);
|
|
18440
|
+
*
|
|
18441
|
+
* // Get peak profit reached
|
|
18442
|
+
* const peakPnl = await Reflect.getPositionHighestPnlPercentage(
|
|
18443
|
+
* "BTCUSDT",
|
|
18444
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18445
|
+
* );
|
|
18446
|
+
* console.log(`Peak PNL: ${peakPnl}%`);
|
|
18447
|
+
* ```
|
|
18265
18448
|
*/
|
|
18266
|
-
declare class
|
|
18449
|
+
declare class ReflectUtils {
|
|
18267
18450
|
/**
|
|
18268
|
-
*
|
|
18269
|
-
*
|
|
18270
|
-
*
|
|
18451
|
+
* Returns the unrealized PNL percentage for the current pending signal at currentPrice.
|
|
18452
|
+
*
|
|
18453
|
+
* Accounts for partial closes, DCA entries, slippage and fees.
|
|
18454
|
+
* Returns null if no pending signal exists.
|
|
18455
|
+
*
|
|
18456
|
+
* @param symbol - Trading pair symbol
|
|
18457
|
+
* @param currentPrice - Current market price
|
|
18458
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18459
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18460
|
+
* @returns Promise resolving to PNL percentage or null
|
|
18461
|
+
*
|
|
18462
|
+
* @example
|
|
18463
|
+
* ```typescript
|
|
18464
|
+
* const pnl = await Reflect.getPositionPnlPercent(
|
|
18465
|
+
* "BTCUSDT",
|
|
18466
|
+
* 45000,
|
|
18467
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18468
|
+
* );
|
|
18469
|
+
* console.log(`PNL: ${pnl}%`);
|
|
18470
|
+
* ```
|
|
18271
18471
|
*/
|
|
18272
|
-
|
|
18472
|
+
getPositionPnlPercent: (symbol: string, currentPrice: number, context: {
|
|
18473
|
+
strategyName: StrategyName;
|
|
18474
|
+
exchangeName: ExchangeName;
|
|
18475
|
+
frameName: FrameName;
|
|
18476
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18273
18477
|
/**
|
|
18274
|
-
*
|
|
18275
|
-
*
|
|
18276
|
-
*
|
|
18478
|
+
* Returns the unrealized PNL in dollars for the current pending signal at currentPrice.
|
|
18479
|
+
*
|
|
18480
|
+
* Calculated as: pnlPercentage / 100 × totalInvestedCost.
|
|
18481
|
+
* Accounts for partial closes, DCA entries, slippage and fees.
|
|
18482
|
+
* Returns null if no pending signal exists.
|
|
18483
|
+
*
|
|
18484
|
+
* @param symbol - Trading pair symbol
|
|
18485
|
+
* @param currentPrice - Current market price
|
|
18486
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18487
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18488
|
+
* @returns Promise resolving to PNL in dollars or null
|
|
18489
|
+
*
|
|
18490
|
+
* @example
|
|
18491
|
+
* ```typescript
|
|
18492
|
+
* const pnlCost = await Reflect.getPositionPnlCost(
|
|
18493
|
+
* "BTCUSDT",
|
|
18494
|
+
* 45000,
|
|
18495
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18496
|
+
* );
|
|
18497
|
+
* console.log(`PNL: $${pnlCost}`);
|
|
18498
|
+
* ```
|
|
18277
18499
|
*/
|
|
18278
|
-
|
|
18500
|
+
getPositionPnlCost: (symbol: string, currentPrice: number, context: {
|
|
18501
|
+
strategyName: StrategyName;
|
|
18502
|
+
exchangeName: ExchangeName;
|
|
18503
|
+
frameName: FrameName;
|
|
18504
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18279
18505
|
/**
|
|
18280
|
-
*
|
|
18281
|
-
*
|
|
18282
|
-
*
|
|
18506
|
+
* Returns the best price reached in the profit direction during this position's life.
|
|
18507
|
+
*
|
|
18508
|
+
* Returns null if no pending signal exists.
|
|
18509
|
+
*
|
|
18510
|
+
* @param symbol - Trading pair symbol
|
|
18511
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18512
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18513
|
+
* @returns Promise resolving to price or null
|
|
18514
|
+
*
|
|
18515
|
+
* @example
|
|
18516
|
+
* ```typescript
|
|
18517
|
+
* const peakPrice = await Reflect.getPositionHighestProfitPrice(
|
|
18518
|
+
* "BTCUSDT",
|
|
18519
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18520
|
+
* );
|
|
18521
|
+
* console.log(`Peak price: ${peakPrice}`);
|
|
18522
|
+
* ```
|
|
18283
18523
|
*/
|
|
18284
|
-
|
|
18524
|
+
getPositionHighestProfitPrice: (symbol: string, context: {
|
|
18525
|
+
strategyName: StrategyName;
|
|
18526
|
+
exchangeName: ExchangeName;
|
|
18527
|
+
frameName: FrameName;
|
|
18528
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18285
18529
|
/**
|
|
18286
|
-
*
|
|
18287
|
-
*
|
|
18288
|
-
*
|
|
18530
|
+
* Returns the timestamp when the best profit price was recorded during this position's life.
|
|
18531
|
+
*
|
|
18532
|
+
* Returns null if no pending signal exists.
|
|
18533
|
+
*
|
|
18534
|
+
* @param symbol - Trading pair symbol
|
|
18535
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18536
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18537
|
+
* @returns Promise resolving to timestamp in milliseconds or null
|
|
18538
|
+
*
|
|
18539
|
+
* @example
|
|
18540
|
+
* ```typescript
|
|
18541
|
+
* const ts = await Reflect.getPositionHighestProfitTimestamp(
|
|
18542
|
+
* "BTCUSDT",
|
|
18543
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18544
|
+
* );
|
|
18545
|
+
* console.log(`Peak at: ${new Date(ts).toISOString()}`);
|
|
18546
|
+
* ```
|
|
18289
18547
|
*/
|
|
18290
|
-
|
|
18548
|
+
getPositionHighestProfitTimestamp: (symbol: string, context: {
|
|
18549
|
+
strategyName: StrategyName;
|
|
18550
|
+
exchangeName: ExchangeName;
|
|
18551
|
+
frameName: FrameName;
|
|
18552
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18291
18553
|
/**
|
|
18292
|
-
*
|
|
18293
|
-
*
|
|
18294
|
-
*
|
|
18554
|
+
* Returns the PnL percentage at the moment the best profit price was recorded during this position's life.
|
|
18555
|
+
*
|
|
18556
|
+
* Returns null if no pending signal exists.
|
|
18557
|
+
*
|
|
18558
|
+
* @param symbol - Trading pair symbol
|
|
18559
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18560
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18561
|
+
* @returns Promise resolving to PnL percentage or null
|
|
18562
|
+
*
|
|
18563
|
+
* @example
|
|
18564
|
+
* ```typescript
|
|
18565
|
+
* const peakPnl = await Reflect.getPositionHighestPnlPercentage(
|
|
18566
|
+
* "BTCUSDT",
|
|
18567
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18568
|
+
* );
|
|
18569
|
+
* console.log(`Peak PNL: ${peakPnl}%`);
|
|
18570
|
+
* ```
|
|
18295
18571
|
*/
|
|
18296
|
-
|
|
18297
|
-
|
|
18298
|
-
|
|
18299
|
-
|
|
18300
|
-
|
|
18301
|
-
|
|
18302
|
-
|
|
18303
|
-
|
|
18304
|
-
|
|
18572
|
+
getPositionHighestPnlPercentage: (symbol: string, context: {
|
|
18573
|
+
strategyName: StrategyName;
|
|
18574
|
+
exchangeName: ExchangeName;
|
|
18575
|
+
frameName: FrameName;
|
|
18576
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18577
|
+
/**
|
|
18578
|
+
* Returns the PnL cost (in quote currency) at the moment the best profit price was recorded during this position's life.
|
|
18579
|
+
*
|
|
18580
|
+
* Returns null if no pending signal exists.
|
|
18581
|
+
*
|
|
18582
|
+
* @param symbol - Trading pair symbol
|
|
18583
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18584
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18585
|
+
* @returns Promise resolving to PnL cost in quote currency or null
|
|
18586
|
+
*
|
|
18587
|
+
* @example
|
|
18588
|
+
* ```typescript
|
|
18589
|
+
* const peakCost = await Reflect.getPositionHighestPnlCost(
|
|
18590
|
+
* "BTCUSDT",
|
|
18591
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18592
|
+
* );
|
|
18593
|
+
* console.log(`Peak PNL: $${peakCost}`);
|
|
18594
|
+
* ```
|
|
18595
|
+
*/
|
|
18596
|
+
getPositionHighestPnlCost: (symbol: string, context: {
|
|
18597
|
+
strategyName: StrategyName;
|
|
18598
|
+
exchangeName: ExchangeName;
|
|
18599
|
+
frameName: FrameName;
|
|
18600
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18601
|
+
/**
|
|
18602
|
+
* Returns whether breakeven was mathematically reachable at the highest profit price.
|
|
18603
|
+
*
|
|
18604
|
+
* Returns null if no pending signal exists.
|
|
18605
|
+
*
|
|
18606
|
+
* @param symbol - Trading pair symbol
|
|
18607
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18608
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18609
|
+
* @returns Promise resolving to true if breakeven was reachable at peak, false otherwise, or null
|
|
18610
|
+
*
|
|
18611
|
+
* @example
|
|
18612
|
+
* ```typescript
|
|
18613
|
+
* const wasReachable = await Reflect.getPositionHighestProfitBreakeven(
|
|
18614
|
+
* "BTCUSDT",
|
|
18615
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18616
|
+
* );
|
|
18617
|
+
* console.log(`Breakeven reachable at peak: ${wasReachable}`);
|
|
18618
|
+
* ```
|
|
18619
|
+
*/
|
|
18620
|
+
getPositionHighestProfitBreakeven: (symbol: string, context: {
|
|
18621
|
+
strategyName: StrategyName;
|
|
18622
|
+
exchangeName: ExchangeName;
|
|
18623
|
+
frameName: FrameName;
|
|
18624
|
+
}, backtest?: boolean) => Promise<boolean | null>;
|
|
18625
|
+
/**
|
|
18626
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
18627
|
+
*
|
|
18628
|
+
* Returns null if no pending signal exists.
|
|
18629
|
+
*
|
|
18630
|
+
* @param symbol - Trading pair symbol
|
|
18631
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18632
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18633
|
+
* @returns Promise resolving to minutes since highest profit price was recorded, or null
|
|
18634
|
+
*
|
|
18635
|
+
* @example
|
|
18636
|
+
* ```typescript
|
|
18637
|
+
* const minutes = await Reflect.getPositionDrawdownMinutes(
|
|
18638
|
+
* "BTCUSDT",
|
|
18639
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18640
|
+
* );
|
|
18641
|
+
* console.log(`Pulling back from peak for ${minutes} minutes`);
|
|
18642
|
+
* ```
|
|
18643
|
+
*/
|
|
18644
|
+
getPositionDrawdownMinutes: (symbol: string, context: {
|
|
18645
|
+
strategyName: StrategyName;
|
|
18646
|
+
exchangeName: ExchangeName;
|
|
18647
|
+
frameName: FrameName;
|
|
18648
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18649
|
+
/**
|
|
18650
|
+
* Returns the number of minutes elapsed since the highest profit price was recorded.
|
|
18651
|
+
*
|
|
18652
|
+
* Alias for getPositionDrawdownMinutes — measures how long the position has been
|
|
18653
|
+
* pulling back from its peak profit level.
|
|
18654
|
+
* Returns null if no pending signal exists.
|
|
18655
|
+
*
|
|
18656
|
+
* @param symbol - Trading pair symbol
|
|
18657
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18658
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18659
|
+
* @returns Promise resolving to minutes since last profit peak or null
|
|
18660
|
+
*
|
|
18661
|
+
* @example
|
|
18662
|
+
* ```typescript
|
|
18663
|
+
* const minutes = await Reflect.getPositionHighestProfitMinutes(
|
|
18664
|
+
* "BTCUSDT",
|
|
18665
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18666
|
+
* );
|
|
18667
|
+
* console.log(`Pulling back from peak for ${minutes} minutes`);
|
|
18668
|
+
* ```
|
|
18669
|
+
*/
|
|
18670
|
+
getPositionHighestProfitMinutes: (symbol: string, context: {
|
|
18671
|
+
strategyName: StrategyName;
|
|
18672
|
+
exchangeName: ExchangeName;
|
|
18673
|
+
frameName: FrameName;
|
|
18674
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18675
|
+
/**
|
|
18676
|
+
* Returns the number of minutes elapsed since the worst loss price was recorded.
|
|
18677
|
+
*
|
|
18678
|
+
* Measures how long ago the deepest drawdown point occurred.
|
|
18679
|
+
* Zero when called at the exact moment the trough was set.
|
|
18680
|
+
* Returns null if no pending signal exists.
|
|
18681
|
+
*
|
|
18682
|
+
* @param symbol - Trading pair symbol
|
|
18683
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18684
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18685
|
+
* @returns Promise resolving to minutes since last drawdown trough or null
|
|
18686
|
+
*
|
|
18687
|
+
* @example
|
|
18688
|
+
* ```typescript
|
|
18689
|
+
* const minutes = await Reflect.getPositionMaxDrawdownMinutes(
|
|
18690
|
+
* "BTCUSDT",
|
|
18691
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18692
|
+
* );
|
|
18693
|
+
* console.log(`Drawdown trough was ${minutes} minutes ago`);
|
|
18694
|
+
* ```
|
|
18695
|
+
*/
|
|
18696
|
+
getPositionMaxDrawdownMinutes: (symbol: string, context: {
|
|
18697
|
+
strategyName: StrategyName;
|
|
18698
|
+
exchangeName: ExchangeName;
|
|
18699
|
+
frameName: FrameName;
|
|
18700
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18701
|
+
/**
|
|
18702
|
+
* Returns the worst price reached in the loss direction during this position's life.
|
|
18703
|
+
*
|
|
18704
|
+
* Returns null if no pending signal exists.
|
|
18705
|
+
*
|
|
18706
|
+
* @param symbol - Trading pair symbol
|
|
18707
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18708
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18709
|
+
* @returns Promise resolving to price or null
|
|
18710
|
+
*
|
|
18711
|
+
* @example
|
|
18712
|
+
* ```typescript
|
|
18713
|
+
* const troughPrice = await Reflect.getPositionMaxDrawdownPrice(
|
|
18714
|
+
* "BTCUSDT",
|
|
18715
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18716
|
+
* );
|
|
18717
|
+
* console.log(`Worst price: ${troughPrice}`);
|
|
18718
|
+
* ```
|
|
18719
|
+
*/
|
|
18720
|
+
getPositionMaxDrawdownPrice: (symbol: string, context: {
|
|
18721
|
+
strategyName: StrategyName;
|
|
18722
|
+
exchangeName: ExchangeName;
|
|
18723
|
+
frameName: FrameName;
|
|
18724
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18725
|
+
/**
|
|
18726
|
+
* Returns the timestamp when the worst loss price was recorded during this position's life.
|
|
18727
|
+
*
|
|
18728
|
+
* Returns null if no pending signal exists.
|
|
18729
|
+
*
|
|
18730
|
+
* @param symbol - Trading pair symbol
|
|
18731
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18732
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18733
|
+
* @returns Promise resolving to timestamp in milliseconds or null
|
|
18734
|
+
*
|
|
18735
|
+
* @example
|
|
18736
|
+
* ```typescript
|
|
18737
|
+
* const ts = await Reflect.getPositionMaxDrawdownTimestamp(
|
|
18738
|
+
* "BTCUSDT",
|
|
18739
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18740
|
+
* );
|
|
18741
|
+
* console.log(`Worst drawdown at: ${new Date(ts).toISOString()}`);
|
|
18742
|
+
* ```
|
|
18743
|
+
*/
|
|
18744
|
+
getPositionMaxDrawdownTimestamp: (symbol: string, context: {
|
|
18745
|
+
strategyName: StrategyName;
|
|
18746
|
+
exchangeName: ExchangeName;
|
|
18747
|
+
frameName: FrameName;
|
|
18748
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18749
|
+
/**
|
|
18750
|
+
* Returns the PnL percentage at the moment the worst loss price was recorded during this position's life.
|
|
18751
|
+
*
|
|
18752
|
+
* Returns null if no pending signal exists.
|
|
18753
|
+
*
|
|
18754
|
+
* @param symbol - Trading pair symbol
|
|
18755
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18756
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18757
|
+
* @returns Promise resolving to PnL percentage or null
|
|
18758
|
+
*
|
|
18759
|
+
* @example
|
|
18760
|
+
* ```typescript
|
|
18761
|
+
* const worstPnl = await Reflect.getPositionMaxDrawdownPnlPercentage(
|
|
18762
|
+
* "BTCUSDT",
|
|
18763
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18764
|
+
* );
|
|
18765
|
+
* console.log(`Worst PNL: ${worstPnl}%`);
|
|
18766
|
+
* ```
|
|
18767
|
+
*/
|
|
18768
|
+
getPositionMaxDrawdownPnlPercentage: (symbol: string, context: {
|
|
18769
|
+
strategyName: StrategyName;
|
|
18770
|
+
exchangeName: ExchangeName;
|
|
18771
|
+
frameName: FrameName;
|
|
18772
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18773
|
+
/**
|
|
18774
|
+
* Returns the PnL cost (in quote currency) at the moment the worst loss price was recorded during this position's life.
|
|
18775
|
+
*
|
|
18776
|
+
* Returns null if no pending signal exists.
|
|
18777
|
+
*
|
|
18778
|
+
* @param symbol - Trading pair symbol
|
|
18779
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18780
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18781
|
+
* @returns Promise resolving to PnL cost in quote currency or null
|
|
18782
|
+
*
|
|
18783
|
+
* @example
|
|
18784
|
+
* ```typescript
|
|
18785
|
+
* const worstCost = await Reflect.getPositionMaxDrawdownPnlCost(
|
|
18786
|
+
* "BTCUSDT",
|
|
18787
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18788
|
+
* );
|
|
18789
|
+
* console.log(`Worst PNL: $${worstCost}`);
|
|
18790
|
+
* ```
|
|
18791
|
+
*/
|
|
18792
|
+
getPositionMaxDrawdownPnlCost: (symbol: string, context: {
|
|
18793
|
+
strategyName: StrategyName;
|
|
18794
|
+
exchangeName: ExchangeName;
|
|
18795
|
+
frameName: FrameName;
|
|
18796
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18797
|
+
/**
|
|
18798
|
+
* Returns the distance in PnL percentage between the current price and the highest profit peak.
|
|
18799
|
+
*
|
|
18800
|
+
* Result is ≥ 0. Returns null if no pending signal exists.
|
|
18801
|
+
*
|
|
18802
|
+
* @param symbol - Trading pair symbol
|
|
18803
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18804
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18805
|
+
* @returns Promise resolving to drawdown distance in PnL% (≥ 0) or null
|
|
18806
|
+
*
|
|
18807
|
+
* @example
|
|
18808
|
+
* ```typescript
|
|
18809
|
+
* const distance = await Reflect.getPositionHighestProfitDistancePnlPercentage(
|
|
18810
|
+
* "BTCUSDT",
|
|
18811
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18812
|
+
* );
|
|
18813
|
+
* console.log(`Dropped ${distance}% from peak`);
|
|
18814
|
+
* ```
|
|
18815
|
+
*/
|
|
18816
|
+
getPositionHighestProfitDistancePnlPercentage: (symbol: string, context: {
|
|
18817
|
+
strategyName: StrategyName;
|
|
18818
|
+
exchangeName: ExchangeName;
|
|
18819
|
+
frameName: FrameName;
|
|
18820
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18821
|
+
/**
|
|
18822
|
+
* Returns the distance in PnL cost between the current price and the highest profit peak.
|
|
18823
|
+
*
|
|
18824
|
+
* Result is ≥ 0. Returns null if no pending signal exists.
|
|
18825
|
+
*
|
|
18826
|
+
* @param symbol - Trading pair symbol
|
|
18827
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18828
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18829
|
+
* @returns Promise resolving to drawdown distance in PnL cost (≥ 0) or null
|
|
18830
|
+
*
|
|
18831
|
+
* @example
|
|
18832
|
+
* ```typescript
|
|
18833
|
+
* const distance = await Reflect.getPositionHighestProfitDistancePnlCost(
|
|
18834
|
+
* "BTCUSDT",
|
|
18835
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18836
|
+
* );
|
|
18837
|
+
* console.log(`Dropped $${distance} from peak`);
|
|
18838
|
+
* ```
|
|
18839
|
+
*/
|
|
18840
|
+
getPositionHighestProfitDistancePnlCost: (symbol: string, context: {
|
|
18841
|
+
strategyName: StrategyName;
|
|
18842
|
+
exchangeName: ExchangeName;
|
|
18843
|
+
frameName: FrameName;
|
|
18844
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18845
|
+
/**
|
|
18846
|
+
* Returns the distance in PnL percentage between the current price and the worst drawdown trough.
|
|
18847
|
+
*
|
|
18848
|
+
* Result is ≥ 0. Returns null if no pending signal exists.
|
|
18849
|
+
*
|
|
18850
|
+
* @param symbol - Trading pair symbol
|
|
18851
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18852
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18853
|
+
* @returns Promise resolving to recovery distance from worst drawdown trough in PnL% (≥ 0) or null
|
|
18854
|
+
*
|
|
18855
|
+
* @example
|
|
18856
|
+
* ```typescript
|
|
18857
|
+
* const distance = await Reflect.getPositionHighestMaxDrawdownPnlPercentage(
|
|
18858
|
+
* "BTCUSDT",
|
|
18859
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18860
|
+
* );
|
|
18861
|
+
* console.log(`${distance}% above worst trough`);
|
|
18862
|
+
* ```
|
|
18863
|
+
*/
|
|
18864
|
+
getPositionHighestMaxDrawdownPnlPercentage: (symbol: string, context: {
|
|
18865
|
+
strategyName: StrategyName;
|
|
18866
|
+
exchangeName: ExchangeName;
|
|
18867
|
+
frameName: FrameName;
|
|
18868
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18869
|
+
/**
|
|
18870
|
+
* Returns the distance in PnL cost between the current price and the worst drawdown trough.
|
|
18871
|
+
*
|
|
18872
|
+
* Result is ≥ 0. Returns null if no pending signal exists.
|
|
18873
|
+
*
|
|
18874
|
+
* @param symbol - Trading pair symbol
|
|
18875
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18876
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18877
|
+
* @returns Promise resolving to recovery distance from worst drawdown trough in PnL cost (≥ 0) or null
|
|
18878
|
+
*
|
|
18879
|
+
* @example
|
|
18880
|
+
* ```typescript
|
|
18881
|
+
* const distance = await Reflect.getPositionHighestMaxDrawdownPnlCost(
|
|
18882
|
+
* "BTCUSDT",
|
|
18883
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18884
|
+
* );
|
|
18885
|
+
* console.log(`$${distance} above worst trough`);
|
|
18886
|
+
* ```
|
|
18887
|
+
*/
|
|
18888
|
+
getPositionHighestMaxDrawdownPnlCost: (symbol: string, context: {
|
|
18889
|
+
strategyName: StrategyName;
|
|
18890
|
+
exchangeName: ExchangeName;
|
|
18891
|
+
frameName: FrameName;
|
|
18892
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18893
|
+
/**
|
|
18894
|
+
* Returns the peak-to-trough PnL percentage distance between the position's highest profit and deepest drawdown.
|
|
18895
|
+
*
|
|
18896
|
+
* Result is ≥ 0. Returns null if no pending signal exists.
|
|
18897
|
+
*
|
|
18898
|
+
* @param symbol - Trading pair symbol
|
|
18899
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18900
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18901
|
+
* @returns Promise resolving to peak-to-trough PnL percentage distance (≥ 0) or null
|
|
18902
|
+
*
|
|
18903
|
+
* @example
|
|
18904
|
+
* ```typescript
|
|
18905
|
+
* const distance = await Reflect.getMaxDrawdownDistancePnlPercentage(
|
|
18906
|
+
* "BTCUSDT",
|
|
18907
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18908
|
+
* );
|
|
18909
|
+
* console.log(`Peak-to-trough: ${distance}%`);
|
|
18910
|
+
* ```
|
|
18911
|
+
*/
|
|
18912
|
+
getMaxDrawdownDistancePnlPercentage: (symbol: string, context: {
|
|
18913
|
+
strategyName: StrategyName;
|
|
18914
|
+
exchangeName: ExchangeName;
|
|
18915
|
+
frameName: FrameName;
|
|
18916
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18917
|
+
/**
|
|
18918
|
+
* Returns the peak-to-trough PnL cost distance between the position's highest profit and deepest drawdown.
|
|
18919
|
+
*
|
|
18920
|
+
* Result is ≥ 0. Returns null if no pending signal exists.
|
|
18921
|
+
*
|
|
18922
|
+
* @param symbol - Trading pair symbol
|
|
18923
|
+
* @param context - Execution context with strategyName, exchangeName and frameName
|
|
18924
|
+
* @param backtest - True if backtest mode, false if live mode (default: false)
|
|
18925
|
+
* @returns Promise resolving to peak-to-trough PnL cost distance (≥ 0) or null
|
|
18926
|
+
*
|
|
18927
|
+
* @example
|
|
18928
|
+
* ```typescript
|
|
18929
|
+
* const distance = await Reflect.getMaxDrawdownDistancePnlCost(
|
|
18930
|
+
* "BTCUSDT",
|
|
18931
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18932
|
+
* );
|
|
18933
|
+
* console.log(`Peak-to-trough: $${distance}`);
|
|
18934
|
+
* ```
|
|
18935
|
+
*/
|
|
18936
|
+
getMaxDrawdownDistancePnlCost: (symbol: string, context: {
|
|
18937
|
+
strategyName: StrategyName;
|
|
18938
|
+
exchangeName: ExchangeName;
|
|
18939
|
+
frameName: FrameName;
|
|
18940
|
+
}, backtest?: boolean) => Promise<number | null>;
|
|
18941
|
+
}
|
|
18942
|
+
/**
|
|
18943
|
+
* Singleton instance of ReflectUtils for convenient position state queries.
|
|
18944
|
+
*
|
|
18945
|
+
* @example
|
|
18946
|
+
* ```typescript
|
|
18947
|
+
* import { Reflect } from "backtest-kit";
|
|
18948
|
+
*
|
|
18949
|
+
* // Real-time PNL
|
|
18950
|
+
* const pnl = await Reflect.getPositionPnlPercent(
|
|
18951
|
+
* "BTCUSDT",
|
|
18952
|
+
* 45000,
|
|
18953
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18954
|
+
* );
|
|
18955
|
+
* console.log(`PNL: ${pnl}%`);
|
|
18956
|
+
*
|
|
18957
|
+
* // Peak profit
|
|
18958
|
+
* const peakPnl = await Reflect.getPositionHighestPnlPercentage(
|
|
18959
|
+
* "BTCUSDT",
|
|
18960
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18961
|
+
* );
|
|
18962
|
+
* console.log(`Peak PNL: ${peakPnl}%`);
|
|
18963
|
+
*
|
|
18964
|
+
* // Drawdown from peak
|
|
18965
|
+
* const drawdown = await Reflect.getPositionHighestProfitDistancePnlPercentage(
|
|
18966
|
+
* "BTCUSDT",
|
|
18967
|
+
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "frame1" }
|
|
18968
|
+
* );
|
|
18969
|
+
* console.log(`Dropped ${drawdown}% from peak`);
|
|
18970
|
+
* ```
|
|
18971
|
+
*/
|
|
18972
|
+
declare const Reflect: ReflectUtils;
|
|
18973
|
+
|
|
18974
|
+
/**
|
|
18975
|
+
* Utility class containing predefined trading constants for take-profit and stop-loss levels.
|
|
18976
|
+
*
|
|
18977
|
+
* Based on Kelly Criterion with exponential risk decay.
|
|
18978
|
+
* Values represent percentage of distance traveled towards final TP/SL target.
|
|
18979
|
+
*
|
|
18980
|
+
* Example: If final TP is at +10% profit:
|
|
18981
|
+
* - TP_LEVEL1 (30) triggers when price reaches 30% of distance = +3% profit
|
|
18982
|
+
* - TP_LEVEL2 (60) triggers when price reaches 60% of distance = +6% profit
|
|
18983
|
+
* - TP_LEVEL3 (90) triggers when price reaches 90% of distance = +9% profit
|
|
18984
|
+
*/
|
|
18985
|
+
declare class ConstantUtils {
|
|
18986
|
+
/**
|
|
18987
|
+
* Take Profit Level 1 (Kelly-optimized early partial).
|
|
18988
|
+
* Triggers at 30% of distance to final TP target.
|
|
18989
|
+
* Lock in profit early, let rest run.
|
|
18990
|
+
*/
|
|
18991
|
+
readonly TP_LEVEL1 = 30;
|
|
18992
|
+
/**
|
|
18993
|
+
* Take Profit Level 2 (Kelly-optimized mid partial).
|
|
18994
|
+
* Triggers at 60% of distance to final TP target.
|
|
18995
|
+
* Secure majority of position while trend continues.
|
|
18996
|
+
*/
|
|
18997
|
+
readonly TP_LEVEL2 = 60;
|
|
18998
|
+
/**
|
|
18999
|
+
* Take Profit Level 3 (Kelly-optimized final partial).
|
|
19000
|
+
* Triggers at 90% of distance to final TP target.
|
|
19001
|
+
* Near-complete exit, minimal exposure remains.
|
|
19002
|
+
*/
|
|
19003
|
+
readonly TP_LEVEL3 = 90;
|
|
19004
|
+
/**
|
|
19005
|
+
* Stop Loss Level 1 (Kelly-optimized early warning).
|
|
19006
|
+
* Triggers at 40% of distance to final SL target.
|
|
19007
|
+
* Reduce exposure when setup weakens.
|
|
19008
|
+
*/
|
|
19009
|
+
readonly SL_LEVEL1 = 40;
|
|
19010
|
+
/**
|
|
19011
|
+
* Stop Loss Level 2 (Kelly-optimized final exit).
|
|
19012
|
+
* Triggers at 80% of distance to final SL target.
|
|
19013
|
+
* Exit remaining position before catastrophic loss.
|
|
19014
|
+
*/
|
|
19015
|
+
readonly SL_LEVEL2 = 80;
|
|
19016
|
+
}
|
|
19017
|
+
/**
|
|
19018
|
+
* Global singleton instance of ConstantUtils.
|
|
19019
|
+
* Provides static-like access to predefined trading level constants.
|
|
19020
|
+
*
|
|
19021
|
+
* Kelly-optimized scaling strategy:
|
|
19022
|
+
* Profit side (pyramiding out):
|
|
19023
|
+
* - Close 33% at 30% progress (quick profit lock)
|
|
18305
19024
|
* - Close 33% at 60% progress (secure gains)
|
|
18306
19025
|
* - Close 34% at 90% progress (exit near target)
|
|
18307
19026
|
*
|
|
@@ -20217,7 +20936,7 @@ declare const Exchange: ExchangeUtils;
|
|
|
20217
20936
|
* Generic function type that accepts any arguments and returns any value.
|
|
20218
20937
|
* Used as a constraint for cached functions.
|
|
20219
20938
|
*/
|
|
20220
|
-
type Function = (...args: any[]) => any;
|
|
20939
|
+
type Function$1 = (...args: any[]) => any;
|
|
20221
20940
|
/**
|
|
20222
20941
|
* Async function type for file-cached functions.
|
|
20223
20942
|
* First argument is always `symbol: string`, followed by optional spread args.
|
|
@@ -20228,7 +20947,7 @@ type CacheFileFunction = (symbol: string, ...args: any[]) => Promise<any>;
|
|
|
20228
20947
|
* For example, for a function type `(symbol: string, arg1: number, arg2: string) => Promise<void>`,
|
|
20229
20948
|
* this type will infer the rest of the arguments as `[arg1: number, arg2: string]`.
|
|
20230
20949
|
*/
|
|
20231
|
-
type DropFirst<T extends (...args: any) => any> = T extends (first: any, ...rest: infer R) => any ? R : never;
|
|
20950
|
+
type DropFirst$1<T extends (...args: any) => any> = T extends (first: any, ...rest: infer R) => any ? R : never;
|
|
20232
20951
|
/**
|
|
20233
20952
|
* Extracts the `key` generator argument tuple from a `CacheFileFunction`.
|
|
20234
20953
|
* The first two arguments are always `symbol: string` and `alignMs: number` (aligned timestamp),
|
|
@@ -20240,7 +20959,7 @@ type DropFirst<T extends (...args: any) => any> = T extends (first: any, ...rest
|
|
|
20240
20959
|
type CacheFileKeyArgs<T extends CacheFileFunction> = [
|
|
20241
20960
|
symbol: string,
|
|
20242
20961
|
alignMs: number,
|
|
20243
|
-
...rest: DropFirst<T>
|
|
20962
|
+
...rest: DropFirst$1<T>
|
|
20244
20963
|
];
|
|
20245
20964
|
/**
|
|
20246
20965
|
* Utility class for function caching with timeframe-based invalidation.
|
|
@@ -20301,7 +21020,7 @@ declare class CacheUtils {
|
|
|
20301
21020
|
* const result3 = cachedCalculate("BTCUSDT", 14); // Cached (same key, same interval)
|
|
20302
21021
|
* ```
|
|
20303
21022
|
*/
|
|
20304
|
-
fn: <T extends Function, K = symbol>(run: T, context: {
|
|
21023
|
+
fn: <T extends Function$1, K = symbol>(run: T, context: {
|
|
20305
21024
|
interval: CandleInterval;
|
|
20306
21025
|
key?: (args: Parameters<T>) => K;
|
|
20307
21026
|
}) => T & {
|
|
@@ -20371,13 +21090,19 @@ declare class CacheUtils {
|
|
|
20371
21090
|
* Cache.dispose(calculateIndicator);
|
|
20372
21091
|
* ```
|
|
20373
21092
|
*/
|
|
20374
|
-
dispose: <T extends Function>(run: T) => void;
|
|
21093
|
+
dispose: <T extends Function$1>(run: T) => void;
|
|
20375
21094
|
/**
|
|
20376
21095
|
* Clears all memoized CacheFnInstance and CacheFileInstance objects.
|
|
20377
21096
|
* Call this when process.cwd() changes between strategy iterations
|
|
20378
21097
|
* so new instances are created with the updated base path.
|
|
20379
21098
|
*/
|
|
20380
21099
|
clear: () => void;
|
|
21100
|
+
/**
|
|
21101
|
+
* Resets the CacheFileInstance index counter to zero.
|
|
21102
|
+
* This is useful when process.cwd() changes between strategy iterations to ensure
|
|
21103
|
+
* that new CacheFileInstance objects start with index 0 and do not collide with old instances.
|
|
21104
|
+
*/
|
|
21105
|
+
resetCounter: () => void;
|
|
20381
21106
|
}
|
|
20382
21107
|
/**
|
|
20383
21108
|
* Singleton instance of CacheUtils for convenient function caching.
|
|
@@ -20396,15 +21121,34 @@ declare class CacheUtils {
|
|
|
20396
21121
|
declare const Cache: CacheUtils;
|
|
20397
21122
|
|
|
20398
21123
|
/**
|
|
20399
|
-
*
|
|
20400
|
-
*
|
|
21124
|
+
* Generic function type that accepts any arguments and returns any value.
|
|
21125
|
+
* Used as a constraint for interval functions.
|
|
21126
|
+
*/
|
|
21127
|
+
type Function = (...args: any[]) => any;
|
|
21128
|
+
/**
|
|
21129
|
+
* Async function type for file-interval functions.
|
|
21130
|
+
* First argument is always `symbol: string`, followed by optional spread args.
|
|
20401
21131
|
*/
|
|
20402
|
-
type
|
|
21132
|
+
type IntervalFileFunction = (symbol: string, ...args: any[]) => Promise<any>;
|
|
20403
21133
|
/**
|
|
20404
|
-
*
|
|
20405
|
-
*
|
|
21134
|
+
* Utility type to drop the first argument from a function type.
|
|
21135
|
+
* For example, for `(symbol: string, arg1: number, arg2: string) => Promise<void>`,
|
|
21136
|
+
* this will infer `[arg1: number, arg2: string]`.
|
|
20406
21137
|
*/
|
|
20407
|
-
type
|
|
21138
|
+
type DropFirst<T extends (...args: any) => any> = T extends (first: any, ...rest: infer R) => any ? R : never;
|
|
21139
|
+
/**
|
|
21140
|
+
* Extracts the `key` generator argument tuple from an `IntervalFileFunction`.
|
|
21141
|
+
* The first two arguments are always `symbol: string` and `alignMs: number` (aligned timestamp),
|
|
21142
|
+
* followed by the rest of the original function's arguments.
|
|
21143
|
+
*
|
|
21144
|
+
* For example, for `(symbol: string, arg1: number) => Promise<void>`,
|
|
21145
|
+
* this will produce `[symbol: string, alignMs: number, arg1: number]`.
|
|
21146
|
+
*/
|
|
21147
|
+
type IntervalFileKeyArgs<T extends IntervalFileFunction> = [
|
|
21148
|
+
symbol: string,
|
|
21149
|
+
alignMs: number,
|
|
21150
|
+
...rest: DropFirst<T>
|
|
21151
|
+
];
|
|
20408
21152
|
/**
|
|
20409
21153
|
* Utility class for wrapping signal functions with once-per-interval firing.
|
|
20410
21154
|
* Provides two modes: in-memory (`fn`) and persistent file-based (`file`).
|
|
@@ -20441,20 +21185,31 @@ declare class IntervalUtils {
|
|
|
20441
21185
|
*
|
|
20442
21186
|
* @param run - Signal function to wrap
|
|
20443
21187
|
* @param context.interval - Candle interval that controls the firing boundary
|
|
20444
|
-
* @
|
|
21188
|
+
* @param context.key - Optional key generator for argument-based state separation
|
|
21189
|
+
* @returns Wrapped function with the same signature as `F`, plus a `clear()` method
|
|
20445
21190
|
*
|
|
20446
21191
|
* @example
|
|
20447
21192
|
* ```typescript
|
|
21193
|
+
* // Without extra args
|
|
20448
21194
|
* const fireOnce = Interval.fn(mySignalFn, { interval: "15m" });
|
|
20449
|
-
*
|
|
20450
21195
|
* await fireOnce("BTCUSDT"); // → T or null (fn called)
|
|
20451
21196
|
* await fireOnce("BTCUSDT"); // → null (same interval, skipped)
|
|
21197
|
+
*
|
|
21198
|
+
* // With extra args and key
|
|
21199
|
+
* const fireOnce = Interval.fn(mySignalFn, {
|
|
21200
|
+
* interval: "15m",
|
|
21201
|
+
* key: ([symbol, period]) => `${symbol}_${period}`,
|
|
21202
|
+
* });
|
|
21203
|
+
* await fireOnce("BTCUSDT", 14); // → T or null
|
|
21204
|
+
* await fireOnce("BTCUSDT", 28); // → T or null (separate state)
|
|
20452
21205
|
* ```
|
|
20453
21206
|
*/
|
|
20454
|
-
fn: <
|
|
21207
|
+
fn: <F extends Function>(run: F, context: {
|
|
20455
21208
|
interval: CandleInterval;
|
|
20456
|
-
|
|
21209
|
+
key?: (args: Parameters<F>) => string;
|
|
21210
|
+
}) => F & {
|
|
20457
21211
|
clear(): void;
|
|
21212
|
+
gc(): number | undefined;
|
|
20458
21213
|
};
|
|
20459
21214
|
/**
|
|
20460
21215
|
* Wrap an async signal function with persistent file-based once-per-interval firing.
|
|
@@ -20466,24 +21221,30 @@ declare class IntervalUtils {
|
|
|
20466
21221
|
* The `run` function reference is used as the memoization key for the underlying
|
|
20467
21222
|
* `IntervalFileInstance`, so each unique function reference gets its own isolated instance.
|
|
20468
21223
|
*
|
|
20469
|
-
* @template
|
|
21224
|
+
* @template F - Concrete async function type
|
|
20470
21225
|
* @param run - Async signal function to wrap with persistent once-per-interval firing
|
|
20471
21226
|
* @param context.interval - Candle interval that controls the firing boundary
|
|
20472
21227
|
* @param context.name - Human-readable bucket name; becomes the directory prefix
|
|
20473
|
-
* @
|
|
20474
|
-
*
|
|
21228
|
+
* @param context.key - Optional entity key generator. Receives `[symbol, alignMs, ...rest]`.
|
|
21229
|
+
* Default: `([symbol, alignMs]) => \`${symbol}_${alignMs}\``
|
|
21230
|
+
* @returns Wrapped function with the same signature as `F`, plus an async `clear()` method
|
|
20475
21231
|
*
|
|
20476
21232
|
* @example
|
|
20477
21233
|
* ```typescript
|
|
20478
|
-
* const fetchSignal = async (symbol: string,
|
|
20479
|
-
* const fireOnce = Interval.file(fetchSignal, {
|
|
20480
|
-
*
|
|
21234
|
+
* const fetchSignal = async (symbol: string, period: number) => { ... };
|
|
21235
|
+
* const fireOnce = Interval.file(fetchSignal, {
|
|
21236
|
+
* interval: "1h",
|
|
21237
|
+
* name: "fetchSignal",
|
|
21238
|
+
* key: ([symbol, alignMs, period]) => `${symbol}_${alignMs}_${period}`,
|
|
21239
|
+
* });
|
|
21240
|
+
* await fireOnce("BTCUSDT", 14);
|
|
20481
21241
|
* ```
|
|
20482
21242
|
*/
|
|
20483
|
-
file: <
|
|
21243
|
+
file: <F extends IntervalFileFunction>(run: F, context: {
|
|
20484
21244
|
interval: CandleInterval;
|
|
20485
21245
|
name: string;
|
|
20486
|
-
|
|
21246
|
+
key?: (args: IntervalFileKeyArgs<F>) => string;
|
|
21247
|
+
}) => F & {
|
|
20487
21248
|
clear(): Promise<void>;
|
|
20488
21249
|
};
|
|
20489
21250
|
/**
|
|
@@ -20501,14 +21262,19 @@ declare class IntervalUtils {
|
|
|
20501
21262
|
* Interval.dispose(mySignalFn);
|
|
20502
21263
|
* ```
|
|
20503
21264
|
*/
|
|
20504
|
-
dispose: (run:
|
|
21265
|
+
dispose: (run: Function) => void;
|
|
20505
21266
|
/**
|
|
20506
|
-
* Clears all memoized `IntervalFnInstance` and `IntervalFileInstance` objects
|
|
20507
|
-
* resets the `IntervalFileInstance` index counter.
|
|
21267
|
+
* Clears all memoized `IntervalFnInstance` and `IntervalFileInstance` objects.
|
|
20508
21268
|
* Call this when `process.cwd()` changes between strategy iterations
|
|
20509
21269
|
* so new instances are created with the updated base path.
|
|
20510
21270
|
*/
|
|
20511
21271
|
clear: () => void;
|
|
21272
|
+
/**
|
|
21273
|
+
* Resets the IntervalFileInstance index counter to zero.
|
|
21274
|
+
* This is useful when process.cwd() changes between strategy iterations to ensure
|
|
21275
|
+
* that new IntervalFileInstance objects start with index 0 and do not collide with old instances.
|
|
21276
|
+
*/
|
|
21277
|
+
resetCounter: () => void;
|
|
20512
21278
|
}
|
|
20513
21279
|
/**
|
|
20514
21280
|
* Singleton instance of `IntervalUtils` for convenient once-per-interval signal firing.
|
|
@@ -20961,12 +21727,13 @@ declare class StrategyMarkdownService {
|
|
|
20961
21727
|
* @param context - Strategy context with strategyName, exchangeName, frameName
|
|
20962
21728
|
* @param timestamp - Timestamp from StrategyCommitContract (execution context time)
|
|
20963
21729
|
* @param cancelId - Optional identifier for the cancellation reason
|
|
21730
|
+
* @param note - Optional note from commit payload
|
|
20964
21731
|
*/
|
|
20965
21732
|
cancelScheduled: (symbol: string, isBacktest: boolean, context: {
|
|
20966
21733
|
strategyName: StrategyName;
|
|
20967
21734
|
exchangeName: ExchangeName;
|
|
20968
21735
|
frameName: FrameName;
|
|
20969
|
-
}, timestamp: number, signalId: string, pnl: IStrategyPnL, cancelId?: string) => Promise<void>;
|
|
21736
|
+
}, timestamp: number, signalId: string, pnl: IStrategyPnL, cancelId?: string, note?: string) => Promise<void>;
|
|
20970
21737
|
/**
|
|
20971
21738
|
* Records a close-pending event when a pending signal is closed.
|
|
20972
21739
|
*
|
|
@@ -20975,12 +21742,13 @@ declare class StrategyMarkdownService {
|
|
|
20975
21742
|
* @param context - Strategy context with strategyName, exchangeName, frameName
|
|
20976
21743
|
* @param timestamp - Timestamp from StrategyCommitContract (execution context time)
|
|
20977
21744
|
* @param closeId - Optional identifier for the close reason
|
|
21745
|
+
* @param note - Optional note from commit payload
|
|
20978
21746
|
*/
|
|
20979
21747
|
closePending: (symbol: string, isBacktest: boolean, context: {
|
|
20980
21748
|
strategyName: StrategyName;
|
|
20981
21749
|
exchangeName: ExchangeName;
|
|
20982
21750
|
frameName: FrameName;
|
|
20983
|
-
}, timestamp: number, signalId: string, pnl: IStrategyPnL, closeId?: string) => Promise<void>;
|
|
21751
|
+
}, timestamp: number, signalId: string, pnl: IStrategyPnL, closeId?: string, note?: string) => Promise<void>;
|
|
20984
21752
|
/**
|
|
20985
21753
|
* Records a partial-profit event when a portion of the position is closed at profit.
|
|
20986
21754
|
*
|
|
@@ -21112,12 +21880,13 @@ declare class StrategyMarkdownService {
|
|
|
21112
21880
|
* @param scheduledAt - Signal creation timestamp in milliseconds
|
|
21113
21881
|
* @param pendingAt - Pending timestamp in milliseconds
|
|
21114
21882
|
* @param activateId - Optional identifier for the activation reason
|
|
21883
|
+
* @param note - Optional note from commit payload
|
|
21115
21884
|
*/
|
|
21116
21885
|
activateScheduled: (symbol: string, currentPrice: number, isBacktest: boolean, context: {
|
|
21117
21886
|
strategyName: StrategyName;
|
|
21118
21887
|
exchangeName: ExchangeName;
|
|
21119
21888
|
frameName: FrameName;
|
|
21120
|
-
}, timestamp: number, signalId: string, pnl: IStrategyPnL, totalPartials: number, position: "long" | "short", priceOpen: number, priceTakeProfit: number, priceStopLoss: number, originalPriceTakeProfit: number, originalPriceStopLoss: number, scheduledAt: number, pendingAt: number, totalEntries: number, originalPriceOpen: number, activateId?: string) => Promise<void>;
|
|
21889
|
+
}, timestamp: number, signalId: string, pnl: IStrategyPnL, totalPartials: number, position: "long" | "short", priceOpen: number, priceTakeProfit: number, priceStopLoss: number, originalPriceTakeProfit: number, originalPriceStopLoss: number, scheduledAt: number, pendingAt: number, totalEntries: number, originalPriceOpen: number, activateId?: string, note?: string) => Promise<void>;
|
|
21121
21890
|
/**
|
|
21122
21891
|
* Records an average-buy (DCA) event when a new averaging entry is added to an open position.
|
|
21123
21892
|
*
|
|
@@ -25357,6 +26126,40 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
25357
26126
|
exchangeName: ExchangeName;
|
|
25358
26127
|
frameName: FrameName;
|
|
25359
26128
|
}) => Promise<number | null>;
|
|
26129
|
+
/**
|
|
26130
|
+
* Returns the peak-to-trough PnL percentage distance between the position's highest profit and deepest drawdown.
|
|
26131
|
+
*
|
|
26132
|
+
* Resolves current price via priceMetaService and delegates to
|
|
26133
|
+
* ClientStrategy.getMaxDrawdownDistancePnlPercentage().
|
|
26134
|
+
* Returns null if no pending signal exists.
|
|
26135
|
+
*
|
|
26136
|
+
* @param backtest - Whether running in backtest mode
|
|
26137
|
+
* @param symbol - Trading pair symbol
|
|
26138
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
26139
|
+
* @returns Promise resolving to peak-to-trough PnL percentage distance (≥ 0) or null
|
|
26140
|
+
*/
|
|
26141
|
+
getMaxDrawdownDistancePnlPercentage: (backtest: boolean, symbol: string, context: {
|
|
26142
|
+
strategyName: StrategyName;
|
|
26143
|
+
exchangeName: ExchangeName;
|
|
26144
|
+
frameName: FrameName;
|
|
26145
|
+
}) => Promise<number | null>;
|
|
26146
|
+
/**
|
|
26147
|
+
* Returns the peak-to-trough PnL cost distance between the position's highest profit and deepest drawdown.
|
|
26148
|
+
*
|
|
26149
|
+
* Resolves current price via priceMetaService and delegates to
|
|
26150
|
+
* ClientStrategy.getMaxDrawdownDistancePnlCost().
|
|
26151
|
+
* Returns null if no pending signal exists.
|
|
26152
|
+
*
|
|
26153
|
+
* @param backtest - Whether running in backtest mode
|
|
26154
|
+
* @param symbol - Trading pair symbol
|
|
26155
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
26156
|
+
* @returns Promise resolving to peak-to-trough PnL cost distance (≥ 0) or null
|
|
26157
|
+
*/
|
|
26158
|
+
getMaxDrawdownDistancePnlCost: (backtest: boolean, symbol: string, context: {
|
|
26159
|
+
strategyName: StrategyName;
|
|
26160
|
+
exchangeName: ExchangeName;
|
|
26161
|
+
frameName: FrameName;
|
|
26162
|
+
}) => Promise<number | null>;
|
|
25360
26163
|
/**
|
|
25361
26164
|
* Disposes the ClientStrategy instance for the given context.
|
|
25362
26165
|
*
|
|
@@ -25398,14 +26201,14 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
25398
26201
|
* @param backtest - Whether running in backtest mode
|
|
25399
26202
|
* @param symbol - Trading pair symbol
|
|
25400
26203
|
* @param ctx - Context with strategyName, exchangeName, frameName
|
|
25401
|
-
* @param
|
|
26204
|
+
* @param payload - Optional commit payload with id and note
|
|
25402
26205
|
* @returns Promise that resolves when scheduled signal is cancelled
|
|
25403
26206
|
*/
|
|
25404
26207
|
cancelScheduled: (backtest: boolean, symbol: string, context: {
|
|
25405
26208
|
strategyName: StrategyName;
|
|
25406
26209
|
exchangeName: ExchangeName;
|
|
25407
26210
|
frameName: FrameName;
|
|
25408
|
-
},
|
|
26211
|
+
}, payload?: Partial<CommitPayload>) => Promise<void>;
|
|
25409
26212
|
/**
|
|
25410
26213
|
* Closes the pending signal without stopping the strategy.
|
|
25411
26214
|
*
|
|
@@ -25419,14 +26222,14 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
25419
26222
|
* @param backtest - Whether running in backtest mode
|
|
25420
26223
|
* @param symbol - Trading pair symbol
|
|
25421
26224
|
* @param context - Context with strategyName, exchangeName, frameName
|
|
25422
|
-
* @param
|
|
26225
|
+
* @param payload - Optional commit payload with id and note
|
|
25423
26226
|
* @returns Promise that resolves when pending signal is closed
|
|
25424
26227
|
*/
|
|
25425
26228
|
closePending: (backtest: boolean, symbol: string, context: {
|
|
25426
26229
|
strategyName: StrategyName;
|
|
25427
26230
|
exchangeName: ExchangeName;
|
|
25428
26231
|
frameName: FrameName;
|
|
25429
|
-
},
|
|
26232
|
+
}, payload?: Partial<CommitPayload>) => Promise<void>;
|
|
25430
26233
|
/**
|
|
25431
26234
|
* Checks whether `partialProfit` would succeed without executing it.
|
|
25432
26235
|
* Delegates to `ClientStrategy.validatePartialProfit()` — no throws, pure boolean result.
|
|
@@ -25678,7 +26481,7 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
25678
26481
|
* @param backtest - Whether running in backtest mode
|
|
25679
26482
|
* @param symbol - Trading pair symbol
|
|
25680
26483
|
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
25681
|
-
* @param
|
|
26484
|
+
* @param payload - Optional commit payload with id and note
|
|
25682
26485
|
* @returns Promise that resolves when activation flag is set
|
|
25683
26486
|
*
|
|
25684
26487
|
* @example
|
|
@@ -25688,7 +26491,7 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
25688
26491
|
* false,
|
|
25689
26492
|
* "BTCUSDT",
|
|
25690
26493
|
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "" },
|
|
25691
|
-
* "manual-activation"
|
|
26494
|
+
* { id: "manual-activation" }
|
|
25692
26495
|
* );
|
|
25693
26496
|
* ```
|
|
25694
26497
|
*/
|
|
@@ -25696,7 +26499,7 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
25696
26499
|
strategyName: StrategyName;
|
|
25697
26500
|
exchangeName: ExchangeName;
|
|
25698
26501
|
frameName: FrameName;
|
|
25699
|
-
},
|
|
26502
|
+
}, payload?: Partial<CommitPayload>) => Promise<void>;
|
|
25700
26503
|
/**
|
|
25701
26504
|
* Checks whether `averageBuy` would succeed without executing it.
|
|
25702
26505
|
* Delegates to `ClientStrategy.validateAverageBuy()` — no throws, pure boolean result.
|
|
@@ -26938,14 +27741,14 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
26938
27741
|
* @param backtest - Whether running in backtest mode
|
|
26939
27742
|
* @param symbol - Trading pair symbol
|
|
26940
27743
|
* @param ctx - Context with strategyName, exchangeName, frameName
|
|
26941
|
-
* @param
|
|
27744
|
+
* @param payload - Optional commit payload with id and note
|
|
26942
27745
|
* @returns Promise that resolves when scheduled signal is cancelled
|
|
26943
27746
|
*/
|
|
26944
27747
|
cancelScheduled: (backtest: boolean, symbol: string, context: {
|
|
26945
27748
|
strategyName: StrategyName;
|
|
26946
27749
|
exchangeName: ExchangeName;
|
|
26947
27750
|
frameName: FrameName;
|
|
26948
|
-
},
|
|
27751
|
+
}, payload?: Partial<CommitPayload>) => Promise<void>;
|
|
26949
27752
|
/**
|
|
26950
27753
|
* Closes the pending signal without stopping the strategy.
|
|
26951
27754
|
*
|
|
@@ -26960,14 +27763,14 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
26960
27763
|
* @param backtest - Whether running in backtest mode
|
|
26961
27764
|
* @param symbol - Trading pair symbol
|
|
26962
27765
|
* @param context - Context with strategyName, exchangeName, frameName
|
|
26963
|
-
* @param
|
|
27766
|
+
* @param payload - Optional commit payload with id and note
|
|
26964
27767
|
* @returns Promise that resolves when pending signal is closed
|
|
26965
27768
|
*/
|
|
26966
27769
|
closePending: (backtest: boolean, symbol: string, context: {
|
|
26967
27770
|
strategyName: StrategyName;
|
|
26968
27771
|
exchangeName: ExchangeName;
|
|
26969
27772
|
frameName: FrameName;
|
|
26970
|
-
},
|
|
27773
|
+
}, payload?: Partial<CommitPayload>) => Promise<void>;
|
|
26971
27774
|
/**
|
|
26972
27775
|
* Disposes the ClientStrategy instance for the given context.
|
|
26973
27776
|
*
|
|
@@ -27243,7 +28046,7 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
27243
28046
|
* @param backtest - Whether running in backtest mode
|
|
27244
28047
|
* @param symbol - Trading pair symbol
|
|
27245
28048
|
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
27246
|
-
* @param
|
|
28049
|
+
* @param payload - Optional commit payload with id and note
|
|
27247
28050
|
* @returns Promise that resolves when activation flag is set
|
|
27248
28051
|
*
|
|
27249
28052
|
* @example
|
|
@@ -27253,7 +28056,7 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
27253
28056
|
* false,
|
|
27254
28057
|
* "BTCUSDT",
|
|
27255
28058
|
* { strategyName: "my-strategy", exchangeName: "binance", frameName: "" },
|
|
27256
|
-
* "manual-activation"
|
|
28059
|
+
* { id: "manual-activation" }
|
|
27257
28060
|
* );
|
|
27258
28061
|
* ```
|
|
27259
28062
|
*/
|
|
@@ -27261,7 +28064,7 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
27261
28064
|
strategyName: StrategyName;
|
|
27262
28065
|
exchangeName: ExchangeName;
|
|
27263
28066
|
frameName: FrameName;
|
|
27264
|
-
},
|
|
28067
|
+
}, payload?: Partial<CommitPayload>) => Promise<void>;
|
|
27265
28068
|
/**
|
|
27266
28069
|
* Checks whether `averageBuy` would succeed without executing it.
|
|
27267
28070
|
* Validates context, then delegates to StrategyConnectionService.validateAverageBuy().
|
|
@@ -27592,6 +28395,38 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
27592
28395
|
exchangeName: ExchangeName;
|
|
27593
28396
|
frameName: FrameName;
|
|
27594
28397
|
}) => Promise<number | null>;
|
|
28398
|
+
/**
|
|
28399
|
+
* Returns the peak-to-trough PnL percentage distance between the position's highest profit and deepest drawdown.
|
|
28400
|
+
*
|
|
28401
|
+
* Delegates to StrategyConnectionService.getMaxDrawdownDistancePnlPercentage().
|
|
28402
|
+
* Returns null if no pending signal exists.
|
|
28403
|
+
*
|
|
28404
|
+
* @param backtest - Whether running in backtest mode
|
|
28405
|
+
* @param symbol - Trading pair symbol
|
|
28406
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
28407
|
+
* @returns Promise resolving to peak-to-trough PnL percentage distance (≥ 0) or null
|
|
28408
|
+
*/
|
|
28409
|
+
getMaxDrawdownDistancePnlPercentage: (backtest: boolean, symbol: string, context: {
|
|
28410
|
+
strategyName: StrategyName;
|
|
28411
|
+
exchangeName: ExchangeName;
|
|
28412
|
+
frameName: FrameName;
|
|
28413
|
+
}) => Promise<number | null>;
|
|
28414
|
+
/**
|
|
28415
|
+
* Returns the peak-to-trough PnL cost distance between the position's highest profit and deepest drawdown.
|
|
28416
|
+
*
|
|
28417
|
+
* Delegates to StrategyConnectionService.getMaxDrawdownDistancePnlCost().
|
|
28418
|
+
* Returns null if no pending signal exists.
|
|
28419
|
+
*
|
|
28420
|
+
* @param backtest - Whether running in backtest mode
|
|
28421
|
+
* @param symbol - Trading pair symbol
|
|
28422
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
28423
|
+
* @returns Promise resolving to peak-to-trough PnL cost distance (≥ 0) or null
|
|
28424
|
+
*/
|
|
28425
|
+
getMaxDrawdownDistancePnlCost: (backtest: boolean, symbol: string, context: {
|
|
28426
|
+
strategyName: StrategyName;
|
|
28427
|
+
exchangeName: ExchangeName;
|
|
28428
|
+
frameName: FrameName;
|
|
28429
|
+
}) => Promise<number | null>;
|
|
27595
28430
|
}
|
|
27596
28431
|
|
|
27597
28432
|
/**
|
|
@@ -29987,7 +30822,7 @@ declare class StrategyReportService {
|
|
|
29987
30822
|
strategyName: StrategyName;
|
|
29988
30823
|
exchangeName: ExchangeName;
|
|
29989
30824
|
frameName: FrameName;
|
|
29990
|
-
}, timestamp: number, signalId: string, pnl: IStrategyPnL, totalPartials: number, cancelId?: string) => Promise<void>;
|
|
30825
|
+
}, timestamp: number, signalId: string, pnl: IStrategyPnL, totalPartials: number, cancelId?: string, note?: string) => Promise<void>;
|
|
29991
30826
|
/**
|
|
29992
30827
|
* Logs a close-pending event when a pending signal is closed.
|
|
29993
30828
|
*/
|
|
@@ -29995,7 +30830,7 @@ declare class StrategyReportService {
|
|
|
29995
30830
|
strategyName: StrategyName;
|
|
29996
30831
|
exchangeName: ExchangeName;
|
|
29997
30832
|
frameName: FrameName;
|
|
29998
|
-
}, timestamp: number, signalId: string, pnl: IStrategyPnL, totalPartials: number, closeId?: string) => Promise<void>;
|
|
30833
|
+
}, timestamp: number, signalId: string, pnl: IStrategyPnL, totalPartials: number, closeId?: string, note?: string) => Promise<void>;
|
|
29999
30834
|
/**
|
|
30000
30835
|
* Logs a partial-profit event when a portion of the position is closed at profit.
|
|
30001
30836
|
*/
|
|
@@ -30043,7 +30878,7 @@ declare class StrategyReportService {
|
|
|
30043
30878
|
strategyName: StrategyName;
|
|
30044
30879
|
exchangeName: ExchangeName;
|
|
30045
30880
|
frameName: FrameName;
|
|
30046
|
-
}, timestamp: number, signalId: string, pnl: IStrategyPnL, totalPartials: number, position: "long" | "short", priceOpen: number, priceTakeProfit: number, priceStopLoss: number, originalPriceTakeProfit: number, originalPriceStopLoss: number, scheduledAt: number, pendingAt: number, totalEntries: number, originalPriceOpen: number, activateId?: string) => Promise<void>;
|
|
30881
|
+
}, timestamp: number, signalId: string, pnl: IStrategyPnL, totalPartials: number, position: "long" | "short", priceOpen: number, priceTakeProfit: number, priceStopLoss: number, originalPriceTakeProfit: number, originalPriceStopLoss: number, scheduledAt: number, pendingAt: number, totalEntries: number, originalPriceOpen: number, activateId?: string, note?: string) => Promise<void>;
|
|
30047
30882
|
/**
|
|
30048
30883
|
* Logs an average-buy (DCA) event when a new averaging entry is added to an open position.
|
|
30049
30884
|
*/
|
|
@@ -30443,4 +31278,4 @@ declare const getTotalClosed: (signal: Signal) => {
|
|
|
30443
31278
|
remainingCostBasis: number;
|
|
30444
31279
|
};
|
|
30445
31280
|
|
|
30446
|
-
export { ActionBase, type ActivateScheduledCommit, type ActivateScheduledCommitNotification, type ActivePingContract, type AverageBuyCommit, type AverageBuyCommitNotification, Backtest, type BacktestStatisticsModel, Breakeven, type BreakevenAvailableNotification, type BreakevenCommit, type BreakevenCommitNotification, type BreakevenContract, type BreakevenData, type BreakevenEvent, type BreakevenStatisticsModel, Broker, type BrokerAverageBuyPayload, BrokerBase, type BrokerBreakevenPayload, type BrokerPartialLossPayload, type BrokerPartialProfitPayload, type BrokerSignalClosePayload, type BrokerSignalOpenPayload, type BrokerTrailingStopPayload, type BrokerTrailingTakePayload, Cache, type CancelScheduledCommit, type CancelScheduledCommitNotification, type CandleData, type CandleInterval, type ClosePendingCommit, type ClosePendingCommitNotification, type ColumnConfig, type ColumnModel, Constant, type CriticalErrorNotification, type DoneContract, Dump, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, HighestProfit, type HighestProfitContract, type HighestProfitEvent, type HighestProfitStatisticsModel, type IActionSchema, type IActivateScheduledCommitRow, type IAggregatedTradeData, type IBidData, type IBreakevenCommitRow, type IBroker, type ICandleData, type ICommitRow, type IDumpContext, type IDumpInstance, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type ILog, type ILogEntry, type ILogger, type IMarkdownDumpOptions, type IMemoryInstance, type INotificationUtils, type IOrderBookData, type IPartialLossCommitRow, type IPartialProfitCommitRow, type IPersistBase, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicAction, type IPublicCandleData, type IPublicSignalRow, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskSignalRow, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, type IScheduledSignalRow, type ISignalDto, type ISignalIntervalDto, type ISignalRow, type ISizingCalculateParams, type ISizingCalculateParamsATR, type ISizingCalculateParamsFixedPercentage, type ISizingCalculateParamsKelly, type ISizingParams, type ISizingParamsATR, type ISizingParamsFixedPercentage, type ISizingParamsKelly, type ISizingSchema, type ISizingSchemaATR, type ISizingSchemaFixedPercentage, type ISizingSchemaKelly, type IStorageSignalRow, type IStorageUtils, type IStrategyPnL, type IStrategyResult, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IStrategyTickResultWaiting, type ITrailingStopCommitRow, type ITrailingTakeCommitRow, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, type InfoErrorNotification, Interval, type IntervalData, Live, type LiveStatisticsModel, Log, type LogData, Markdown, MarkdownFileBase, MarkdownFolderBase, type MarkdownName, MarkdownWriter, MaxDrawdown, type MaxDrawdownContract, type MaxDrawdownEvent, type MaxDrawdownStatisticsModel, type MeasureData, Memory, type MemoryData, type MessageModel, type MessageRole, type MessageToolCall, MethodContextService, type MetricStats, Notification, NotificationBacktest, type NotificationData, NotificationLive, type NotificationModel, Partial$1 as Partial, type PartialData, type PartialEvent, type PartialLossAvailableNotification, type PartialLossCommit, type PartialLossCommitNotification, type PartialLossContract, type PartialProfitAvailableNotification, type PartialProfitCommit, type PartialProfitCommitNotification, type PartialProfitContract, type PartialStatisticsModel, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatisticsModel, PersistBase, PersistBreakevenAdapter, PersistCandleAdapter, PersistIntervalAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistMemoryAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PersistStorageAdapter, Position, PositionSize, type ProgressBacktestContract, type ProgressWalkerContract, Report, ReportBase, type ReportName, ReportWriter, Risk, type RiskContract, type RiskData, type RiskEvent, type RiskRejectionNotification, type RiskStatisticsModel, Schedule, type ScheduleData, type SchedulePingContract, type ScheduleStatisticsModel, type ScheduledEvent, type SignalCancelledNotification, type SignalCloseContract, type SignalClosedNotification, type SignalData, type SignalInterval, type SignalOpenContract, type SignalOpenedNotification, type SignalScheduledNotification, type SignalSyncCloseNotification, type SignalSyncContract, type SignalSyncOpenNotification, Storage, StorageBacktest, type StorageData, StorageLive, Strategy, type StrategyActionType, type StrategyCancelReason, type StrategyCloseReason, type StrategyCommitContract, type StrategyEvent, type StrategyStatisticsModel, Sync, type SyncEvent, type SyncStatisticsModel, type TBrokerCtor, type TDumpInstanceCtor, type
|
|
31281
|
+
export { ActionBase, type ActivateScheduledCommit, type ActivateScheduledCommitNotification, type ActivePingContract, type AverageBuyCommit, type AverageBuyCommitNotification, Backtest, type BacktestStatisticsModel, Breakeven, type BreakevenAvailableNotification, type BreakevenCommit, type BreakevenCommitNotification, type BreakevenContract, type BreakevenData, type BreakevenEvent, type BreakevenStatisticsModel, Broker, type BrokerAverageBuyPayload, BrokerBase, type BrokerBreakevenPayload, type BrokerPartialLossPayload, type BrokerPartialProfitPayload, type BrokerSignalClosePayload, type BrokerSignalOpenPayload, type BrokerTrailingStopPayload, type BrokerTrailingTakePayload, Cache, type CancelScheduledCommit, type CancelScheduledCommitNotification, type CandleData, type CandleInterval, type ClosePendingCommit, type ClosePendingCommitNotification, type ColumnConfig, type ColumnModel, Constant, type CriticalErrorNotification, type DoneContract, Dump, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, HighestProfit, type HighestProfitContract, type HighestProfitEvent, type HighestProfitStatisticsModel, type IActionSchema, type IActivateScheduledCommitRow, type IAggregatedTradeData, type IBidData, type IBreakevenCommitRow, type IBroker, type ICandleData, type ICommitRow, type IDumpContext, type IDumpInstance, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type ILog, type ILogEntry, type ILogger, type IMarkdownDumpOptions, type IMemoryInstance, type INotificationUtils, type IOrderBookData, type IPartialLossCommitRow, type IPartialProfitCommitRow, type IPersistBase, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicAction, type IPublicCandleData, type IPublicSignalRow, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskSignalRow, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, type IScheduledSignalRow, type ISignalDto, type ISignalIntervalDto, type ISignalRow, type ISizingCalculateParams, type ISizingCalculateParamsATR, type ISizingCalculateParamsFixedPercentage, type ISizingCalculateParamsKelly, type ISizingParams, type ISizingParamsATR, type ISizingParamsFixedPercentage, type ISizingParamsKelly, type ISizingSchema, type ISizingSchemaATR, type ISizingSchemaFixedPercentage, type ISizingSchemaKelly, type IStorageSignalRow, type IStorageUtils, type IStrategyPnL, type IStrategyResult, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IStrategyTickResultWaiting, type ITrailingStopCommitRow, type ITrailingTakeCommitRow, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, type InfoErrorNotification, Interval, type IntervalData, Live, type LiveStatisticsModel, Log, type LogData, Markdown, MarkdownFileBase, MarkdownFolderBase, type MarkdownName, MarkdownWriter, MaxDrawdown, type MaxDrawdownContract, type MaxDrawdownEvent, type MaxDrawdownStatisticsModel, type MeasureData, Memory, type MemoryData, type MessageModel, type MessageRole, type MessageToolCall, MethodContextService, type MetricStats, Notification, NotificationBacktest, type NotificationData, NotificationLive, type NotificationModel, Partial$1 as Partial, type PartialData, type PartialEvent, type PartialLossAvailableNotification, type PartialLossCommit, type PartialLossCommitNotification, type PartialLossContract, type PartialProfitAvailableNotification, type PartialProfitCommit, type PartialProfitCommitNotification, type PartialProfitContract, type PartialStatisticsModel, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatisticsModel, PersistBase, PersistBreakevenAdapter, PersistCandleAdapter, PersistIntervalAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistMemoryAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PersistStorageAdapter, Position, PositionSize, type ProgressBacktestContract, type ProgressWalkerContract, Reflect, Report, ReportBase, type ReportName, ReportWriter, Risk, type RiskContract, type RiskData, type RiskEvent, type RiskRejectionNotification, type RiskStatisticsModel, Schedule, type ScheduleData, type SchedulePingContract, type ScheduleStatisticsModel, type ScheduledEvent, type SignalCancelledNotification, type SignalCloseContract, type SignalClosedNotification, type SignalData, type SignalInterval, type SignalOpenContract, type SignalOpenedNotification, type SignalScheduledNotification, type SignalSyncCloseNotification, type SignalSyncContract, type SignalSyncOpenNotification, Storage, StorageBacktest, type StorageData, StorageLive, Strategy, type StrategyActionType, type StrategyCancelReason, type StrategyCloseReason, type StrategyCommitContract, type StrategyEvent, type StrategyStatisticsModel, Sync, type SyncEvent, type SyncStatisticsModel, type TBrokerCtor, type TDumpInstanceCtor, type TLogCtor, type TMarkdownBase, type TMemoryInstanceCtor, type TNotificationUtilsCtor, type TPersistBase, type TPersistBaseCtor, type TReportBase, type TStorageUtilsCtor, type TickEvent, type TrailingStopCommit, type TrailingStopCommitNotification, type TrailingTakeCommit, type TrailingTakeCommitNotification, type ValidationErrorNotification, Walker, type WalkerCompleteContract, type WalkerContract, type WalkerMetric, type SignalData$1 as WalkerSignalData, type WalkerStatisticsModel, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, dumpAgentAnswer, dumpError, dumpJson, dumpRecord, dumpTable, dumpText, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getMaxDrawdownDistancePnlCost, getMaxDrawdownDistancePnlPercentage, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionCountdownMinutes, getPositionDrawdownMinutes, getPositionEffectivePrice, getPositionEntries, getPositionEntryOverlap, getPositionEstimateMinutes, getPositionHighestMaxDrawdownPnlCost, getPositionHighestMaxDrawdownPnlPercentage, getPositionHighestPnlCost, getPositionHighestPnlPercentage, getPositionHighestProfitBreakeven, getPositionHighestProfitDistancePnlCost, getPositionHighestProfitDistancePnlPercentage, getPositionHighestProfitMinutes, getPositionHighestProfitPrice, getPositionHighestProfitTimestamp, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionMaxDrawdownMinutes, getPositionMaxDrawdownPnlCost, getPositionMaxDrawdownPnlPercentage, getPositionMaxDrawdownPrice, getPositionMaxDrawdownTimestamp, getPositionPartialOverlap, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getRawCandles, getRiskSchema, getScheduledSignal, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasNoPendingSignal, hasNoScheduledSignal, hasTradeContext, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listMemory, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenHighestProfit, listenHighestProfitOnce, listenMaxDrawdown, listenMaxDrawdownOnce, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, readMemory, removeMemory, roundTicks, runInMockContext, searchMemory, set, setColumns, setConfig, setLogger, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, validateCommonSignal, validatePendingSignal, validateScheduledSignal, validateSignal, waitForCandle, warmCandles, writeMemory };
|