backtest-kit 4.0.2 → 5.1.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 +1025 -146
- package/build/index.mjs +1025 -148
- package/package.json +1 -1
- package/types.d.ts +624 -30
package/types.d.ts
CHANGED
|
@@ -1792,6 +1792,9 @@ interface IAction {
|
|
|
1792
1792
|
*
|
|
1793
1793
|
* NOTE: Exceptions are NOT swallowed here — they propagate to CREATE_SYNC_FN.
|
|
1794
1794
|
*
|
|
1795
|
+
* @deprecated This method is not recommended for use. Implement custom logic in signal(), signalLive(), or signalBacktest() instead.
|
|
1796
|
+
* If you need to implement custom logic on signal open/close, please use signal(), signalBacktest(), signalLive() instead.
|
|
1797
|
+
* If Action::signalSync throws the exchange will not execute the order!
|
|
1795
1798
|
* @param event - Sync event with action "signal-open" or "signal-close"
|
|
1796
1799
|
*/
|
|
1797
1800
|
signalSync(event: SignalSyncContract): void | Promise<void>;
|
|
@@ -2161,8 +2164,8 @@ interface ISignalRow extends ISignalDto {
|
|
|
2161
2164
|
* Used to slice _entry to only entries that existed at this partial.
|
|
2162
2165
|
*/
|
|
2163
2166
|
entryCountAtClose: number;
|
|
2164
|
-
/**
|
|
2165
|
-
|
|
2167
|
+
/** Unix timestamp in milliseconds when this partial close was executed */
|
|
2168
|
+
timestamp: number;
|
|
2166
2169
|
}>;
|
|
2167
2170
|
/**
|
|
2168
2171
|
* Trailing stop-loss price that overrides priceStopLoss when set.
|
|
@@ -2185,8 +2188,8 @@ interface ISignalRow extends ISignalDto {
|
|
|
2185
2188
|
price: number;
|
|
2186
2189
|
/** Cost of this entry in USD (e.g. 100 for $100 position) */
|
|
2187
2190
|
cost: number;
|
|
2188
|
-
/**
|
|
2189
|
-
|
|
2191
|
+
/** Unix timestamp in milliseconds when this entry was executed */
|
|
2192
|
+
timestamp: number;
|
|
2190
2193
|
}>;
|
|
2191
2194
|
/**
|
|
2192
2195
|
* Trailing take-profit price that overrides priceTakeProfit when set.
|
|
@@ -2863,9 +2866,29 @@ interface IStrategy {
|
|
|
2863
2866
|
* @param symbol - Trading pair symbol
|
|
2864
2867
|
* @returns Promise resolving to array of entry records or null
|
|
2865
2868
|
*/
|
|
2866
|
-
getPositionEntries: (symbol: string) => Promise<Array<{
|
|
2869
|
+
getPositionEntries: (symbol: string, timestamp: number) => Promise<Array<{
|
|
2867
2870
|
price: number;
|
|
2868
2871
|
cost: number;
|
|
2872
|
+
timestamp: number;
|
|
2873
|
+
}> | null>;
|
|
2874
|
+
/**
|
|
2875
|
+
* Returns the history of partial closes for the current pending signal.
|
|
2876
|
+
*
|
|
2877
|
+
* Each record includes the type (profit or loss), percentage closed, price, cost basis at close, and timestamp.
|
|
2878
|
+
* Used for tracking how the position was partially closed over time.
|
|
2879
|
+
*
|
|
2880
|
+
* Returns null if no pending signal exists or no partial closes were executed.
|
|
2881
|
+
*
|
|
2882
|
+
* @param symbol - Trading pair symbol
|
|
2883
|
+
* @returns Promise resolving to array of partial close records or null
|
|
2884
|
+
*/
|
|
2885
|
+
getPositionPartials: (symbol: string) => Promise<Array<{
|
|
2886
|
+
type: "profit" | "loss";
|
|
2887
|
+
percent: number;
|
|
2888
|
+
currentPrice: number;
|
|
2889
|
+
costBasisAtClose: number;
|
|
2890
|
+
entryCountAtClose: number;
|
|
2891
|
+
timestamp: number;
|
|
2869
2892
|
}> | null>;
|
|
2870
2893
|
/**
|
|
2871
2894
|
* Fast backtest using historical candles.
|
|
@@ -2985,14 +3008,15 @@ interface IStrategy {
|
|
|
2985
3008
|
* @param percentToClose - Absolute percentage of position to close (0-100)
|
|
2986
3009
|
* @param currentPrice - Current market price for partial close
|
|
2987
3010
|
* @param backtest - Whether running in backtest mode
|
|
3011
|
+
* @param timestamp - Unix timestamp (ms) of the candle that triggered this partial close
|
|
2988
3012
|
* @returns Promise<boolean> - true if partial close executed, false if skipped
|
|
2989
3013
|
*
|
|
2990
3014
|
* @example
|
|
2991
3015
|
* ```typescript
|
|
2992
3016
|
* callbacks: {
|
|
2993
|
-
* onPartialProfit: async (symbol, signal, currentPrice, percentTp, backtest) => {
|
|
3017
|
+
* onPartialProfit: async (symbol, signal, currentPrice, percentTp, backtest, timestamp) => {
|
|
2994
3018
|
* if (percentTp >= 50) {
|
|
2995
|
-
* const success = await strategy.partialProfit(symbol, 25, currentPrice, backtest);
|
|
3019
|
+
* const success = await strategy.partialProfit(symbol, 25, currentPrice, backtest, timestamp);
|
|
2996
3020
|
* if (success) {
|
|
2997
3021
|
* console.log('Partial profit executed');
|
|
2998
3022
|
* }
|
|
@@ -3001,7 +3025,7 @@ interface IStrategy {
|
|
|
3001
3025
|
* }
|
|
3002
3026
|
* ```
|
|
3003
3027
|
*/
|
|
3004
|
-
partialProfit: (symbol: string, percentToClose: number, currentPrice: number, backtest: boolean) => Promise<boolean>;
|
|
3028
|
+
partialProfit: (symbol: string, percentToClose: number, currentPrice: number, backtest: boolean, timestamp: number) => Promise<boolean>;
|
|
3005
3029
|
/**
|
|
3006
3030
|
* Checks whether `partialProfit` would succeed without executing it.
|
|
3007
3031
|
*
|
|
@@ -3040,14 +3064,15 @@ interface IStrategy {
|
|
|
3040
3064
|
* @param percentToClose - Absolute percentage of position to close (0-100)
|
|
3041
3065
|
* @param currentPrice - Current market price for partial close
|
|
3042
3066
|
* @param backtest - Whether running in backtest mode
|
|
3067
|
+
* @param timestamp - Unix timestamp (ms) of the candle that triggered this partial close
|
|
3043
3068
|
* @returns Promise<boolean> - true if partial close executed, false if skipped
|
|
3044
3069
|
*
|
|
3045
3070
|
* @example
|
|
3046
3071
|
* ```typescript
|
|
3047
3072
|
* callbacks: {
|
|
3048
|
-
* onPartialLoss: async (symbol, signal, currentPrice, percentSl, backtest) => {
|
|
3073
|
+
* onPartialLoss: async (symbol, signal, currentPrice, percentSl, backtest, timestamp) => {
|
|
3049
3074
|
* if (percentSl >= 80) {
|
|
3050
|
-
* const success = await strategy.partialLoss(symbol, 50, currentPrice, backtest);
|
|
3075
|
+
* const success = await strategy.partialLoss(symbol, 50, currentPrice, backtest, timestamp);
|
|
3051
3076
|
* if (success) {
|
|
3052
3077
|
* console.log('Partial loss executed');
|
|
3053
3078
|
* }
|
|
@@ -3056,7 +3081,7 @@ interface IStrategy {
|
|
|
3056
3081
|
* }
|
|
3057
3082
|
* ```
|
|
3058
3083
|
*/
|
|
3059
|
-
partialLoss: (symbol: string, percentToClose: number, currentPrice: number, backtest: boolean) => Promise<boolean>;
|
|
3084
|
+
partialLoss: (symbol: string, percentToClose: number, currentPrice: number, backtest: boolean, timestamp: number) => Promise<boolean>;
|
|
3060
3085
|
/**
|
|
3061
3086
|
* Checks whether `partialLoss` would succeed without executing it.
|
|
3062
3087
|
*
|
|
@@ -3315,9 +3340,11 @@ interface IStrategy {
|
|
|
3315
3340
|
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
3316
3341
|
* @param currentPrice - New entry price to add to the averaging history
|
|
3317
3342
|
* @param backtest - Whether running in backtest mode
|
|
3343
|
+
* @param timestamp - Unix timestamp (ms) of the candle that triggered this DCA entry
|
|
3344
|
+
* @param cost - Optional cost of the new entry (defaults to $100 if not provided)
|
|
3318
3345
|
* @returns Promise<boolean> - true if entry added, false if rejected by direction check
|
|
3319
3346
|
*/
|
|
3320
|
-
averageBuy: (symbol: string, currentPrice: number, backtest: boolean) => Promise<boolean>;
|
|
3347
|
+
averageBuy: (symbol: string, currentPrice: number, backtest: boolean, timestamp: number, cost?: number) => Promise<boolean>;
|
|
3321
3348
|
/**
|
|
3322
3349
|
* Checks whether `averageBuy` would succeed without executing it.
|
|
3323
3350
|
*
|
|
@@ -4370,6 +4397,17 @@ declare function getRiskSchema(riskName: RiskName): IRiskSchema;
|
|
|
4370
4397
|
*/
|
|
4371
4398
|
declare function getActionSchema(actionName: ActionName): IActionSchema;
|
|
4372
4399
|
|
|
4400
|
+
/**
|
|
4401
|
+
* Tolerance zone configuration for DCA overlap detection.
|
|
4402
|
+
* Percentages are in 0–100 format (e.g. 5 means 5%).
|
|
4403
|
+
*/
|
|
4404
|
+
interface IPositionOverlapLadder {
|
|
4405
|
+
/** Upper tolerance in percent (0–100): how far above each DCA level to flag as overlap */
|
|
4406
|
+
upperPercent: number;
|
|
4407
|
+
/** Lower tolerance in percent (0–100): how far below each DCA level to flag as overlap */
|
|
4408
|
+
lowerPercent: number;
|
|
4409
|
+
}
|
|
4410
|
+
|
|
4373
4411
|
/**
|
|
4374
4412
|
* Cancels the scheduled signal without stopping the strategy.
|
|
4375
4413
|
*
|
|
@@ -4760,9 +4798,101 @@ declare function getScheduledSignal(symbol: string): Promise<IScheduledSignalRow
|
|
|
4760
4798
|
* ```
|
|
4761
4799
|
*/
|
|
4762
4800
|
declare function getBreakeven(symbol: string, currentPrice: number): Promise<boolean>;
|
|
4801
|
+
/**
|
|
4802
|
+
* Returns the effective (DCA-weighted) entry price for the current pending signal.
|
|
4803
|
+
*
|
|
4804
|
+
* Uses cost-weighted harmonic mean: Σcost / Σ(cost/price).
|
|
4805
|
+
* When partial closes exist, the price is computed iteratively using
|
|
4806
|
+
* costBasisAtClose snapshots from each partial, then blended with any
|
|
4807
|
+
* DCA entries added after the last partial.
|
|
4808
|
+
* With no DCA entries, equals the original priceOpen.
|
|
4809
|
+
*
|
|
4810
|
+
* Returns null if no pending signal exists.
|
|
4811
|
+
*
|
|
4812
|
+
* Automatically detects backtest/live mode from execution context.
|
|
4813
|
+
*
|
|
4814
|
+
* @param symbol - Trading pair symbol
|
|
4815
|
+
* @returns Promise resolving to effective entry price or null
|
|
4816
|
+
*
|
|
4817
|
+
* @example
|
|
4818
|
+
* ```typescript
|
|
4819
|
+
* import { getPositionAveragePrice } from "backtest-kit";
|
|
4820
|
+
*
|
|
4821
|
+
* const avgPrice = await getPositionAveragePrice("BTCUSDT");
|
|
4822
|
+
* // No DCA: avgPrice === priceOpen
|
|
4823
|
+
* // After DCA at lower price: avgPrice < priceOpen
|
|
4824
|
+
* ```
|
|
4825
|
+
*/
|
|
4763
4826
|
declare function getPositionAveragePrice(symbol: string): Promise<number | null>;
|
|
4827
|
+
/**
|
|
4828
|
+
* Returns the number of DCA entries made for the current pending signal.
|
|
4829
|
+
*
|
|
4830
|
+
* 1 = original entry only (no DCA).
|
|
4831
|
+
* Increases by 1 with each successful commitAverageBuy().
|
|
4832
|
+
*
|
|
4833
|
+
* Returns null if no pending signal exists.
|
|
4834
|
+
*
|
|
4835
|
+
* Automatically detects backtest/live mode from execution context.
|
|
4836
|
+
*
|
|
4837
|
+
* @param symbol - Trading pair symbol
|
|
4838
|
+
* @returns Promise resolving to entry count or null
|
|
4839
|
+
*
|
|
4840
|
+
* @example
|
|
4841
|
+
* ```typescript
|
|
4842
|
+
* import { getPositionInvestedCount } from "backtest-kit";
|
|
4843
|
+
*
|
|
4844
|
+
* const count = await getPositionInvestedCount("BTCUSDT");
|
|
4845
|
+
* // No DCA: count === 1
|
|
4846
|
+
* // After one DCA: count === 2
|
|
4847
|
+
* ```
|
|
4848
|
+
*/
|
|
4764
4849
|
declare function getPositionInvestedCount(symbol: string): Promise<number | null>;
|
|
4850
|
+
/**
|
|
4851
|
+
* Returns the total invested cost basis in dollars for the current pending signal.
|
|
4852
|
+
*
|
|
4853
|
+
* Equal to the sum of all _entry costs (Σ entry.cost).
|
|
4854
|
+
* Each entry cost is set at the time of commitAverageBuy (defaults to CC_POSITION_ENTRY_COST).
|
|
4855
|
+
*
|
|
4856
|
+
* Returns null if no pending signal exists.
|
|
4857
|
+
*
|
|
4858
|
+
* Automatically detects backtest/live mode from execution context.
|
|
4859
|
+
*
|
|
4860
|
+
* @param symbol - Trading pair symbol
|
|
4861
|
+
* @returns Promise resolving to total invested cost in dollars or null
|
|
4862
|
+
*
|
|
4863
|
+
* @example
|
|
4864
|
+
* ```typescript
|
|
4865
|
+
* import { getPositionInvestedCost } from "backtest-kit";
|
|
4866
|
+
*
|
|
4867
|
+
* const cost = await getPositionInvestedCost("BTCUSDT");
|
|
4868
|
+
* // No DCA, default cost: cost === 100
|
|
4869
|
+
* // After one DCA with default cost: cost === 200
|
|
4870
|
+
* ```
|
|
4871
|
+
*/
|
|
4765
4872
|
declare function getPositionInvestedCost(symbol: string): Promise<number | null>;
|
|
4873
|
+
/**
|
|
4874
|
+
* Returns the unrealized PNL percentage for the current pending signal at current market price.
|
|
4875
|
+
*
|
|
4876
|
+
* Accounts for partial closes, DCA entries, slippage and fees
|
|
4877
|
+
* (delegates to toProfitLossDto).
|
|
4878
|
+
*
|
|
4879
|
+
* Returns null if no pending signal exists.
|
|
4880
|
+
*
|
|
4881
|
+
* Automatically detects backtest/live mode from execution context.
|
|
4882
|
+
* Automatically fetches current price via getAveragePrice.
|
|
4883
|
+
*
|
|
4884
|
+
* @param symbol - Trading pair symbol
|
|
4885
|
+
* @returns Promise resolving to PNL percentage or null
|
|
4886
|
+
*
|
|
4887
|
+
* @example
|
|
4888
|
+
* ```typescript
|
|
4889
|
+
* import { getPositionPnlPercent } from "backtest-kit";
|
|
4890
|
+
*
|
|
4891
|
+
* const pnlPct = await getPositionPnlPercent("BTCUSDT");
|
|
4892
|
+
* // LONG at 100, current=105: pnlPct ≈ 5
|
|
4893
|
+
* // LONG at 100, current=95: pnlPct ≈ -5
|
|
4894
|
+
* ```
|
|
4895
|
+
*/
|
|
4766
4896
|
declare function getPositionPnlPercent(symbol: string): Promise<number | null>;
|
|
4767
4897
|
/**
|
|
4768
4898
|
* Executes partial close at profit level by absolute dollar amount (moving toward TP).
|
|
@@ -4824,6 +4954,29 @@ declare function commitPartialProfitCost(symbol: string, dollarAmount: number):
|
|
|
4824
4954
|
* ```
|
|
4825
4955
|
*/
|
|
4826
4956
|
declare function commitPartialLossCost(symbol: string, dollarAmount: number): Promise<boolean>;
|
|
4957
|
+
/**
|
|
4958
|
+
* Returns the unrealized PNL in dollars for the current pending signal at current market price.
|
|
4959
|
+
*
|
|
4960
|
+
* Calculated as: pnlPercentage / 100 × totalInvestedCost.
|
|
4961
|
+
* Accounts for partial closes, DCA entries, slippage and fees.
|
|
4962
|
+
*
|
|
4963
|
+
* Returns null if no pending signal exists.
|
|
4964
|
+
*
|
|
4965
|
+
* Automatically detects backtest/live mode from execution context.
|
|
4966
|
+
* Automatically fetches current price via getAveragePrice.
|
|
4967
|
+
*
|
|
4968
|
+
* @param symbol - Trading pair symbol
|
|
4969
|
+
* @returns Promise resolving to PNL in dollars or null
|
|
4970
|
+
*
|
|
4971
|
+
* @example
|
|
4972
|
+
* ```typescript
|
|
4973
|
+
* import { getPositionPnlCost } from "backtest-kit";
|
|
4974
|
+
*
|
|
4975
|
+
* const pnlCost = await getPositionPnlCost("BTCUSDT");
|
|
4976
|
+
* // LONG at 100, invested $100, current=105: pnlCost ≈ 5
|
|
4977
|
+
* // LONG at 100, invested $200 (DCA), current=95: pnlCost ≈ -10
|
|
4978
|
+
* ```
|
|
4979
|
+
*/
|
|
4827
4980
|
declare function getPositionPnlCost(symbol: string): Promise<number | null>;
|
|
4828
4981
|
/**
|
|
4829
4982
|
* Returns the list of DCA entry prices for the current pending signal.
|
|
@@ -4881,8 +5034,60 @@ declare function getPositionPartials(symbol: string): Promise<{
|
|
|
4881
5034
|
currentPrice: number;
|
|
4882
5035
|
costBasisAtClose: number;
|
|
4883
5036
|
entryCountAtClose: number;
|
|
4884
|
-
|
|
5037
|
+
timestamp: number;
|
|
4885
5038
|
}[]>;
|
|
5039
|
+
/**
|
|
5040
|
+
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
5041
|
+
* Use this to prevent duplicate DCA entries at the same price area.
|
|
5042
|
+
*
|
|
5043
|
+
* Returns true if currentPrice is within [level - lowerStep, level + upperStep] for any level,
|
|
5044
|
+
* where step = level * percent / 100.
|
|
5045
|
+
* Returns false if no pending signal exists.
|
|
5046
|
+
*
|
|
5047
|
+
* @param symbol - Trading pair symbol
|
|
5048
|
+
* @param currentPrice - Price to check against existing DCA levels
|
|
5049
|
+
* @param ladder - Tolerance zone config; percentages in 0–100 format (default: 1.5% up and down)
|
|
5050
|
+
* @returns Promise<boolean> - true if price overlaps an existing entry level (DCA not recommended)
|
|
5051
|
+
*
|
|
5052
|
+
* @example
|
|
5053
|
+
* ```typescript
|
|
5054
|
+
* import { getPositionEntryOverlap } from "backtest-kit";
|
|
5055
|
+
*
|
|
5056
|
+
* // LONG with levels [43000, 42000], check if 42100 is too close to 42000
|
|
5057
|
+
* const overlap = await getPositionEntryOverlap("BTCUSDT", 42100, { upperPercent: 5, lowerPercent: 5 });
|
|
5058
|
+
* // overlap = true (42100 is within 5% of 42000 = [39900, 44100])
|
|
5059
|
+
* if (!overlap) {
|
|
5060
|
+
* await commitAverageBuy("BTCUSDT");
|
|
5061
|
+
* }
|
|
5062
|
+
* ```
|
|
5063
|
+
*/
|
|
5064
|
+
declare function getPositionEntryOverlap(symbol: string, currentPrice: number, ladder?: IPositionOverlapLadder): Promise<boolean>;
|
|
5065
|
+
/**
|
|
5066
|
+
* Checks whether the current price falls within the tolerance zone of any existing partial close price.
|
|
5067
|
+
* Use this to prevent duplicate partial closes at the same price area.
|
|
5068
|
+
*
|
|
5069
|
+
* Returns true if currentPrice is within [partial.currentPrice - lowerStep, partial.currentPrice + upperStep]
|
|
5070
|
+
* for any partial, where step = partial.currentPrice * percent / 100.
|
|
5071
|
+
* Returns false if no pending signal exists or no partials have been executed yet.
|
|
5072
|
+
*
|
|
5073
|
+
* @param symbol - Trading pair symbol
|
|
5074
|
+
* @param currentPrice - Price to check against existing partial close prices
|
|
5075
|
+
* @param ladder - Tolerance zone config; percentages in 0–100 format (default: 1.5% up and down)
|
|
5076
|
+
* @returns Promise<boolean> - true if price overlaps an existing partial price (partial not recommended)
|
|
5077
|
+
*
|
|
5078
|
+
* @example
|
|
5079
|
+
* ```typescript
|
|
5080
|
+
* import { getPositionPartialOverlap } from "backtest-kit";
|
|
5081
|
+
*
|
|
5082
|
+
* // Partials at [45000], check if 45100 is too close
|
|
5083
|
+
* const overlap = await getPositionPartialOverlap("BTCUSDT", 45100, { upperPercent: 1.5, lowerPercent: 1.5 });
|
|
5084
|
+
* // overlap = true (45100 is within 1.5% of 45000)
|
|
5085
|
+
* if (!overlap) {
|
|
5086
|
+
* await commitPartialProfit("BTCUSDT", 50);
|
|
5087
|
+
* }
|
|
5088
|
+
* ```
|
|
5089
|
+
*/
|
|
5090
|
+
declare function getPositionPartialOverlap(symbol: string, currentPrice: number, ladder?: IPositionOverlapLadder): Promise<boolean>;
|
|
4886
5091
|
|
|
4887
5092
|
/**
|
|
4888
5093
|
* Stops the strategy from generating new signals.
|
|
@@ -5165,9 +5370,17 @@ declare const GLOBAL_CONFIG: {
|
|
|
5165
5370
|
* Allows to commitAverageBuy if currentPrice is not the lowest price since entry, but still lower than priceOpen.
|
|
5166
5371
|
* This can help improve average entry price in cases where price has rebounded after entry but is still below priceOpen, without waiting for a new lower price.
|
|
5167
5372
|
*
|
|
5168
|
-
* Default:
|
|
5373
|
+
* Default: false (DCA logic enabled only when antirecord is broken)
|
|
5169
5374
|
*/
|
|
5170
5375
|
CC_ENABLE_DCA_EVERYWHERE: boolean;
|
|
5376
|
+
/**
|
|
5377
|
+
* Enables PPPL (Partial Profit, Partial Loss) logic even if this breaks a direction of exits
|
|
5378
|
+
* Allows to take partial profit or loss on a position even if it results in a mix of profit and loss exits
|
|
5379
|
+
* This can help lock in profits or cut losses on part of the position without waiting for a perfect exit scenario.
|
|
5380
|
+
*
|
|
5381
|
+
* Default: false (PPPL logic is only applied when it does not break the direction of exits, ensuring clearer profit/loss outcomes)
|
|
5382
|
+
*/
|
|
5383
|
+
CC_ENABLE_PPPL_EVERYWHERE: boolean;
|
|
5171
5384
|
/**
|
|
5172
5385
|
* Cost of entering a position (in USD).
|
|
5173
5386
|
* This is used as a default value for calculating position size and risk management when cost data is not provided by the strategy
|
|
@@ -5288,6 +5501,7 @@ declare function getConfig(): {
|
|
|
5288
5501
|
CC_MAX_LOG_LINES: number;
|
|
5289
5502
|
CC_ENABLE_CANDLE_FETCH_MUTEX: boolean;
|
|
5290
5503
|
CC_ENABLE_DCA_EVERYWHERE: boolean;
|
|
5504
|
+
CC_ENABLE_PPPL_EVERYWHERE: boolean;
|
|
5291
5505
|
CC_POSITION_ENTRY_COST: number;
|
|
5292
5506
|
};
|
|
5293
5507
|
/**
|
|
@@ -5329,6 +5543,7 @@ declare function getDefaultConfig(): Readonly<{
|
|
|
5329
5543
|
CC_MAX_LOG_LINES: number;
|
|
5330
5544
|
CC_ENABLE_CANDLE_FETCH_MUTEX: boolean;
|
|
5331
5545
|
CC_ENABLE_DCA_EVERYWHERE: boolean;
|
|
5546
|
+
CC_ENABLE_PPPL_EVERYWHERE: boolean;
|
|
5332
5547
|
CC_POSITION_ENTRY_COST: number;
|
|
5333
5548
|
}>;
|
|
5334
5549
|
/**
|
|
@@ -11646,7 +11861,7 @@ declare class BacktestUtils {
|
|
|
11646
11861
|
currentPrice: number;
|
|
11647
11862
|
costBasisAtClose: number;
|
|
11648
11863
|
entryCountAtClose: number;
|
|
11649
|
-
|
|
11864
|
+
timestamp: number;
|
|
11650
11865
|
}[]>;
|
|
11651
11866
|
/**
|
|
11652
11867
|
* Returns the list of DCA entry prices and costs for the current pending signal.
|
|
@@ -11672,7 +11887,46 @@ declare class BacktestUtils {
|
|
|
11672
11887
|
}) => Promise<{
|
|
11673
11888
|
price: number;
|
|
11674
11889
|
cost: number;
|
|
11890
|
+
timestamp: number;
|
|
11675
11891
|
}[]>;
|
|
11892
|
+
/**
|
|
11893
|
+
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
11894
|
+
* Use this to prevent duplicate DCA entries at the same price area.
|
|
11895
|
+
*
|
|
11896
|
+
* Returns true if currentPrice is within [level - lowerStep, level + upperStep] for any level,
|
|
11897
|
+
* where step = level * percent / 100.
|
|
11898
|
+
* Returns false if no pending signal exists.
|
|
11899
|
+
*
|
|
11900
|
+
* @param symbol - Trading pair symbol
|
|
11901
|
+
* @param currentPrice - Price to check against existing DCA levels
|
|
11902
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
11903
|
+
* @param ladder - Tolerance zone config; percentages in 0–100 format (default: 1.5% up and down)
|
|
11904
|
+
* @returns true if price overlaps an existing entry level (DCA not recommended)
|
|
11905
|
+
*/
|
|
11906
|
+
getPositionEntryOverlap: (symbol: string, currentPrice: number, context: {
|
|
11907
|
+
strategyName: StrategyName;
|
|
11908
|
+
exchangeName: ExchangeName;
|
|
11909
|
+
frameName: FrameName;
|
|
11910
|
+
}, ladder?: IPositionOverlapLadder) => Promise<boolean>;
|
|
11911
|
+
/**
|
|
11912
|
+
* Checks whether the current price falls within the tolerance zone of any existing partial close price.
|
|
11913
|
+
* Use this to prevent duplicate partial closes at the same price area.
|
|
11914
|
+
*
|
|
11915
|
+
* Returns true if currentPrice is within [partial.currentPrice - lowerStep, partial.currentPrice + upperStep]
|
|
11916
|
+
* for any partial, where step = partial.currentPrice * percent / 100.
|
|
11917
|
+
* Returns false if no pending signal exists or no partials have been executed yet.
|
|
11918
|
+
*
|
|
11919
|
+
* @param symbol - Trading pair symbol
|
|
11920
|
+
* @param currentPrice - Price to check against existing partial close prices
|
|
11921
|
+
* @param context - Execution context with strategyName, exchangeName, and frameName
|
|
11922
|
+
* @param ladder - Tolerance zone config; percentages in 0–100 format (default: 1.5% up and down)
|
|
11923
|
+
* @returns true if price overlaps an existing partial price (partial not recommended)
|
|
11924
|
+
*/
|
|
11925
|
+
getPositionPartialOverlap: (symbol: string, currentPrice: number, context: {
|
|
11926
|
+
strategyName: StrategyName;
|
|
11927
|
+
exchangeName: ExchangeName;
|
|
11928
|
+
frameName: FrameName;
|
|
11929
|
+
}, ladder?: IPositionOverlapLadder) => Promise<boolean>;
|
|
11676
11930
|
/**
|
|
11677
11931
|
* Stops the strategy from generating new signals.
|
|
11678
11932
|
*
|
|
@@ -12729,7 +12983,7 @@ declare class LiveUtils {
|
|
|
12729
12983
|
currentPrice: number;
|
|
12730
12984
|
costBasisAtClose: number;
|
|
12731
12985
|
entryCountAtClose: number;
|
|
12732
|
-
|
|
12986
|
+
timestamp: number;
|
|
12733
12987
|
}[]>;
|
|
12734
12988
|
/**
|
|
12735
12989
|
* Returns the list of DCA entry prices and costs for the current pending signal.
|
|
@@ -12754,7 +13008,44 @@ declare class LiveUtils {
|
|
|
12754
13008
|
}) => Promise<{
|
|
12755
13009
|
price: number;
|
|
12756
13010
|
cost: number;
|
|
13011
|
+
timestamp: number;
|
|
12757
13012
|
}[]>;
|
|
13013
|
+
/**
|
|
13014
|
+
* Checks whether the current price falls within the tolerance zone of any existing DCA entry level.
|
|
13015
|
+
* Use this to prevent duplicate DCA entries at the same price area.
|
|
13016
|
+
*
|
|
13017
|
+
* Returns true if currentPrice is within [level - lowerStep, level + upperStep] for any level,
|
|
13018
|
+
* where step = level * percent / 100.
|
|
13019
|
+
* Returns false if no pending signal exists.
|
|
13020
|
+
*
|
|
13021
|
+
* @param symbol - Trading pair symbol
|
|
13022
|
+
* @param currentPrice - Price to check against existing DCA levels
|
|
13023
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13024
|
+
* @param ladder - Tolerance zone config; percentages in 0–100 format (default: 1.5% up and down)
|
|
13025
|
+
* @returns true if price overlaps an existing entry level (DCA not recommended)
|
|
13026
|
+
*/
|
|
13027
|
+
getPositionEntryOverlap: (symbol: string, currentPrice: number, context: {
|
|
13028
|
+
strategyName: StrategyName;
|
|
13029
|
+
exchangeName: ExchangeName;
|
|
13030
|
+
}, ladder?: IPositionOverlapLadder) => Promise<boolean>;
|
|
13031
|
+
/**
|
|
13032
|
+
* Checks whether the current price falls within the tolerance zone of any existing partial close price.
|
|
13033
|
+
* Use this to prevent duplicate partial closes at the same price area.
|
|
13034
|
+
*
|
|
13035
|
+
* Returns true if currentPrice is within [partial.currentPrice - lowerStep, partial.currentPrice + upperStep]
|
|
13036
|
+
* for any partial, where step = partial.currentPrice * percent / 100.
|
|
13037
|
+
* Returns false if no pending signal exists or no partials have been executed yet.
|
|
13038
|
+
*
|
|
13039
|
+
* @param symbol - Trading pair symbol
|
|
13040
|
+
* @param currentPrice - Price to check against existing partial close prices
|
|
13041
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13042
|
+
* @param ladder - Tolerance zone config; percentages in 0–100 format (default: 1.5% up and down)
|
|
13043
|
+
* @returns true if price overlaps an existing partial price (partial not recommended)
|
|
13044
|
+
*/
|
|
13045
|
+
getPositionPartialOverlap: (symbol: string, currentPrice: number, context: {
|
|
13046
|
+
strategyName: StrategyName;
|
|
13047
|
+
exchangeName: ExchangeName;
|
|
13048
|
+
}, ladder?: IPositionOverlapLadder) => Promise<boolean>;
|
|
12758
13049
|
/**
|
|
12759
13050
|
* Stops the strategy from generating new signals.
|
|
12760
13051
|
*
|
|
@@ -16152,7 +16443,7 @@ declare class NotificationBacktestAdapter implements INotificationUtils {
|
|
|
16152
16443
|
* Proxies call to the underlying notification adapter.
|
|
16153
16444
|
* @param data - The signal sync contract data
|
|
16154
16445
|
*/
|
|
16155
|
-
handleSync: (data: SignalSyncContract) =>
|
|
16446
|
+
handleSync: (data: SignalSyncContract) => any;
|
|
16156
16447
|
/**
|
|
16157
16448
|
* Handles risk rejection event.
|
|
16158
16449
|
* Proxies call to the underlying notification adapter.
|
|
@@ -16258,7 +16549,7 @@ declare class NotificationLiveAdapter implements INotificationUtils {
|
|
|
16258
16549
|
* Proxies call to the underlying notification adapter.
|
|
16259
16550
|
* @param data - The signal sync contract data
|
|
16260
16551
|
*/
|
|
16261
|
-
handleSync: (data: SignalSyncContract) =>
|
|
16552
|
+
handleSync: (data: SignalSyncContract) => any;
|
|
16262
16553
|
/**
|
|
16263
16554
|
* Handles risk rejection event.
|
|
16264
16555
|
* Proxies call to the underlying notification adapter.
|
|
@@ -18239,15 +18530,6 @@ declare class ActionBase implements IPublicAction {
|
|
|
18239
18530
|
* ```
|
|
18240
18531
|
*/
|
|
18241
18532
|
riskRejection(event: RiskContract, source?: string): void | Promise<void>;
|
|
18242
|
-
/**
|
|
18243
|
-
* Gate for position open/close via limit order. Default allows all.
|
|
18244
|
-
* Throw to reject — framework retries next tick.
|
|
18245
|
-
*
|
|
18246
|
-
* NOTE: Exceptions are NOT swallowed — they propagate to CREATE_SYNC_FN.
|
|
18247
|
-
*
|
|
18248
|
-
* @param event - Sync event with action "signal-open" or "signal-close"
|
|
18249
|
-
*/
|
|
18250
|
-
signalSync(_event: SignalSyncContract, source?: string): void | Promise<void>;
|
|
18251
18533
|
/**
|
|
18252
18534
|
* Cleans up resources and subscriptions when action handler is disposed.
|
|
18253
18535
|
*
|
|
@@ -18483,6 +18765,8 @@ type BrokerTrailingStopPayload = {
|
|
|
18483
18765
|
currentPrice: number;
|
|
18484
18766
|
/** Absolute stop-loss price after applying percentShift */
|
|
18485
18767
|
newStopLossPrice: number;
|
|
18768
|
+
/** Active take profit price at the time of the trailing update */
|
|
18769
|
+
takeProfitPrice: number;
|
|
18486
18770
|
/** Position direction */
|
|
18487
18771
|
position: "long" | "short";
|
|
18488
18772
|
/** Strategy/exchange/frame routing context */
|
|
@@ -18523,6 +18807,8 @@ type BrokerTrailingTakePayload = {
|
|
|
18523
18807
|
currentPrice: number;
|
|
18524
18808
|
/** Absolute take-profit price after applying percentShift */
|
|
18525
18809
|
newTakeProfitPrice: number;
|
|
18810
|
+
/** Active take profit price at the time of the trailing update */
|
|
18811
|
+
takeProfitPrice: number;
|
|
18526
18812
|
/** Position direction */
|
|
18527
18813
|
position: "long" | "short";
|
|
18528
18814
|
/** Strategy/exchange/frame routing context */
|
|
@@ -20647,6 +20933,184 @@ declare class BreakevenConnectionService implements IBreakeven {
|
|
|
20647
20933
|
clear: (symbol: string, data: IPublicSignalRow, priceClose: number, backtest: boolean) => Promise<void>;
|
|
20648
20934
|
}
|
|
20649
20935
|
|
|
20936
|
+
/**
|
|
20937
|
+
* Service for tracking the latest candle timestamp per symbol-strategy-exchange-frame combination.
|
|
20938
|
+
*
|
|
20939
|
+
* Maintains a memoized BehaviorSubject per unique key that is updated on every strategy tick
|
|
20940
|
+
* by StrategyConnectionService. Consumers can synchronously read the last known timestamp or
|
|
20941
|
+
* await the first value if none has arrived yet.
|
|
20942
|
+
*
|
|
20943
|
+
* Primary use case: providing the current candle time outside of a tick execution context,
|
|
20944
|
+
* e.g., when a command is triggered between ticks.
|
|
20945
|
+
*
|
|
20946
|
+
* Features:
|
|
20947
|
+
* - One BehaviorSubject per (symbol, strategyName, exchangeName, frameName, backtest) key
|
|
20948
|
+
* - Falls back to ExecutionContextService.context.when when called inside an execution context
|
|
20949
|
+
* - Waits up to LISTEN_TIMEOUT ms for the first timestamp if none is cached yet
|
|
20950
|
+
* - clear() disposes the BehaviorSubject for a single key or all keys
|
|
20951
|
+
*
|
|
20952
|
+
* Architecture:
|
|
20953
|
+
* - Registered as singleton in DI container
|
|
20954
|
+
* - Updated by StrategyConnectionService after each tick
|
|
20955
|
+
* - Cleared by Backtest/Live/Walker at strategy start to prevent stale data
|
|
20956
|
+
*
|
|
20957
|
+
* @example
|
|
20958
|
+
* ```typescript
|
|
20959
|
+
* const ts = await backtest.timeMetaService.getTimestamp("BTCUSDT", context, false);
|
|
20960
|
+
* ```
|
|
20961
|
+
*/
|
|
20962
|
+
declare class TimeMetaService {
|
|
20963
|
+
private readonly loggerService;
|
|
20964
|
+
private readonly executionContextService;
|
|
20965
|
+
/**
|
|
20966
|
+
* Memoized factory for BehaviorSubject streams keyed by (symbol, strategyName, exchangeName, frameName, backtest).
|
|
20967
|
+
*
|
|
20968
|
+
* Each subject holds the latest createdAt timestamp emitted by the strategy iterator for that key.
|
|
20969
|
+
* Instances are cached until clear() is called.
|
|
20970
|
+
*/
|
|
20971
|
+
private getSource;
|
|
20972
|
+
/**
|
|
20973
|
+
* Returns the current candle timestamp (in milliseconds) for the given symbol and context.
|
|
20974
|
+
*
|
|
20975
|
+
* When called inside an execution context (i.e., during a signal handler or action),
|
|
20976
|
+
* reads the timestamp directly from ExecutionContextService.context.when.
|
|
20977
|
+
* Otherwise, reads the last value from the cached BehaviorSubject. If no value has
|
|
20978
|
+
* been emitted yet, waits up to LISTEN_TIMEOUT ms for the first tick before throwing.
|
|
20979
|
+
*
|
|
20980
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
20981
|
+
* @param context - Strategy, exchange, and frame identifiers
|
|
20982
|
+
* @param backtest - True if backtest mode, false if live mode
|
|
20983
|
+
* @returns Unix timestamp in milliseconds of the latest processed candle
|
|
20984
|
+
* @throws When no timestamp arrives within LISTEN_TIMEOUT ms
|
|
20985
|
+
*/
|
|
20986
|
+
getTimestamp: (symbol: string, context: {
|
|
20987
|
+
strategyName: string;
|
|
20988
|
+
exchangeName: string;
|
|
20989
|
+
frameName: string;
|
|
20990
|
+
}, backtest: boolean) => Promise<number>;
|
|
20991
|
+
/**
|
|
20992
|
+
* Pushes a new timestamp value into the BehaviorSubject for the given key.
|
|
20993
|
+
*
|
|
20994
|
+
* Called by StrategyConnectionService after each strategy tick to keep
|
|
20995
|
+
* the cached timestamp up to date.
|
|
20996
|
+
*
|
|
20997
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
20998
|
+
* @param timestamp - The createdAt timestamp from the tick (milliseconds)
|
|
20999
|
+
* @param context - Strategy, exchange, and frame identifiers
|
|
21000
|
+
* @param backtest - True if backtest mode, false if live mode
|
|
21001
|
+
*/
|
|
21002
|
+
next: (symbol: string, timestamp: number, context: {
|
|
21003
|
+
strategyName: string;
|
|
21004
|
+
exchangeName: string;
|
|
21005
|
+
frameName: string;
|
|
21006
|
+
}, backtest: boolean) => Promise<void>;
|
|
21007
|
+
/**
|
|
21008
|
+
* Disposes cached BehaviorSubject(s) to free memory and prevent stale data.
|
|
21009
|
+
*
|
|
21010
|
+
* When called without arguments, clears all memoized timestamp streams.
|
|
21011
|
+
* When called with a payload, clears only the stream for the specified key.
|
|
21012
|
+
* Should be called at strategy start (Backtest/Live/Walker) to reset state.
|
|
21013
|
+
*
|
|
21014
|
+
* @param payload - Optional key to clear a single stream; omit to clear all
|
|
21015
|
+
*/
|
|
21016
|
+
clear: (payload?: {
|
|
21017
|
+
symbol: string;
|
|
21018
|
+
strategyName: string;
|
|
21019
|
+
exchangeName: string;
|
|
21020
|
+
frameName: string;
|
|
21021
|
+
backtest: boolean;
|
|
21022
|
+
}) => void;
|
|
21023
|
+
}
|
|
21024
|
+
|
|
21025
|
+
/**
|
|
21026
|
+
* Service for tracking the latest market price per symbol-strategy-exchange-frame combination.
|
|
21027
|
+
*
|
|
21028
|
+
* Maintains a memoized BehaviorSubject per unique key that is updated on every strategy tick
|
|
21029
|
+
* by StrategyConnectionService. Consumers can synchronously read the last known price or
|
|
21030
|
+
* await the first value if none has arrived yet.
|
|
21031
|
+
*
|
|
21032
|
+
* Primary use case: providing the current price outside of a tick execution context,
|
|
21033
|
+
* e.g., when a command is triggered between ticks.
|
|
21034
|
+
*
|
|
21035
|
+
* Features:
|
|
21036
|
+
* - One BehaviorSubject per (symbol, strategyName, exchangeName, frameName, backtest) key
|
|
21037
|
+
* - Falls back to ExchangeConnectionService.getAveragePrice when called inside an execution context
|
|
21038
|
+
* - Waits up to LISTEN_TIMEOUT ms for the first price if none is cached yet
|
|
21039
|
+
* - clear() disposes the BehaviorSubject for a single key or all keys
|
|
21040
|
+
*
|
|
21041
|
+
* Architecture:
|
|
21042
|
+
* - Registered as singleton in DI container
|
|
21043
|
+
* - Updated by StrategyConnectionService after each tick
|
|
21044
|
+
* - Cleared by Backtest/Live/Walker at strategy start to prevent stale data
|
|
21045
|
+
*
|
|
21046
|
+
* @example
|
|
21047
|
+
* ```typescript
|
|
21048
|
+
* const price = await backtest.priceMetaService.getCurrentPrice("BTCUSDT", context, false);
|
|
21049
|
+
* ```
|
|
21050
|
+
*/
|
|
21051
|
+
declare class PriceMetaService {
|
|
21052
|
+
private readonly loggerService;
|
|
21053
|
+
private readonly exchangeConnectionService;
|
|
21054
|
+
/**
|
|
21055
|
+
* Memoized factory for BehaviorSubject streams keyed by (symbol, strategyName, exchangeName, frameName, backtest).
|
|
21056
|
+
*
|
|
21057
|
+
* Each subject holds the latest currentPrice emitted by the strategy iterator for that key.
|
|
21058
|
+
* Instances are cached until clear() is called.
|
|
21059
|
+
*/
|
|
21060
|
+
private getSource;
|
|
21061
|
+
/**
|
|
21062
|
+
* Returns the current market price for the given symbol and context.
|
|
21063
|
+
*
|
|
21064
|
+
* When called inside an execution context (i.e., during a signal handler or action),
|
|
21065
|
+
* delegates to ExchangeConnectionService.getAveragePrice for the live exchange price.
|
|
21066
|
+
* Otherwise, reads the last value from the cached BehaviorSubject. If no value has
|
|
21067
|
+
* been emitted yet, waits up to LISTEN_TIMEOUT ms for the first tick before throwing.
|
|
21068
|
+
*
|
|
21069
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
21070
|
+
* @param context - Strategy, exchange, and frame identifiers
|
|
21071
|
+
* @param backtest - True if backtest mode, false if live mode
|
|
21072
|
+
* @returns Current market price in quote currency
|
|
21073
|
+
* @throws When no price arrives within LISTEN_TIMEOUT ms
|
|
21074
|
+
*/
|
|
21075
|
+
getCurrentPrice: (symbol: string, context: {
|
|
21076
|
+
strategyName: string;
|
|
21077
|
+
exchangeName: string;
|
|
21078
|
+
frameName: string;
|
|
21079
|
+
}, backtest: boolean) => Promise<number>;
|
|
21080
|
+
/**
|
|
21081
|
+
* Pushes a new price value into the BehaviorSubject for the given key.
|
|
21082
|
+
*
|
|
21083
|
+
* Called by StrategyConnectionService after each strategy tick to keep
|
|
21084
|
+
* the cached price up to date.
|
|
21085
|
+
*
|
|
21086
|
+
* @param symbol - Trading pair symbol (e.g., "BTCUSDT")
|
|
21087
|
+
* @param currentPrice - The latest price from the tick
|
|
21088
|
+
* @param context - Strategy, exchange, and frame identifiers
|
|
21089
|
+
* @param backtest - True if backtest mode, false if live mode
|
|
21090
|
+
*/
|
|
21091
|
+
next: (symbol: string, currentPrice: number, context: {
|
|
21092
|
+
strategyName: string;
|
|
21093
|
+
exchangeName: string;
|
|
21094
|
+
frameName: string;
|
|
21095
|
+
}, backtest: boolean) => Promise<void>;
|
|
21096
|
+
/**
|
|
21097
|
+
* Disposes cached BehaviorSubject(s) to free memory and prevent stale data.
|
|
21098
|
+
*
|
|
21099
|
+
* When called without arguments, clears all memoized price streams.
|
|
21100
|
+
* When called with a payload, clears only the stream for the specified key.
|
|
21101
|
+
* Should be called at strategy start (Backtest/Live/Walker) to reset state.
|
|
21102
|
+
*
|
|
21103
|
+
* @param payload - Optional key to clear a single stream; omit to clear all
|
|
21104
|
+
*/
|
|
21105
|
+
clear: (payload?: {
|
|
21106
|
+
symbol: string;
|
|
21107
|
+
strategyName: string;
|
|
21108
|
+
exchangeName: string;
|
|
21109
|
+
frameName: string;
|
|
21110
|
+
backtest: boolean;
|
|
21111
|
+
}) => void;
|
|
21112
|
+
}
|
|
21113
|
+
|
|
20650
21114
|
/**
|
|
20651
21115
|
* Type definition for strategy methods.
|
|
20652
21116
|
* Maps all keys of IStrategy to any type.
|
|
@@ -20689,6 +21153,8 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
20689
21153
|
readonly partialConnectionService: PartialConnectionService;
|
|
20690
21154
|
readonly breakevenConnectionService: BreakevenConnectionService;
|
|
20691
21155
|
readonly actionCoreService: ActionCoreService;
|
|
21156
|
+
readonly timeMetaService: TimeMetaService;
|
|
21157
|
+
readonly priceMetaService: PriceMetaService;
|
|
20692
21158
|
/**
|
|
20693
21159
|
* Retrieves memoized ClientStrategy instance for given symbol-strategy pair with exchange and frame isolation.
|
|
20694
21160
|
*
|
|
@@ -20748,36 +21214,139 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
20748
21214
|
exchangeName: ExchangeName;
|
|
20749
21215
|
frameName: FrameName;
|
|
20750
21216
|
}) => Promise<number | null>;
|
|
21217
|
+
/**
|
|
21218
|
+
* Returns the effective (DCA-averaged) entry price for the current pending signal.
|
|
21219
|
+
*
|
|
21220
|
+
* This is the harmonic mean of all _entry prices, which is the correct
|
|
21221
|
+
* cost-basis price used in all PNL calculations.
|
|
21222
|
+
* With no DCA entries, equals the original priceOpen.
|
|
21223
|
+
*
|
|
21224
|
+
* Returns null if no pending signal exists.
|
|
21225
|
+
*
|
|
21226
|
+
* @param backtest - Whether running in backtest mode
|
|
21227
|
+
* @param symbol - Trading pair symbol
|
|
21228
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
21229
|
+
* @returns Promise resolving to effective entry price or null
|
|
21230
|
+
*/
|
|
20751
21231
|
getPositionAveragePrice: (backtest: boolean, symbol: string, context: {
|
|
20752
21232
|
strategyName: StrategyName;
|
|
20753
21233
|
exchangeName: ExchangeName;
|
|
20754
21234
|
frameName: FrameName;
|
|
20755
21235
|
}) => Promise<number | null>;
|
|
21236
|
+
/**
|
|
21237
|
+
* Returns the number of DCA entries made for the current pending signal.
|
|
21238
|
+
*
|
|
21239
|
+
* 1 = original entry only (no DCA).
|
|
21240
|
+
* Increases by 1 with each successful commitAverageBuy().
|
|
21241
|
+
*
|
|
21242
|
+
* Returns null if no pending signal exists.
|
|
21243
|
+
*
|
|
21244
|
+
* @param backtest - Whether running in backtest mode
|
|
21245
|
+
* @param symbol - Trading pair symbol
|
|
21246
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
21247
|
+
* @returns Promise resolving to entry count or null
|
|
21248
|
+
*/
|
|
20756
21249
|
getPositionInvestedCount: (backtest: boolean, symbol: string, context: {
|
|
20757
21250
|
strategyName: StrategyName;
|
|
20758
21251
|
exchangeName: ExchangeName;
|
|
20759
21252
|
frameName: FrameName;
|
|
20760
21253
|
}) => Promise<number | null>;
|
|
21254
|
+
/**
|
|
21255
|
+
* Returns the total invested cost basis in dollars for the current pending signal.
|
|
21256
|
+
*
|
|
21257
|
+
* Equal to entryCount × $100 (COST_BASIS_PER_ENTRY).
|
|
21258
|
+
* 1 entry = $100, 2 entries = $200, etc.
|
|
21259
|
+
*
|
|
21260
|
+
* Returns null if no pending signal exists.
|
|
21261
|
+
*
|
|
21262
|
+
* @param backtest - Whether running in backtest mode
|
|
21263
|
+
* @param symbol - Trading pair symbol
|
|
21264
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
21265
|
+
* @returns Promise resolving to total invested cost in dollars or null
|
|
21266
|
+
*/
|
|
20761
21267
|
getPositionInvestedCost: (backtest: boolean, symbol: string, context: {
|
|
20762
21268
|
strategyName: StrategyName;
|
|
20763
21269
|
exchangeName: ExchangeName;
|
|
20764
21270
|
frameName: FrameName;
|
|
20765
21271
|
}) => Promise<number | null>;
|
|
21272
|
+
/**
|
|
21273
|
+
* Returns the unrealized PNL percentage for the current pending signal at currentPrice.
|
|
21274
|
+
*
|
|
21275
|
+
* Accounts for partial closes, DCA entries, slippage and fees
|
|
21276
|
+
* (delegates to toProfitLossDto).
|
|
21277
|
+
*
|
|
21278
|
+
* Returns null if no pending signal exists.
|
|
21279
|
+
*
|
|
21280
|
+
* @param backtest - Whether running in backtest mode
|
|
21281
|
+
* @param symbol - Trading pair symbol
|
|
21282
|
+
* @param currentPrice - Current market price
|
|
21283
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
21284
|
+
* @returns Promise resolving to pnlPercentage or null
|
|
21285
|
+
*/
|
|
20766
21286
|
getPositionPnlPercent: (backtest: boolean, symbol: string, currentPrice: number, context: {
|
|
20767
21287
|
strategyName: StrategyName;
|
|
20768
21288
|
exchangeName: ExchangeName;
|
|
20769
21289
|
frameName: FrameName;
|
|
20770
21290
|
}) => Promise<number | null>;
|
|
21291
|
+
/**
|
|
21292
|
+
* Returns the unrealized PNL in dollars for the current pending signal at currentPrice.
|
|
21293
|
+
*
|
|
21294
|
+
* Calculated as: pnlPercentage / 100 × totalInvestedCost
|
|
21295
|
+
* Accounts for partial closes, DCA entries, slippage and fees.
|
|
21296
|
+
*
|
|
21297
|
+
* Returns null if no pending signal exists.
|
|
21298
|
+
*
|
|
21299
|
+
* @param backtest - Whether running in backtest mode
|
|
21300
|
+
* @param symbol - Trading pair symbol
|
|
21301
|
+
* @param currentPrice - Current market price
|
|
21302
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
21303
|
+
* @returns Promise resolving to pnl in dollars or null
|
|
21304
|
+
*/
|
|
20771
21305
|
getPositionPnlCost: (backtest: boolean, symbol: string, currentPrice: number, context: {
|
|
20772
21306
|
strategyName: StrategyName;
|
|
20773
21307
|
exchangeName: ExchangeName;
|
|
20774
21308
|
frameName: FrameName;
|
|
20775
21309
|
}) => Promise<number | null>;
|
|
21310
|
+
/**
|
|
21311
|
+
* Returns the list of DCA entry prices for the current pending signal.
|
|
21312
|
+
*
|
|
21313
|
+
* The first element is always the original priceOpen (initial entry).
|
|
21314
|
+
* Each subsequent element is a price added by commitAverageBuy().
|
|
21315
|
+
*
|
|
21316
|
+
* Returns null if no pending signal exists.
|
|
21317
|
+
* Returns a single-element array [priceOpen] if no DCA entries were made.
|
|
21318
|
+
*
|
|
21319
|
+
* @param backtest - Whether running in backtest mode
|
|
21320
|
+
* @param symbol - Trading pair symbol
|
|
21321
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
21322
|
+
* @returns Promise resolving to array of entry prices or null
|
|
21323
|
+
*
|
|
21324
|
+
* @example
|
|
21325
|
+
* ```typescript
|
|
21326
|
+
* // No DCA: [43000]
|
|
21327
|
+
* // One DCA: [43000, 42000]
|
|
21328
|
+
* // Two DCA: [43000, 42000, 41500]
|
|
21329
|
+
* ```
|
|
21330
|
+
*/
|
|
20776
21331
|
getPositionLevels: (backtest: boolean, symbol: string, context: {
|
|
20777
21332
|
strategyName: StrategyName;
|
|
20778
21333
|
exchangeName: ExchangeName;
|
|
20779
21334
|
frameName: FrameName;
|
|
20780
21335
|
}) => Promise<number[] | null>;
|
|
21336
|
+
/**
|
|
21337
|
+
* Returns the list of partial closes for the current pending signal.
|
|
21338
|
+
*
|
|
21339
|
+
* Each entry records a partial profit or loss close event with its type,
|
|
21340
|
+
* percent closed, price at close, cost basis snapshot, and entry count at close.
|
|
21341
|
+
*
|
|
21342
|
+
* Returns null if no pending signal exists.
|
|
21343
|
+
* Returns an empty array if no partial closes have been executed.
|
|
21344
|
+
*
|
|
21345
|
+
* @param backtest - Whether running in backtest mode
|
|
21346
|
+
* @param symbol - Trading pair symbol
|
|
21347
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
21348
|
+
* @returns Promise resolving to array of partial close records or null
|
|
21349
|
+
*/
|
|
20781
21350
|
getPositionPartials: (backtest: boolean, symbol: string, context: {
|
|
20782
21351
|
strategyName: StrategyName;
|
|
20783
21352
|
exchangeName: ExchangeName;
|
|
@@ -20788,8 +21357,29 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
20788
21357
|
currentPrice: number;
|
|
20789
21358
|
costBasisAtClose: number;
|
|
20790
21359
|
entryCountAtClose: number;
|
|
20791
|
-
|
|
21360
|
+
timestamp: number;
|
|
20792
21361
|
}[]>;
|
|
21362
|
+
/**
|
|
21363
|
+
* Returns the list of DCA entry prices and costs for the current pending signal.
|
|
21364
|
+
*
|
|
21365
|
+
* Each entry records the price and cost of a single position entry.
|
|
21366
|
+
* The first element is always the original priceOpen (initial entry).
|
|
21367
|
+
* Each subsequent element is an entry added by averageBuy().
|
|
21368
|
+
*
|
|
21369
|
+
* Returns null if no pending signal exists.
|
|
21370
|
+
* Returns a single-element array [{ price: priceOpen, cost }] if no DCA entries were made.
|
|
21371
|
+
*
|
|
21372
|
+
* @param backtest - Whether running in backtest mode
|
|
21373
|
+
* @param symbol - Trading pair symbol
|
|
21374
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
21375
|
+
* @returns Promise resolving to array of entry records or null
|
|
21376
|
+
*
|
|
21377
|
+
* @example
|
|
21378
|
+
* ```typescript
|
|
21379
|
+
* // No DCA: [{ price: 43000, cost: 100 }]
|
|
21380
|
+
* // One DCA: [{ price: 43000, cost: 100 }, { price: 42000, cost: 100 }]
|
|
21381
|
+
* ```
|
|
21382
|
+
*/
|
|
20793
21383
|
getPositionEntries: (backtest: boolean, symbol: string, context: {
|
|
20794
21384
|
strategyName: StrategyName;
|
|
20795
21385
|
exchangeName: ExchangeName;
|
|
@@ -20797,6 +21387,7 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
20797
21387
|
}) => Promise<{
|
|
20798
21388
|
price: number;
|
|
20799
21389
|
cost: number;
|
|
21390
|
+
timestamp: number;
|
|
20800
21391
|
}[]>;
|
|
20801
21392
|
/**
|
|
20802
21393
|
* Retrieves the currently active scheduled signal for the strategy.
|
|
@@ -22041,7 +22632,7 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
22041
22632
|
currentPrice: number;
|
|
22042
22633
|
costBasisAtClose: number;
|
|
22043
22634
|
entryCountAtClose: number;
|
|
22044
|
-
|
|
22635
|
+
timestamp: number;
|
|
22045
22636
|
}[]>;
|
|
22046
22637
|
getPositionEntries: (backtest: boolean, symbol: string, context: {
|
|
22047
22638
|
strategyName: StrategyName;
|
|
@@ -22050,6 +22641,7 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
22050
22641
|
}) => Promise<{
|
|
22051
22642
|
price: number;
|
|
22052
22643
|
cost: number;
|
|
22644
|
+
timestamp: number;
|
|
22053
22645
|
}[]>;
|
|
22054
22646
|
/**
|
|
22055
22647
|
* Retrieves the currently active scheduled signal for the symbol.
|
|
@@ -25068,6 +25660,8 @@ declare const backtest: {
|
|
|
25068
25660
|
riskGlobalService: RiskGlobalService;
|
|
25069
25661
|
partialGlobalService: PartialGlobalService;
|
|
25070
25662
|
breakevenGlobalService: BreakevenGlobalService;
|
|
25663
|
+
timeMetaService: TimeMetaService;
|
|
25664
|
+
priceMetaService: PriceMetaService;
|
|
25071
25665
|
exchangeCoreService: ExchangeCoreService;
|
|
25072
25666
|
strategyCoreService: StrategyCoreService;
|
|
25073
25667
|
actionCoreService: ActionCoreService;
|
|
@@ -25172,4 +25766,4 @@ declare const getTotalClosed: (signal: Signal) => {
|
|
|
25172
25766
|
remainingCostBasis: number;
|
|
25173
25767
|
};
|
|
25174
25768
|
|
|
25175
|
-
export { ActionBase, type ActivateScheduledCommit, type ActivateScheduledCommitNotification, type ActivePingContract, type AverageBuyCommit, type AverageBuyCommitNotification, Backtest, type BacktestStatisticsModel, Breakeven, type BreakevenAvailableNotification, type BreakevenCommit, type BreakevenCommitNotification, type BreakevenContract, type BreakevenData, Broker, type BrokerAverageBuyPayload, BrokerBase, type BrokerBreakevenPayload, type BrokerPartialLossPayload, type BrokerPartialProfitPayload, type BrokerSignalClosePayload, type BrokerSignalOpenPayload, type BrokerTrailingStopPayload, type BrokerTrailingTakePayload, Cache, type CancelScheduledCommit, type CandleData, type CandleInterval, type ClosePendingCommit, type ColumnConfig, type ColumnModel, Constant, type CriticalErrorNotification, type DoneContract, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, type IActionSchema, type IActivateScheduledCommitRow, type IAggregatedTradeData, type IBidData, type IBreakevenCommitRow, type IBroker, type ICandleData, type ICommitRow, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type ILog, type ILogEntry, type ILogger, type IMarkdownDumpOptions, type INotificationUtils, type IOrderBookData, type IPartialLossCommitRow, type IPartialProfitCommitRow, type IPersistBase, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicAction, type IPublicCandleData, type IPublicSignalRow, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskSignalRow, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, type IScheduledSignalRow, type ISignalDto, type ISignalRow, type ISizingCalculateParams, type ISizingCalculateParamsATR, type ISizingCalculateParamsFixedPercentage, type ISizingCalculateParamsKelly, type ISizingParams, type ISizingParamsATR, type ISizingParamsFixedPercentage, type ISizingParamsKelly, type ISizingSchema, type ISizingSchemaATR, type ISizingSchemaFixedPercentage, type ISizingSchemaKelly, type IStorageSignalRow, type IStorageUtils, type IStrategyPnL, type IStrategyResult, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IStrategyTickResultWaiting, type ITrailingStopCommitRow, type ITrailingTakeCommitRow, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, type InfoErrorNotification, Live, type LiveStatisticsModel, Log, type LogData, Markdown, MarkdownFileBase, MarkdownFolderBase, type MarkdownName, type MeasureData, MethodContextService, type MetricStats, Notification, NotificationBacktest, type NotificationData, NotificationLive, type NotificationModel, Partial$1 as Partial, type PartialData, type PartialEvent, type PartialLossAvailableNotification, type PartialLossCommit, type PartialLossCommitNotification, type PartialLossContract, type PartialProfitAvailableNotification, type PartialProfitCommit, type PartialProfitCommitNotification, type PartialProfitContract, type PartialStatisticsModel, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatisticsModel, PersistBase, PersistBreakevenAdapter, PersistCandleAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PersistStorageAdapter, PositionSize, type ProgressBacktestContract, type ProgressWalkerContract, Report, ReportBase, type ReportName, Risk, type RiskContract, type RiskData, type RiskEvent, type RiskRejectionNotification, type RiskStatisticsModel, Schedule, type ScheduleData, type SchedulePingContract, type ScheduleStatisticsModel, type ScheduledEvent, type SignalCancelledNotification, type SignalCloseContract, type SignalClosedNotification, type SignalData, type SignalInterval, type SignalOpenContract, type SignalOpenedNotification, type SignalScheduledNotification, type SignalSyncCloseNotification, type SignalSyncContract, type SignalSyncOpenNotification, Storage, StorageBacktest, type StorageData, StorageLive, Strategy, type StrategyActionType, type StrategyCancelReason, type StrategyCloseReason, type StrategyCommitContract, type StrategyEvent, type StrategyStatisticsModel, Sync, type SyncEvent, type SyncStatisticsModel, type TBrokerCtor, type TLogCtor, type TMarkdownBase, type TNotificationUtilsCtor, type TPersistBase, type TPersistBaseCtor, type TReportBase, type TStorageUtilsCtor, type TickEvent, type TrailingStopCommit, type TrailingStopCommitNotification, type TrailingTakeCommit, type TrailingTakeCommitNotification, type ValidationErrorNotification, Walker, type WalkerCompleteContract, type WalkerContract, type WalkerMetric, type SignalData$1 as WalkerSignalData, type WalkerStatisticsModel, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, dumpMessages, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionAveragePrice, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getRawCandles, getRiskSchema, getScheduledSignal, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasTradeContext, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, roundTicks, set, setColumns, setConfig, setLogger, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, waitForCandle, warmCandles };
|
|
25769
|
+
export { ActionBase, type ActivateScheduledCommit, type ActivateScheduledCommitNotification, type ActivePingContract, type AverageBuyCommit, type AverageBuyCommitNotification, Backtest, type BacktestStatisticsModel, Breakeven, type BreakevenAvailableNotification, type BreakevenCommit, type BreakevenCommitNotification, type BreakevenContract, type BreakevenData, Broker, type BrokerAverageBuyPayload, BrokerBase, type BrokerBreakevenPayload, type BrokerPartialLossPayload, type BrokerPartialProfitPayload, type BrokerSignalClosePayload, type BrokerSignalOpenPayload, type BrokerTrailingStopPayload, type BrokerTrailingTakePayload, Cache, type CancelScheduledCommit, type CandleData, type CandleInterval, type ClosePendingCommit, type ColumnConfig, type ColumnModel, Constant, type CriticalErrorNotification, type DoneContract, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, type IActionSchema, type IActivateScheduledCommitRow, type IAggregatedTradeData, type IBidData, type IBreakevenCommitRow, type IBroker, type ICandleData, type ICommitRow, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type ILog, type ILogEntry, type ILogger, type IMarkdownDumpOptions, type INotificationUtils, type IOrderBookData, type IPartialLossCommitRow, type IPartialProfitCommitRow, type IPersistBase, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicAction, type IPublicCandleData, type IPublicSignalRow, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskSignalRow, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, type IScheduledSignalRow, type ISignalDto, type ISignalRow, type ISizingCalculateParams, type ISizingCalculateParamsATR, type ISizingCalculateParamsFixedPercentage, type ISizingCalculateParamsKelly, type ISizingParams, type ISizingParamsATR, type ISizingParamsFixedPercentage, type ISizingParamsKelly, type ISizingSchema, type ISizingSchemaATR, type ISizingSchemaFixedPercentage, type ISizingSchemaKelly, type IStorageSignalRow, type IStorageUtils, type IStrategyPnL, type IStrategyResult, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IStrategyTickResultWaiting, type ITrailingStopCommitRow, type ITrailingTakeCommitRow, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, type InfoErrorNotification, Live, type LiveStatisticsModel, Log, type LogData, Markdown, MarkdownFileBase, MarkdownFolderBase, type MarkdownName, type MeasureData, MethodContextService, type MetricStats, Notification, NotificationBacktest, type NotificationData, NotificationLive, type NotificationModel, Partial$1 as Partial, type PartialData, type PartialEvent, type PartialLossAvailableNotification, type PartialLossCommit, type PartialLossCommitNotification, type PartialLossContract, type PartialProfitAvailableNotification, type PartialProfitCommit, type PartialProfitCommitNotification, type PartialProfitContract, type PartialStatisticsModel, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatisticsModel, PersistBase, PersistBreakevenAdapter, PersistCandleAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PersistStorageAdapter, PositionSize, type ProgressBacktestContract, type ProgressWalkerContract, Report, ReportBase, type ReportName, Risk, type RiskContract, type RiskData, type RiskEvent, type RiskRejectionNotification, type RiskStatisticsModel, Schedule, type ScheduleData, type SchedulePingContract, type ScheduleStatisticsModel, type ScheduledEvent, type SignalCancelledNotification, type SignalCloseContract, type SignalClosedNotification, type SignalData, type SignalInterval, type SignalOpenContract, type SignalOpenedNotification, type SignalScheduledNotification, type SignalSyncCloseNotification, type SignalSyncContract, type SignalSyncOpenNotification, Storage, StorageBacktest, type StorageData, StorageLive, Strategy, type StrategyActionType, type StrategyCancelReason, type StrategyCloseReason, type StrategyCommitContract, type StrategyEvent, type StrategyStatisticsModel, Sync, type SyncEvent, type SyncStatisticsModel, type TBrokerCtor, type TLogCtor, type TMarkdownBase, type TNotificationUtilsCtor, type TPersistBase, type TPersistBaseCtor, type TReportBase, type TStorageUtilsCtor, type TickEvent, type TrailingStopCommit, type TrailingStopCommitNotification, type TrailingTakeCommit, type TrailingTakeCommitNotification, type ValidationErrorNotification, Walker, type WalkerCompleteContract, type WalkerContract, type WalkerMetric, type SignalData$1 as WalkerSignalData, type WalkerStatisticsModel, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, dumpMessages, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionAveragePrice, getPositionEntryOverlap, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionPartialOverlap, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getRawCandles, getRiskSchema, getScheduledSignal, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasTradeContext, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, roundTicks, set, setColumns, setConfig, setLogger, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, waitForCandle, warmCandles };
|