backtest-kit 5.6.3 → 5.6.5
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 +260 -0
- package/build/index.mjs +259 -1
- package/package.json +1 -1
- package/types.d.ts +160 -1
package/build/index.cjs
CHANGED
|
@@ -6475,6 +6475,18 @@ class ClientStrategy {
|
|
|
6475
6475
|
});
|
|
6476
6476
|
return this._pendingSignal !== null;
|
|
6477
6477
|
}
|
|
6478
|
+
/**
|
|
6479
|
+
* Checks if there is a scheduled signal.
|
|
6480
|
+
*
|
|
6481
|
+
* @param symbol - Trading symbol to check for scheduled signal
|
|
6482
|
+
* @returns Promise resolving to true if a scheduled signal exists, false otherwise
|
|
6483
|
+
*/
|
|
6484
|
+
async hasScheduledSignal(symbol) {
|
|
6485
|
+
this.params.logger.debug("ClientStrategy hasScheduledSignal", {
|
|
6486
|
+
symbol,
|
|
6487
|
+
});
|
|
6488
|
+
return this._scheduledSignal !== null;
|
|
6489
|
+
}
|
|
6478
6490
|
/**
|
|
6479
6491
|
* Updates pending signal and persists to disk in live mode.
|
|
6480
6492
|
*
|
|
@@ -10034,6 +10046,22 @@ class StrategyConnectionService {
|
|
|
10034
10046
|
const strategy = this.getStrategy(symbol, context.strategyName, context.exchangeName, context.frameName, backtest);
|
|
10035
10047
|
return await strategy.hasPendingSignal(symbol);
|
|
10036
10048
|
};
|
|
10049
|
+
/**
|
|
10050
|
+
* Checks if there is an active scheduled signal for the strategy.
|
|
10051
|
+
* Delegates to ClientStrategy.hasScheduledSignal() which checks if there is a waiting position signal
|
|
10052
|
+
* @param backtest - Whether running in backtest mode
|
|
10053
|
+
* @param symbol - Trading pair symbol
|
|
10054
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
10055
|
+
* @returns Promise resolving to true if there is a waiting scheduled signal, false otherwise
|
|
10056
|
+
*/
|
|
10057
|
+
this.hasScheduledSignal = async (backtest, symbol, context) => {
|
|
10058
|
+
this.loggerService.log("strategyConnectionService hasScheduledSignal", {
|
|
10059
|
+
symbol,
|
|
10060
|
+
context,
|
|
10061
|
+
});
|
|
10062
|
+
const strategy = this.getStrategy(symbol, context.strategyName, context.exchangeName, context.frameName, backtest);
|
|
10063
|
+
return await strategy.hasScheduledSignal(symbol);
|
|
10064
|
+
};
|
|
10037
10065
|
/**
|
|
10038
10066
|
* Returns the original estimated duration for the current pending signal.
|
|
10039
10067
|
*
|
|
@@ -14385,6 +14413,24 @@ class StrategyCoreService {
|
|
|
14385
14413
|
await this.validate(context);
|
|
14386
14414
|
return await this.strategyConnectionService.hasPendingSignal(backtest, symbol, context);
|
|
14387
14415
|
};
|
|
14416
|
+
/**
|
|
14417
|
+
* Checks if there is a waiting scheduled signal for the symbol.
|
|
14418
|
+
* Validates strategy existence and delegates to connection service
|
|
14419
|
+
* to check if a scheduled signal exists for the symbol.
|
|
14420
|
+
* Does not require execution context as this is a state query operation.
|
|
14421
|
+
* @param backtest - Whether running in backtest mode
|
|
14422
|
+
* @param symbol - Trading pair symbol
|
|
14423
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
14424
|
+
* @returns Promise<boolean> - true if scheduled signal exists, false otherwise
|
|
14425
|
+
*/
|
|
14426
|
+
this.hasScheduledSignal = async (backtest, symbol, context) => {
|
|
14427
|
+
this.loggerService.log("strategyCoreService hasScheduledSignal", {
|
|
14428
|
+
symbol,
|
|
14429
|
+
context,
|
|
14430
|
+
});
|
|
14431
|
+
await this.validate(context);
|
|
14432
|
+
return await this.strategyConnectionService.hasScheduledSignal(backtest, symbol, context);
|
|
14433
|
+
};
|
|
14388
14434
|
/**
|
|
14389
14435
|
* Returns the original estimated duration for the current pending signal.
|
|
14390
14436
|
*
|
|
@@ -33272,6 +33318,8 @@ const GET_POSITION_HIGHEST_PROFIT_BREAKEVEN_METHOD_NAME = "strategy.getPositionH
|
|
|
33272
33318
|
const GET_POSITION_DRAWDOWN_MINUTES_METHOD_NAME = "strategy.getPositionDrawdownMinutes";
|
|
33273
33319
|
const GET_POSITION_ENTRY_OVERLAP_METHOD_NAME = "strategy.getPositionEntryOverlap";
|
|
33274
33320
|
const GET_POSITION_PARTIAL_OVERLAP_METHOD_NAME = "strategy.getPositionPartialOverlap";
|
|
33321
|
+
const HAS_NO_PENDING_SIGNAL_METHOD_NAME = "strategy.hasNoPendingSignal";
|
|
33322
|
+
const HAS_NO_SCHEDULED_SIGNAL_METHOD_NAME = "strategy.hasNoScheduledSignal";
|
|
33275
33323
|
/**
|
|
33276
33324
|
* Cancels the scheduled signal without stopping the strategy.
|
|
33277
33325
|
*
|
|
@@ -34825,6 +34873,68 @@ async function getPositionPartialOverlap(symbol, currentPrice, ladder = POSITION
|
|
|
34825
34873
|
return currentPrice >= partial.currentPrice - lowerStep && currentPrice <= partial.currentPrice + upperStep;
|
|
34826
34874
|
});
|
|
34827
34875
|
}
|
|
34876
|
+
/**
|
|
34877
|
+
* Returns true if there is NO active pending signal for the given symbol.
|
|
34878
|
+
*
|
|
34879
|
+
* Inverse of hasPendingSignal. Use to guard signal generation logic.
|
|
34880
|
+
*
|
|
34881
|
+
* Automatically detects backtest/live mode from execution context.
|
|
34882
|
+
*
|
|
34883
|
+
* @param symbol - Trading pair symbol
|
|
34884
|
+
* @returns Promise<boolean> - true if no pending signal exists, false if one does
|
|
34885
|
+
*
|
|
34886
|
+
* @example
|
|
34887
|
+
* ```typescript
|
|
34888
|
+
* import { hasNoPendingSignal } from "backtest-kit";
|
|
34889
|
+
*
|
|
34890
|
+
* if (await hasNoPendingSignal("BTCUSDT")) {
|
|
34891
|
+
* // safe to open a new position
|
|
34892
|
+
* }
|
|
34893
|
+
* ```
|
|
34894
|
+
*/
|
|
34895
|
+
async function hasNoPendingSignal(symbol) {
|
|
34896
|
+
bt.loggerService.info(HAS_NO_PENDING_SIGNAL_METHOD_NAME, { symbol });
|
|
34897
|
+
if (!ExecutionContextService.hasContext()) {
|
|
34898
|
+
throw new Error("hasNoPendingSignal requires an execution context");
|
|
34899
|
+
}
|
|
34900
|
+
if (!MethodContextService.hasContext()) {
|
|
34901
|
+
throw new Error("hasNoPendingSignal requires a method context");
|
|
34902
|
+
}
|
|
34903
|
+
const { backtest: isBacktest } = bt.executionContextService.context;
|
|
34904
|
+
const { exchangeName, frameName, strategyName } = bt.methodContextService.context;
|
|
34905
|
+
return await functoolsKit.not(bt.strategyCoreService.hasPendingSignal(isBacktest, symbol, { exchangeName, frameName, strategyName }));
|
|
34906
|
+
}
|
|
34907
|
+
/**
|
|
34908
|
+
* Returns true if there is NO active scheduled signal for the given symbol.
|
|
34909
|
+
*
|
|
34910
|
+
* Inverse of hasScheduledSignal. Use to guard signal generation logic.
|
|
34911
|
+
*
|
|
34912
|
+
* Automatically detects backtest/live mode from execution context.
|
|
34913
|
+
*
|
|
34914
|
+
* @param symbol - Trading pair symbol
|
|
34915
|
+
* @returns Promise<boolean> - true if no scheduled signal exists, false if one does
|
|
34916
|
+
*
|
|
34917
|
+
* @example
|
|
34918
|
+
* ```typescript
|
|
34919
|
+
* import { hasNoScheduledSignal } from "backtest-kit";
|
|
34920
|
+
*
|
|
34921
|
+
* if (await hasNoScheduledSignal("BTCUSDT")) {
|
|
34922
|
+
* // safe to schedule a new signal
|
|
34923
|
+
* }
|
|
34924
|
+
* ```
|
|
34925
|
+
*/
|
|
34926
|
+
async function hasNoScheduledSignal(symbol) {
|
|
34927
|
+
bt.loggerService.info(HAS_NO_SCHEDULED_SIGNAL_METHOD_NAME, { symbol });
|
|
34928
|
+
if (!ExecutionContextService.hasContext()) {
|
|
34929
|
+
throw new Error("hasNoScheduledSignal requires an execution context");
|
|
34930
|
+
}
|
|
34931
|
+
if (!MethodContextService.hasContext()) {
|
|
34932
|
+
throw new Error("hasNoScheduledSignal requires a method context");
|
|
34933
|
+
}
|
|
34934
|
+
const { backtest: isBacktest } = bt.executionContextService.context;
|
|
34935
|
+
const { exchangeName, frameName, strategyName } = bt.methodContextService.context;
|
|
34936
|
+
return await functoolsKit.not(bt.strategyCoreService.hasScheduledSignal(isBacktest, symbol, { exchangeName, frameName, strategyName }));
|
|
34937
|
+
}
|
|
34828
34938
|
|
|
34829
34939
|
const STOP_STRATEGY_METHOD_NAME = "control.stopStrategy";
|
|
34830
34940
|
/**
|
|
@@ -36118,6 +36228,8 @@ const BACKTEST_METHOD_NAME_TRAILING_PROFIT_COST = "BacktestUtils.commitTrailingT
|
|
|
36118
36228
|
const BACKTEST_METHOD_NAME_ACTIVATE_SCHEDULED = "Backtest.commitActivateScheduled";
|
|
36119
36229
|
const BACKTEST_METHOD_NAME_AVERAGE_BUY = "Backtest.commitAverageBuy";
|
|
36120
36230
|
const BACKTEST_METHOD_NAME_GET_DATA = "BacktestUtils.getData";
|
|
36231
|
+
const BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL = "BacktestUtils.hasNoPendingSignal";
|
|
36232
|
+
const BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL = "BacktestUtils.hasNoScheduledSignal";
|
|
36121
36233
|
/**
|
|
36122
36234
|
* Internal task function that runs backtest and handles completion.
|
|
36123
36235
|
* Consumes backtest results and updates instance state flags.
|
|
@@ -36621,6 +36733,74 @@ class BacktestUtils {
|
|
|
36621
36733
|
}
|
|
36622
36734
|
return await bt.strategyCoreService.getScheduledSignal(true, symbol, currentPrice, context);
|
|
36623
36735
|
};
|
|
36736
|
+
/**
|
|
36737
|
+
* Returns true if there is NO active pending signal for the given symbol.
|
|
36738
|
+
*
|
|
36739
|
+
* Inverse of strategyCoreService.hasPendingSignal. Use to guard signal generation logic.
|
|
36740
|
+
*
|
|
36741
|
+
* @param symbol - Trading pair symbol
|
|
36742
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
36743
|
+
* @returns Promise<boolean> - true if no pending signal exists, false if one does
|
|
36744
|
+
*
|
|
36745
|
+
* @example
|
|
36746
|
+
* ```typescript
|
|
36747
|
+
* if (await Backtest.hasNoPendingSignal("BTCUSDT", { strategyName, exchangeName, frameName })) {
|
|
36748
|
+
* // safe to open a new position
|
|
36749
|
+
* }
|
|
36750
|
+
* ```
|
|
36751
|
+
*/
|
|
36752
|
+
this.hasNoPendingSignal = async (symbol, context) => {
|
|
36753
|
+
bt.loggerService.info(BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL, {
|
|
36754
|
+
symbol,
|
|
36755
|
+
context,
|
|
36756
|
+
});
|
|
36757
|
+
bt.strategyValidationService.validate(context.strategyName, BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL);
|
|
36758
|
+
bt.exchangeValidationService.validate(context.exchangeName, BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL);
|
|
36759
|
+
{
|
|
36760
|
+
const { riskName, riskList, actions } = bt.strategySchemaService.get(context.strategyName);
|
|
36761
|
+
riskName &&
|
|
36762
|
+
bt.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL);
|
|
36763
|
+
riskList &&
|
|
36764
|
+
riskList.forEach((riskName) => bt.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL));
|
|
36765
|
+
actions &&
|
|
36766
|
+
actions.forEach((actionName) => bt.actionValidationService.validate(actionName, BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL));
|
|
36767
|
+
}
|
|
36768
|
+
return await functoolsKit.not(bt.strategyCoreService.hasPendingSignal(true, symbol, context));
|
|
36769
|
+
};
|
|
36770
|
+
/**
|
|
36771
|
+
* Returns true if there is NO active scheduled signal for the given symbol.
|
|
36772
|
+
*
|
|
36773
|
+
* Inverse of strategyCoreService.hasScheduledSignal. Use to guard signal generation logic.
|
|
36774
|
+
*
|
|
36775
|
+
* @param symbol - Trading pair symbol
|
|
36776
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
36777
|
+
* @returns Promise<boolean> - true if no scheduled signal exists, false if one does
|
|
36778
|
+
*
|
|
36779
|
+
* @example
|
|
36780
|
+
* ```typescript
|
|
36781
|
+
* if (await Backtest.hasNoScheduledSignal("BTCUSDT", { strategyName, exchangeName, frameName })) {
|
|
36782
|
+
* // safe to schedule a new signal
|
|
36783
|
+
* }
|
|
36784
|
+
* ```
|
|
36785
|
+
*/
|
|
36786
|
+
this.hasNoScheduledSignal = async (symbol, context) => {
|
|
36787
|
+
bt.loggerService.info(BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL, {
|
|
36788
|
+
symbol,
|
|
36789
|
+
context,
|
|
36790
|
+
});
|
|
36791
|
+
bt.strategyValidationService.validate(context.strategyName, BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL);
|
|
36792
|
+
bt.exchangeValidationService.validate(context.exchangeName, BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL);
|
|
36793
|
+
{
|
|
36794
|
+
const { riskName, riskList, actions } = bt.strategySchemaService.get(context.strategyName);
|
|
36795
|
+
riskName &&
|
|
36796
|
+
bt.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL);
|
|
36797
|
+
riskList &&
|
|
36798
|
+
riskList.forEach((riskName) => bt.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL));
|
|
36799
|
+
actions &&
|
|
36800
|
+
actions.forEach((actionName) => bt.actionValidationService.validate(actionName, BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL));
|
|
36801
|
+
}
|
|
36802
|
+
return await functoolsKit.not(bt.strategyCoreService.hasScheduledSignal(true, symbol, context));
|
|
36803
|
+
};
|
|
36624
36804
|
/**
|
|
36625
36805
|
* Checks if breakeven threshold has been reached for the current pending signal.
|
|
36626
36806
|
*
|
|
@@ -38266,6 +38446,8 @@ const LIVE_METHOD_NAME_TRAILING_STOP_COST = "LiveUtils.commitTrailingStopCost";
|
|
|
38266
38446
|
const LIVE_METHOD_NAME_TRAILING_PROFIT_COST = "LiveUtils.commitTrailingTakeCost";
|
|
38267
38447
|
const LIVE_METHOD_NAME_ACTIVATE_SCHEDULED = "Live.commitActivateScheduled";
|
|
38268
38448
|
const LIVE_METHOD_NAME_AVERAGE_BUY = "Live.commitAverageBuy";
|
|
38449
|
+
const LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL = "LiveUtils.hasNoPendingSignal";
|
|
38450
|
+
const LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL = "LiveUtils.hasNoScheduledSignal";
|
|
38269
38451
|
/**
|
|
38270
38452
|
* Internal task function that runs live trading and handles completion.
|
|
38271
38453
|
* Consumes live trading results and updates instance state flags.
|
|
@@ -38798,6 +38980,82 @@ class LiveUtils {
|
|
|
38798
38980
|
frameName: "",
|
|
38799
38981
|
});
|
|
38800
38982
|
};
|
|
38983
|
+
/**
|
|
38984
|
+
* Returns true if there is NO active pending signal for the given symbol.
|
|
38985
|
+
*
|
|
38986
|
+
* Inverse of strategyCoreService.hasPendingSignal. Use to guard signal generation logic.
|
|
38987
|
+
*
|
|
38988
|
+
* @param symbol - Trading pair symbol
|
|
38989
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
38990
|
+
* @returns Promise<boolean> - true if no pending signal exists, false if one does
|
|
38991
|
+
*
|
|
38992
|
+
* @example
|
|
38993
|
+
* ```typescript
|
|
38994
|
+
* if (await Live.hasNoPendingSignal("BTCUSDT", { strategyName, exchangeName })) {
|
|
38995
|
+
* // safe to open a new position
|
|
38996
|
+
* }
|
|
38997
|
+
* ```
|
|
38998
|
+
*/
|
|
38999
|
+
this.hasNoPendingSignal = async (symbol, context) => {
|
|
39000
|
+
bt.loggerService.info(LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL, {
|
|
39001
|
+
symbol,
|
|
39002
|
+
context,
|
|
39003
|
+
});
|
|
39004
|
+
bt.strategyValidationService.validate(context.strategyName, LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL);
|
|
39005
|
+
bt.exchangeValidationService.validate(context.exchangeName, LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL);
|
|
39006
|
+
{
|
|
39007
|
+
const { riskName, riskList, actions } = bt.strategySchemaService.get(context.strategyName);
|
|
39008
|
+
riskName &&
|
|
39009
|
+
bt.riskValidationService.validate(riskName, LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL);
|
|
39010
|
+
riskList &&
|
|
39011
|
+
riskList.forEach((riskName) => bt.riskValidationService.validate(riskName, LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL));
|
|
39012
|
+
actions &&
|
|
39013
|
+
actions.forEach((actionName) => bt.actionValidationService.validate(actionName, LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL));
|
|
39014
|
+
}
|
|
39015
|
+
return await functoolsKit.not(bt.strategyCoreService.hasPendingSignal(false, symbol, {
|
|
39016
|
+
strategyName: context.strategyName,
|
|
39017
|
+
exchangeName: context.exchangeName,
|
|
39018
|
+
frameName: "",
|
|
39019
|
+
}));
|
|
39020
|
+
};
|
|
39021
|
+
/**
|
|
39022
|
+
* Returns true if there is NO active scheduled signal for the given symbol.
|
|
39023
|
+
*
|
|
39024
|
+
* Inverse of strategyCoreService.hasScheduledSignal. Use to guard signal generation logic.
|
|
39025
|
+
*
|
|
39026
|
+
* @param symbol - Trading pair symbol
|
|
39027
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
39028
|
+
* @returns Promise<boolean> - true if no scheduled signal exists, false if one does
|
|
39029
|
+
*
|
|
39030
|
+
* @example
|
|
39031
|
+
* ```typescript
|
|
39032
|
+
* if (await Live.hasNoScheduledSignal("BTCUSDT", { strategyName, exchangeName })) {
|
|
39033
|
+
* // safe to schedule a new signal
|
|
39034
|
+
* }
|
|
39035
|
+
* ```
|
|
39036
|
+
*/
|
|
39037
|
+
this.hasNoScheduledSignal = async (symbol, context) => {
|
|
39038
|
+
bt.loggerService.info(LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL, {
|
|
39039
|
+
symbol,
|
|
39040
|
+
context,
|
|
39041
|
+
});
|
|
39042
|
+
bt.strategyValidationService.validate(context.strategyName, LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL);
|
|
39043
|
+
bt.exchangeValidationService.validate(context.exchangeName, LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL);
|
|
39044
|
+
{
|
|
39045
|
+
const { riskName, riskList, actions } = bt.strategySchemaService.get(context.strategyName);
|
|
39046
|
+
riskName &&
|
|
39047
|
+
bt.riskValidationService.validate(riskName, LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL);
|
|
39048
|
+
riskList &&
|
|
39049
|
+
riskList.forEach((riskName) => bt.riskValidationService.validate(riskName, LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL));
|
|
39050
|
+
actions &&
|
|
39051
|
+
actions.forEach((actionName) => bt.actionValidationService.validate(actionName, LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL));
|
|
39052
|
+
}
|
|
39053
|
+
return await functoolsKit.not(bt.strategyCoreService.hasScheduledSignal(false, symbol, {
|
|
39054
|
+
strategyName: context.strategyName,
|
|
39055
|
+
exchangeName: context.exchangeName,
|
|
39056
|
+
frameName: "",
|
|
39057
|
+
}));
|
|
39058
|
+
};
|
|
38801
39059
|
/**
|
|
38802
39060
|
* Checks if breakeven threshold has been reached for the current pending signal.
|
|
38803
39061
|
*
|
|
@@ -48449,6 +48707,8 @@ exports.getTotalClosed = getTotalClosed;
|
|
|
48449
48707
|
exports.getTotalCostClosed = getTotalCostClosed;
|
|
48450
48708
|
exports.getTotalPercentClosed = getTotalPercentClosed;
|
|
48451
48709
|
exports.getWalkerSchema = getWalkerSchema;
|
|
48710
|
+
exports.hasNoPendingSignal = hasNoPendingSignal;
|
|
48711
|
+
exports.hasNoScheduledSignal = hasNoScheduledSignal;
|
|
48452
48712
|
exports.hasTradeContext = hasTradeContext;
|
|
48453
48713
|
exports.investedCostToPercent = investedCostToPercent;
|
|
48454
48714
|
exports.lib = backtest;
|
package/build/index.mjs
CHANGED
|
@@ -6455,6 +6455,18 @@ class ClientStrategy {
|
|
|
6455
6455
|
});
|
|
6456
6456
|
return this._pendingSignal !== null;
|
|
6457
6457
|
}
|
|
6458
|
+
/**
|
|
6459
|
+
* Checks if there is a scheduled signal.
|
|
6460
|
+
*
|
|
6461
|
+
* @param symbol - Trading symbol to check for scheduled signal
|
|
6462
|
+
* @returns Promise resolving to true if a scheduled signal exists, false otherwise
|
|
6463
|
+
*/
|
|
6464
|
+
async hasScheduledSignal(symbol) {
|
|
6465
|
+
this.params.logger.debug("ClientStrategy hasScheduledSignal", {
|
|
6466
|
+
symbol,
|
|
6467
|
+
});
|
|
6468
|
+
return this._scheduledSignal !== null;
|
|
6469
|
+
}
|
|
6458
6470
|
/**
|
|
6459
6471
|
* Updates pending signal and persists to disk in live mode.
|
|
6460
6472
|
*
|
|
@@ -10014,6 +10026,22 @@ class StrategyConnectionService {
|
|
|
10014
10026
|
const strategy = this.getStrategy(symbol, context.strategyName, context.exchangeName, context.frameName, backtest);
|
|
10015
10027
|
return await strategy.hasPendingSignal(symbol);
|
|
10016
10028
|
};
|
|
10029
|
+
/**
|
|
10030
|
+
* Checks if there is an active scheduled signal for the strategy.
|
|
10031
|
+
* Delegates to ClientStrategy.hasScheduledSignal() which checks if there is a waiting position signal
|
|
10032
|
+
* @param backtest - Whether running in backtest mode
|
|
10033
|
+
* @param symbol - Trading pair symbol
|
|
10034
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
10035
|
+
* @returns Promise resolving to true if there is a waiting scheduled signal, false otherwise
|
|
10036
|
+
*/
|
|
10037
|
+
this.hasScheduledSignal = async (backtest, symbol, context) => {
|
|
10038
|
+
this.loggerService.log("strategyConnectionService hasScheduledSignal", {
|
|
10039
|
+
symbol,
|
|
10040
|
+
context,
|
|
10041
|
+
});
|
|
10042
|
+
const strategy = this.getStrategy(symbol, context.strategyName, context.exchangeName, context.frameName, backtest);
|
|
10043
|
+
return await strategy.hasScheduledSignal(symbol);
|
|
10044
|
+
};
|
|
10017
10045
|
/**
|
|
10018
10046
|
* Returns the original estimated duration for the current pending signal.
|
|
10019
10047
|
*
|
|
@@ -14365,6 +14393,24 @@ class StrategyCoreService {
|
|
|
14365
14393
|
await this.validate(context);
|
|
14366
14394
|
return await this.strategyConnectionService.hasPendingSignal(backtest, symbol, context);
|
|
14367
14395
|
};
|
|
14396
|
+
/**
|
|
14397
|
+
* Checks if there is a waiting scheduled signal for the symbol.
|
|
14398
|
+
* Validates strategy existence and delegates to connection service
|
|
14399
|
+
* to check if a scheduled signal exists for the symbol.
|
|
14400
|
+
* Does not require execution context as this is a state query operation.
|
|
14401
|
+
* @param backtest - Whether running in backtest mode
|
|
14402
|
+
* @param symbol - Trading pair symbol
|
|
14403
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
14404
|
+
* @returns Promise<boolean> - true if scheduled signal exists, false otherwise
|
|
14405
|
+
*/
|
|
14406
|
+
this.hasScheduledSignal = async (backtest, symbol, context) => {
|
|
14407
|
+
this.loggerService.log("strategyCoreService hasScheduledSignal", {
|
|
14408
|
+
symbol,
|
|
14409
|
+
context,
|
|
14410
|
+
});
|
|
14411
|
+
await this.validate(context);
|
|
14412
|
+
return await this.strategyConnectionService.hasScheduledSignal(backtest, symbol, context);
|
|
14413
|
+
};
|
|
14368
14414
|
/**
|
|
14369
14415
|
* Returns the original estimated duration for the current pending signal.
|
|
14370
14416
|
*
|
|
@@ -33252,6 +33298,8 @@ const GET_POSITION_HIGHEST_PROFIT_BREAKEVEN_METHOD_NAME = "strategy.getPositionH
|
|
|
33252
33298
|
const GET_POSITION_DRAWDOWN_MINUTES_METHOD_NAME = "strategy.getPositionDrawdownMinutes";
|
|
33253
33299
|
const GET_POSITION_ENTRY_OVERLAP_METHOD_NAME = "strategy.getPositionEntryOverlap";
|
|
33254
33300
|
const GET_POSITION_PARTIAL_OVERLAP_METHOD_NAME = "strategy.getPositionPartialOverlap";
|
|
33301
|
+
const HAS_NO_PENDING_SIGNAL_METHOD_NAME = "strategy.hasNoPendingSignal";
|
|
33302
|
+
const HAS_NO_SCHEDULED_SIGNAL_METHOD_NAME = "strategy.hasNoScheduledSignal";
|
|
33255
33303
|
/**
|
|
33256
33304
|
* Cancels the scheduled signal without stopping the strategy.
|
|
33257
33305
|
*
|
|
@@ -34805,6 +34853,68 @@ async function getPositionPartialOverlap(symbol, currentPrice, ladder = POSITION
|
|
|
34805
34853
|
return currentPrice >= partial.currentPrice - lowerStep && currentPrice <= partial.currentPrice + upperStep;
|
|
34806
34854
|
});
|
|
34807
34855
|
}
|
|
34856
|
+
/**
|
|
34857
|
+
* Returns true if there is NO active pending signal for the given symbol.
|
|
34858
|
+
*
|
|
34859
|
+
* Inverse of hasPendingSignal. Use to guard signal generation logic.
|
|
34860
|
+
*
|
|
34861
|
+
* Automatically detects backtest/live mode from execution context.
|
|
34862
|
+
*
|
|
34863
|
+
* @param symbol - Trading pair symbol
|
|
34864
|
+
* @returns Promise<boolean> - true if no pending signal exists, false if one does
|
|
34865
|
+
*
|
|
34866
|
+
* @example
|
|
34867
|
+
* ```typescript
|
|
34868
|
+
* import { hasNoPendingSignal } from "backtest-kit";
|
|
34869
|
+
*
|
|
34870
|
+
* if (await hasNoPendingSignal("BTCUSDT")) {
|
|
34871
|
+
* // safe to open a new position
|
|
34872
|
+
* }
|
|
34873
|
+
* ```
|
|
34874
|
+
*/
|
|
34875
|
+
async function hasNoPendingSignal(symbol) {
|
|
34876
|
+
bt.loggerService.info(HAS_NO_PENDING_SIGNAL_METHOD_NAME, { symbol });
|
|
34877
|
+
if (!ExecutionContextService.hasContext()) {
|
|
34878
|
+
throw new Error("hasNoPendingSignal requires an execution context");
|
|
34879
|
+
}
|
|
34880
|
+
if (!MethodContextService.hasContext()) {
|
|
34881
|
+
throw new Error("hasNoPendingSignal requires a method context");
|
|
34882
|
+
}
|
|
34883
|
+
const { backtest: isBacktest } = bt.executionContextService.context;
|
|
34884
|
+
const { exchangeName, frameName, strategyName } = bt.methodContextService.context;
|
|
34885
|
+
return await not(bt.strategyCoreService.hasPendingSignal(isBacktest, symbol, { exchangeName, frameName, strategyName }));
|
|
34886
|
+
}
|
|
34887
|
+
/**
|
|
34888
|
+
* Returns true if there is NO active scheduled signal for the given symbol.
|
|
34889
|
+
*
|
|
34890
|
+
* Inverse of hasScheduledSignal. Use to guard signal generation logic.
|
|
34891
|
+
*
|
|
34892
|
+
* Automatically detects backtest/live mode from execution context.
|
|
34893
|
+
*
|
|
34894
|
+
* @param symbol - Trading pair symbol
|
|
34895
|
+
* @returns Promise<boolean> - true if no scheduled signal exists, false if one does
|
|
34896
|
+
*
|
|
34897
|
+
* @example
|
|
34898
|
+
* ```typescript
|
|
34899
|
+
* import { hasNoScheduledSignal } from "backtest-kit";
|
|
34900
|
+
*
|
|
34901
|
+
* if (await hasNoScheduledSignal("BTCUSDT")) {
|
|
34902
|
+
* // safe to schedule a new signal
|
|
34903
|
+
* }
|
|
34904
|
+
* ```
|
|
34905
|
+
*/
|
|
34906
|
+
async function hasNoScheduledSignal(symbol) {
|
|
34907
|
+
bt.loggerService.info(HAS_NO_SCHEDULED_SIGNAL_METHOD_NAME, { symbol });
|
|
34908
|
+
if (!ExecutionContextService.hasContext()) {
|
|
34909
|
+
throw new Error("hasNoScheduledSignal requires an execution context");
|
|
34910
|
+
}
|
|
34911
|
+
if (!MethodContextService.hasContext()) {
|
|
34912
|
+
throw new Error("hasNoScheduledSignal requires a method context");
|
|
34913
|
+
}
|
|
34914
|
+
const { backtest: isBacktest } = bt.executionContextService.context;
|
|
34915
|
+
const { exchangeName, frameName, strategyName } = bt.methodContextService.context;
|
|
34916
|
+
return await not(bt.strategyCoreService.hasScheduledSignal(isBacktest, symbol, { exchangeName, frameName, strategyName }));
|
|
34917
|
+
}
|
|
34808
34918
|
|
|
34809
34919
|
const STOP_STRATEGY_METHOD_NAME = "control.stopStrategy";
|
|
34810
34920
|
/**
|
|
@@ -36098,6 +36208,8 @@ const BACKTEST_METHOD_NAME_TRAILING_PROFIT_COST = "BacktestUtils.commitTrailingT
|
|
|
36098
36208
|
const BACKTEST_METHOD_NAME_ACTIVATE_SCHEDULED = "Backtest.commitActivateScheduled";
|
|
36099
36209
|
const BACKTEST_METHOD_NAME_AVERAGE_BUY = "Backtest.commitAverageBuy";
|
|
36100
36210
|
const BACKTEST_METHOD_NAME_GET_DATA = "BacktestUtils.getData";
|
|
36211
|
+
const BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL = "BacktestUtils.hasNoPendingSignal";
|
|
36212
|
+
const BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL = "BacktestUtils.hasNoScheduledSignal";
|
|
36101
36213
|
/**
|
|
36102
36214
|
* Internal task function that runs backtest and handles completion.
|
|
36103
36215
|
* Consumes backtest results and updates instance state flags.
|
|
@@ -36601,6 +36713,74 @@ class BacktestUtils {
|
|
|
36601
36713
|
}
|
|
36602
36714
|
return await bt.strategyCoreService.getScheduledSignal(true, symbol, currentPrice, context);
|
|
36603
36715
|
};
|
|
36716
|
+
/**
|
|
36717
|
+
* Returns true if there is NO active pending signal for the given symbol.
|
|
36718
|
+
*
|
|
36719
|
+
* Inverse of strategyCoreService.hasPendingSignal. Use to guard signal generation logic.
|
|
36720
|
+
*
|
|
36721
|
+
* @param symbol - Trading pair symbol
|
|
36722
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
36723
|
+
* @returns Promise<boolean> - true if no pending signal exists, false if one does
|
|
36724
|
+
*
|
|
36725
|
+
* @example
|
|
36726
|
+
* ```typescript
|
|
36727
|
+
* if (await Backtest.hasNoPendingSignal("BTCUSDT", { strategyName, exchangeName, frameName })) {
|
|
36728
|
+
* // safe to open a new position
|
|
36729
|
+
* }
|
|
36730
|
+
* ```
|
|
36731
|
+
*/
|
|
36732
|
+
this.hasNoPendingSignal = async (symbol, context) => {
|
|
36733
|
+
bt.loggerService.info(BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL, {
|
|
36734
|
+
symbol,
|
|
36735
|
+
context,
|
|
36736
|
+
});
|
|
36737
|
+
bt.strategyValidationService.validate(context.strategyName, BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL);
|
|
36738
|
+
bt.exchangeValidationService.validate(context.exchangeName, BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL);
|
|
36739
|
+
{
|
|
36740
|
+
const { riskName, riskList, actions } = bt.strategySchemaService.get(context.strategyName);
|
|
36741
|
+
riskName &&
|
|
36742
|
+
bt.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL);
|
|
36743
|
+
riskList &&
|
|
36744
|
+
riskList.forEach((riskName) => bt.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL));
|
|
36745
|
+
actions &&
|
|
36746
|
+
actions.forEach((actionName) => bt.actionValidationService.validate(actionName, BACKTEST_METHOD_NAME_HAS_NO_PENDING_SIGNAL));
|
|
36747
|
+
}
|
|
36748
|
+
return await not(bt.strategyCoreService.hasPendingSignal(true, symbol, context));
|
|
36749
|
+
};
|
|
36750
|
+
/**
|
|
36751
|
+
* Returns true if there is NO active scheduled signal for the given symbol.
|
|
36752
|
+
*
|
|
36753
|
+
* Inverse of strategyCoreService.hasScheduledSignal. Use to guard signal generation logic.
|
|
36754
|
+
*
|
|
36755
|
+
* @param symbol - Trading pair symbol
|
|
36756
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
36757
|
+
* @returns Promise<boolean> - true if no scheduled signal exists, false if one does
|
|
36758
|
+
*
|
|
36759
|
+
* @example
|
|
36760
|
+
* ```typescript
|
|
36761
|
+
* if (await Backtest.hasNoScheduledSignal("BTCUSDT", { strategyName, exchangeName, frameName })) {
|
|
36762
|
+
* // safe to schedule a new signal
|
|
36763
|
+
* }
|
|
36764
|
+
* ```
|
|
36765
|
+
*/
|
|
36766
|
+
this.hasNoScheduledSignal = async (symbol, context) => {
|
|
36767
|
+
bt.loggerService.info(BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL, {
|
|
36768
|
+
symbol,
|
|
36769
|
+
context,
|
|
36770
|
+
});
|
|
36771
|
+
bt.strategyValidationService.validate(context.strategyName, BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL);
|
|
36772
|
+
bt.exchangeValidationService.validate(context.exchangeName, BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL);
|
|
36773
|
+
{
|
|
36774
|
+
const { riskName, riskList, actions } = bt.strategySchemaService.get(context.strategyName);
|
|
36775
|
+
riskName &&
|
|
36776
|
+
bt.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL);
|
|
36777
|
+
riskList &&
|
|
36778
|
+
riskList.forEach((riskName) => bt.riskValidationService.validate(riskName, BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL));
|
|
36779
|
+
actions &&
|
|
36780
|
+
actions.forEach((actionName) => bt.actionValidationService.validate(actionName, BACKTEST_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL));
|
|
36781
|
+
}
|
|
36782
|
+
return await not(bt.strategyCoreService.hasScheduledSignal(true, symbol, context));
|
|
36783
|
+
};
|
|
36604
36784
|
/**
|
|
36605
36785
|
* Checks if breakeven threshold has been reached for the current pending signal.
|
|
36606
36786
|
*
|
|
@@ -38246,6 +38426,8 @@ const LIVE_METHOD_NAME_TRAILING_STOP_COST = "LiveUtils.commitTrailingStopCost";
|
|
|
38246
38426
|
const LIVE_METHOD_NAME_TRAILING_PROFIT_COST = "LiveUtils.commitTrailingTakeCost";
|
|
38247
38427
|
const LIVE_METHOD_NAME_ACTIVATE_SCHEDULED = "Live.commitActivateScheduled";
|
|
38248
38428
|
const LIVE_METHOD_NAME_AVERAGE_BUY = "Live.commitAverageBuy";
|
|
38429
|
+
const LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL = "LiveUtils.hasNoPendingSignal";
|
|
38430
|
+
const LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL = "LiveUtils.hasNoScheduledSignal";
|
|
38249
38431
|
/**
|
|
38250
38432
|
* Internal task function that runs live trading and handles completion.
|
|
38251
38433
|
* Consumes live trading results and updates instance state flags.
|
|
@@ -38778,6 +38960,82 @@ class LiveUtils {
|
|
|
38778
38960
|
frameName: "",
|
|
38779
38961
|
});
|
|
38780
38962
|
};
|
|
38963
|
+
/**
|
|
38964
|
+
* Returns true if there is NO active pending signal for the given symbol.
|
|
38965
|
+
*
|
|
38966
|
+
* Inverse of strategyCoreService.hasPendingSignal. Use to guard signal generation logic.
|
|
38967
|
+
*
|
|
38968
|
+
* @param symbol - Trading pair symbol
|
|
38969
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
38970
|
+
* @returns Promise<boolean> - true if no pending signal exists, false if one does
|
|
38971
|
+
*
|
|
38972
|
+
* @example
|
|
38973
|
+
* ```typescript
|
|
38974
|
+
* if (await Live.hasNoPendingSignal("BTCUSDT", { strategyName, exchangeName })) {
|
|
38975
|
+
* // safe to open a new position
|
|
38976
|
+
* }
|
|
38977
|
+
* ```
|
|
38978
|
+
*/
|
|
38979
|
+
this.hasNoPendingSignal = async (symbol, context) => {
|
|
38980
|
+
bt.loggerService.info(LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL, {
|
|
38981
|
+
symbol,
|
|
38982
|
+
context,
|
|
38983
|
+
});
|
|
38984
|
+
bt.strategyValidationService.validate(context.strategyName, LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL);
|
|
38985
|
+
bt.exchangeValidationService.validate(context.exchangeName, LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL);
|
|
38986
|
+
{
|
|
38987
|
+
const { riskName, riskList, actions } = bt.strategySchemaService.get(context.strategyName);
|
|
38988
|
+
riskName &&
|
|
38989
|
+
bt.riskValidationService.validate(riskName, LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL);
|
|
38990
|
+
riskList &&
|
|
38991
|
+
riskList.forEach((riskName) => bt.riskValidationService.validate(riskName, LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL));
|
|
38992
|
+
actions &&
|
|
38993
|
+
actions.forEach((actionName) => bt.actionValidationService.validate(actionName, LIVE_METHOD_NAME_HAS_NO_PENDING_SIGNAL));
|
|
38994
|
+
}
|
|
38995
|
+
return await not(bt.strategyCoreService.hasPendingSignal(false, symbol, {
|
|
38996
|
+
strategyName: context.strategyName,
|
|
38997
|
+
exchangeName: context.exchangeName,
|
|
38998
|
+
frameName: "",
|
|
38999
|
+
}));
|
|
39000
|
+
};
|
|
39001
|
+
/**
|
|
39002
|
+
* Returns true if there is NO active scheduled signal for the given symbol.
|
|
39003
|
+
*
|
|
39004
|
+
* Inverse of strategyCoreService.hasScheduledSignal. Use to guard signal generation logic.
|
|
39005
|
+
*
|
|
39006
|
+
* @param symbol - Trading pair symbol
|
|
39007
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
39008
|
+
* @returns Promise<boolean> - true if no scheduled signal exists, false if one does
|
|
39009
|
+
*
|
|
39010
|
+
* @example
|
|
39011
|
+
* ```typescript
|
|
39012
|
+
* if (await Live.hasNoScheduledSignal("BTCUSDT", { strategyName, exchangeName })) {
|
|
39013
|
+
* // safe to schedule a new signal
|
|
39014
|
+
* }
|
|
39015
|
+
* ```
|
|
39016
|
+
*/
|
|
39017
|
+
this.hasNoScheduledSignal = async (symbol, context) => {
|
|
39018
|
+
bt.loggerService.info(LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL, {
|
|
39019
|
+
symbol,
|
|
39020
|
+
context,
|
|
39021
|
+
});
|
|
39022
|
+
bt.strategyValidationService.validate(context.strategyName, LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL);
|
|
39023
|
+
bt.exchangeValidationService.validate(context.exchangeName, LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL);
|
|
39024
|
+
{
|
|
39025
|
+
const { riskName, riskList, actions } = bt.strategySchemaService.get(context.strategyName);
|
|
39026
|
+
riskName &&
|
|
39027
|
+
bt.riskValidationService.validate(riskName, LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL);
|
|
39028
|
+
riskList &&
|
|
39029
|
+
riskList.forEach((riskName) => bt.riskValidationService.validate(riskName, LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL));
|
|
39030
|
+
actions &&
|
|
39031
|
+
actions.forEach((actionName) => bt.actionValidationService.validate(actionName, LIVE_METHOD_NAME_HAS_NO_SCHEDULED_SIGNAL));
|
|
39032
|
+
}
|
|
39033
|
+
return await not(bt.strategyCoreService.hasScheduledSignal(false, symbol, {
|
|
39034
|
+
strategyName: context.strategyName,
|
|
39035
|
+
exchangeName: context.exchangeName,
|
|
39036
|
+
frameName: "",
|
|
39037
|
+
}));
|
|
39038
|
+
};
|
|
38781
39039
|
/**
|
|
38782
39040
|
* Checks if breakeven threshold has been reached for the current pending signal.
|
|
38783
39041
|
*
|
|
@@ -48310,4 +48568,4 @@ const percentValue = (yesterdayValue, todayValue) => {
|
|
|
48310
48568
|
return yesterdayValue / todayValue - 1;
|
|
48311
48569
|
};
|
|
48312
48570
|
|
|
48313
|
-
export { ActionBase, Backtest, Breakeven, Broker, BrokerBase, Cache, Constant, Exchange, ExecutionContextService, Heat, HighestProfit, Live, Log, Markdown, MarkdownFileBase, MarkdownFolderBase, MethodContextService, Notification, NotificationBacktest, NotificationLive, Partial, Performance, PersistBase, PersistBreakevenAdapter, PersistCandleAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PersistStorageAdapter, PositionSize, Report, ReportBase, Risk, Schedule, Storage, StorageBacktest, StorageLive, Strategy, Sync, Walker, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, dumpMessages, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionCountdownMinutes, getPositionDrawdownMinutes, getPositionEffectivePrice, getPositionEntries, getPositionEntryOverlap, getPositionEstimateMinutes, getPositionHighestPnlCost, getPositionHighestPnlPercentage, getPositionHighestProfitBreakeven, getPositionHighestProfitPrice, getPositionHighestProfitTimestamp, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionPartialOverlap, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getRawCandles, getRiskSchema, getScheduledSignal, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasTradeContext, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenHighestProfit, listenHighestProfitOnce, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, roundTicks, set, setColumns, setConfig, setLogger, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, waitForCandle, warmCandles };
|
|
48571
|
+
export { ActionBase, Backtest, Breakeven, Broker, BrokerBase, Cache, Constant, Exchange, ExecutionContextService, Heat, HighestProfit, Live, Log, Markdown, MarkdownFileBase, MarkdownFolderBase, MethodContextService, Notification, NotificationBacktest, NotificationLive, Partial, Performance, PersistBase, PersistBreakevenAdapter, PersistCandleAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PersistStorageAdapter, PositionSize, Report, ReportBase, Risk, Schedule, Storage, StorageBacktest, StorageLive, Strategy, Sync, Walker, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, dumpMessages, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionCountdownMinutes, getPositionDrawdownMinutes, getPositionEffectivePrice, getPositionEntries, getPositionEntryOverlap, getPositionEstimateMinutes, getPositionHighestPnlCost, getPositionHighestPnlPercentage, getPositionHighestProfitBreakeven, getPositionHighestProfitPrice, getPositionHighestProfitTimestamp, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionPartialOverlap, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getRawCandles, getRiskSchema, getScheduledSignal, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasNoPendingSignal, hasNoScheduledSignal, hasTradeContext, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenHighestProfit, listenHighestProfitOnce, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, roundTicks, set, setColumns, setConfig, setLogger, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, waitForCandle, warmCandles };
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -3399,6 +3399,15 @@ interface IStrategy {
|
|
|
3399
3399
|
* @returns Promise resolving to true if pending signal exists, false otherwise
|
|
3400
3400
|
*/
|
|
3401
3401
|
hasPendingSignal: (symbol: string) => Promise<boolean>;
|
|
3402
|
+
/**
|
|
3403
|
+
* Checks if there is an active scheduled signal for the symbol.
|
|
3404
|
+
*
|
|
3405
|
+
* Used internally to determine if TP/SL monitoring should occur on tick.
|
|
3406
|
+
*
|
|
3407
|
+
* @param symbol - Trading pair symbol
|
|
3408
|
+
* @returns Promise resolving to true if scheduled signal exists, false otherwise
|
|
3409
|
+
*/
|
|
3410
|
+
hasScheduledSignal: (symbol: string) => Promise<boolean>;
|
|
3402
3411
|
/**
|
|
3403
3412
|
* Returns the original estimated duration for the current pending signal.
|
|
3404
3413
|
*
|
|
@@ -5383,6 +5392,46 @@ declare function getPositionEntryOverlap(symbol: string, currentPrice: number, l
|
|
|
5383
5392
|
* ```
|
|
5384
5393
|
*/
|
|
5385
5394
|
declare function getPositionPartialOverlap(symbol: string, currentPrice: number, ladder?: IPositionOverlapLadder): Promise<boolean>;
|
|
5395
|
+
/**
|
|
5396
|
+
* Returns true if there is NO active pending signal for the given symbol.
|
|
5397
|
+
*
|
|
5398
|
+
* Inverse of hasPendingSignal. Use to guard signal generation logic.
|
|
5399
|
+
*
|
|
5400
|
+
* Automatically detects backtest/live mode from execution context.
|
|
5401
|
+
*
|
|
5402
|
+
* @param symbol - Trading pair symbol
|
|
5403
|
+
* @returns Promise<boolean> - true if no pending signal exists, false if one does
|
|
5404
|
+
*
|
|
5405
|
+
* @example
|
|
5406
|
+
* ```typescript
|
|
5407
|
+
* import { hasNoPendingSignal } from "backtest-kit";
|
|
5408
|
+
*
|
|
5409
|
+
* if (await hasNoPendingSignal("BTCUSDT")) {
|
|
5410
|
+
* // safe to open a new position
|
|
5411
|
+
* }
|
|
5412
|
+
* ```
|
|
5413
|
+
*/
|
|
5414
|
+
declare function hasNoPendingSignal(symbol: string): Promise<boolean>;
|
|
5415
|
+
/**
|
|
5416
|
+
* Returns true if there is NO active scheduled signal for the given symbol.
|
|
5417
|
+
*
|
|
5418
|
+
* Inverse of hasScheduledSignal. Use to guard signal generation logic.
|
|
5419
|
+
*
|
|
5420
|
+
* Automatically detects backtest/live mode from execution context.
|
|
5421
|
+
*
|
|
5422
|
+
* @param symbol - Trading pair symbol
|
|
5423
|
+
* @returns Promise<boolean> - true if no scheduled signal exists, false if one does
|
|
5424
|
+
*
|
|
5425
|
+
* @example
|
|
5426
|
+
* ```typescript
|
|
5427
|
+
* import { hasNoScheduledSignal } from "backtest-kit";
|
|
5428
|
+
*
|
|
5429
|
+
* if (await hasNoScheduledSignal("BTCUSDT")) {
|
|
5430
|
+
* // safe to schedule a new signal
|
|
5431
|
+
* }
|
|
5432
|
+
* ```
|
|
5433
|
+
*/
|
|
5434
|
+
declare function hasNoScheduledSignal(symbol: string): Promise<boolean>;
|
|
5386
5435
|
|
|
5387
5436
|
/**
|
|
5388
5437
|
* Stops the strategy from generating new signals.
|
|
@@ -12295,6 +12344,48 @@ declare class BacktestUtils {
|
|
|
12295
12344
|
exchangeName: ExchangeName;
|
|
12296
12345
|
frameName: FrameName;
|
|
12297
12346
|
}) => Promise<IScheduledSignalRow>;
|
|
12347
|
+
/**
|
|
12348
|
+
* Returns true if there is NO active pending signal for the given symbol.
|
|
12349
|
+
*
|
|
12350
|
+
* Inverse of strategyCoreService.hasPendingSignal. Use to guard signal generation logic.
|
|
12351
|
+
*
|
|
12352
|
+
* @param symbol - Trading pair symbol
|
|
12353
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
12354
|
+
* @returns Promise<boolean> - true if no pending signal exists, false if one does
|
|
12355
|
+
*
|
|
12356
|
+
* @example
|
|
12357
|
+
* ```typescript
|
|
12358
|
+
* if (await Backtest.hasNoPendingSignal("BTCUSDT", { strategyName, exchangeName, frameName })) {
|
|
12359
|
+
* // safe to open a new position
|
|
12360
|
+
* }
|
|
12361
|
+
* ```
|
|
12362
|
+
*/
|
|
12363
|
+
hasNoPendingSignal: (symbol: string, context: {
|
|
12364
|
+
strategyName: StrategyName;
|
|
12365
|
+
exchangeName: ExchangeName;
|
|
12366
|
+
frameName: FrameName;
|
|
12367
|
+
}) => Promise<boolean>;
|
|
12368
|
+
/**
|
|
12369
|
+
* Returns true if there is NO active scheduled signal for the given symbol.
|
|
12370
|
+
*
|
|
12371
|
+
* Inverse of strategyCoreService.hasScheduledSignal. Use to guard signal generation logic.
|
|
12372
|
+
*
|
|
12373
|
+
* @param symbol - Trading pair symbol
|
|
12374
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
12375
|
+
* @returns Promise<boolean> - true if no scheduled signal exists, false if one does
|
|
12376
|
+
*
|
|
12377
|
+
* @example
|
|
12378
|
+
* ```typescript
|
|
12379
|
+
* if (await Backtest.hasNoScheduledSignal("BTCUSDT", { strategyName, exchangeName, frameName })) {
|
|
12380
|
+
* // safe to schedule a new signal
|
|
12381
|
+
* }
|
|
12382
|
+
* ```
|
|
12383
|
+
*/
|
|
12384
|
+
hasNoScheduledSignal: (symbol: string, context: {
|
|
12385
|
+
strategyName: StrategyName;
|
|
12386
|
+
exchangeName: ExchangeName;
|
|
12387
|
+
frameName: FrameName;
|
|
12388
|
+
}) => Promise<boolean>;
|
|
12298
12389
|
/**
|
|
12299
12390
|
* Checks if breakeven threshold has been reached for the current pending signal.
|
|
12300
12391
|
*
|
|
@@ -13546,6 +13637,46 @@ declare class LiveUtils {
|
|
|
13546
13637
|
strategyName: StrategyName;
|
|
13547
13638
|
exchangeName: ExchangeName;
|
|
13548
13639
|
}) => Promise<IScheduledSignalRow>;
|
|
13640
|
+
/**
|
|
13641
|
+
* Returns true if there is NO active pending signal for the given symbol.
|
|
13642
|
+
*
|
|
13643
|
+
* Inverse of strategyCoreService.hasPendingSignal. Use to guard signal generation logic.
|
|
13644
|
+
*
|
|
13645
|
+
* @param symbol - Trading pair symbol
|
|
13646
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13647
|
+
* @returns Promise<boolean> - true if no pending signal exists, false if one does
|
|
13648
|
+
*
|
|
13649
|
+
* @example
|
|
13650
|
+
* ```typescript
|
|
13651
|
+
* if (await Live.hasNoPendingSignal("BTCUSDT", { strategyName, exchangeName })) {
|
|
13652
|
+
* // safe to open a new position
|
|
13653
|
+
* }
|
|
13654
|
+
* ```
|
|
13655
|
+
*/
|
|
13656
|
+
hasNoPendingSignal: (symbol: string, context: {
|
|
13657
|
+
strategyName: StrategyName;
|
|
13658
|
+
exchangeName: ExchangeName;
|
|
13659
|
+
}) => Promise<boolean>;
|
|
13660
|
+
/**
|
|
13661
|
+
* Returns true if there is NO active scheduled signal for the given symbol.
|
|
13662
|
+
*
|
|
13663
|
+
* Inverse of strategyCoreService.hasScheduledSignal. Use to guard signal generation logic.
|
|
13664
|
+
*
|
|
13665
|
+
* @param symbol - Trading pair symbol
|
|
13666
|
+
* @param context - Execution context with strategyName and exchangeName
|
|
13667
|
+
* @returns Promise<boolean> - true if no scheduled signal exists, false if one does
|
|
13668
|
+
*
|
|
13669
|
+
* @example
|
|
13670
|
+
* ```typescript
|
|
13671
|
+
* if (await Live.hasNoScheduledSignal("BTCUSDT", { strategyName, exchangeName })) {
|
|
13672
|
+
* // safe to schedule a new signal
|
|
13673
|
+
* }
|
|
13674
|
+
* ```
|
|
13675
|
+
*/
|
|
13676
|
+
hasNoScheduledSignal: (symbol: string, context: {
|
|
13677
|
+
strategyName: StrategyName;
|
|
13678
|
+
exchangeName: ExchangeName;
|
|
13679
|
+
}) => Promise<boolean>;
|
|
13549
13680
|
/**
|
|
13550
13681
|
* Checks if breakeven threshold has been reached for the current pending signal.
|
|
13551
13682
|
*
|
|
@@ -22432,6 +22563,19 @@ declare class StrategyConnectionService implements TStrategy$1 {
|
|
|
22432
22563
|
exchangeName: ExchangeName;
|
|
22433
22564
|
frameName: FrameName;
|
|
22434
22565
|
}) => Promise<boolean>;
|
|
22566
|
+
/**
|
|
22567
|
+
* Checks if there is an active scheduled signal for the strategy.
|
|
22568
|
+
* Delegates to ClientStrategy.hasScheduledSignal() which checks if there is a waiting position signal
|
|
22569
|
+
* @param backtest - Whether running in backtest mode
|
|
22570
|
+
* @param symbol - Trading pair symbol
|
|
22571
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
22572
|
+
* @returns Promise resolving to true if there is a waiting scheduled signal, false otherwise
|
|
22573
|
+
*/
|
|
22574
|
+
hasScheduledSignal: (backtest: boolean, symbol: string, context: {
|
|
22575
|
+
strategyName: StrategyName;
|
|
22576
|
+
exchangeName: ExchangeName;
|
|
22577
|
+
frameName: FrameName;
|
|
22578
|
+
}) => Promise<boolean>;
|
|
22435
22579
|
/**
|
|
22436
22580
|
* Returns the original estimated duration for the current pending signal.
|
|
22437
22581
|
*
|
|
@@ -24186,6 +24330,21 @@ declare class StrategyCoreService implements TStrategy {
|
|
|
24186
24330
|
exchangeName: ExchangeName;
|
|
24187
24331
|
frameName: FrameName;
|
|
24188
24332
|
}) => Promise<boolean>;
|
|
24333
|
+
/**
|
|
24334
|
+
* Checks if there is a waiting scheduled signal for the symbol.
|
|
24335
|
+
* Validates strategy existence and delegates to connection service
|
|
24336
|
+
* to check if a scheduled signal exists for the symbol.
|
|
24337
|
+
* Does not require execution context as this is a state query operation.
|
|
24338
|
+
* @param backtest - Whether running in backtest mode
|
|
24339
|
+
* @param symbol - Trading pair symbol
|
|
24340
|
+
* @param context - Execution context with strategyName, exchangeName, frameName
|
|
24341
|
+
* @returns Promise<boolean> - true if scheduled signal exists, false otherwise
|
|
24342
|
+
*/
|
|
24343
|
+
hasScheduledSignal: (backtest: boolean, symbol: string, context: {
|
|
24344
|
+
strategyName: StrategyName;
|
|
24345
|
+
exchangeName: ExchangeName;
|
|
24346
|
+
frameName: FrameName;
|
|
24347
|
+
}) => Promise<boolean>;
|
|
24189
24348
|
/**
|
|
24190
24349
|
* Returns the original estimated duration for the current pending signal.
|
|
24191
24350
|
*
|
|
@@ -26939,4 +27098,4 @@ declare const getTotalClosed: (signal: Signal) => {
|
|
|
26939
27098
|
remainingCostBasis: number;
|
|
26940
27099
|
};
|
|
26941
27100
|
|
|
26942
|
-
export { ActionBase, type ActivateScheduledCommit, type ActivateScheduledCommitNotification, type ActivePingContract, type AverageBuyCommit, type AverageBuyCommitNotification, Backtest, type BacktestStatisticsModel, Breakeven, type BreakevenAvailableNotification, type BreakevenCommit, type BreakevenCommitNotification, type BreakevenContract, type BreakevenData, type BreakevenEvent, type BreakevenStatisticsModel, Broker, type BrokerAverageBuyPayload, BrokerBase, type BrokerBreakevenPayload, type BrokerPartialLossPayload, type BrokerPartialProfitPayload, type BrokerSignalClosePayload, type BrokerSignalOpenPayload, type BrokerTrailingStopPayload, type BrokerTrailingTakePayload, Cache, type CancelScheduledCommit, type CancelScheduledCommitNotification, type CandleData, type CandleInterval, type ClosePendingCommit, type ClosePendingCommitNotification, type ColumnConfig, type ColumnModel, Constant, type CriticalErrorNotification, type DoneContract, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, HighestProfit, type HighestProfitContract, type HighestProfitEvent, type HighestProfitStatisticsModel, type IActionSchema, type IActivateScheduledCommitRow, type IAggregatedTradeData, type IBidData, type IBreakevenCommitRow, type IBroker, type ICandleData, type ICommitRow, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type ILog, type ILogEntry, type ILogger, type IMarkdownDumpOptions, type INotificationUtils, type IOrderBookData, type IPartialLossCommitRow, type IPartialProfitCommitRow, type IPersistBase, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicAction, type IPublicCandleData, type IPublicSignalRow, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskSignalRow, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, type IScheduledSignalRow, type ISignalDto, type ISignalRow, type ISizingCalculateParams, type ISizingCalculateParamsATR, type ISizingCalculateParamsFixedPercentage, type ISizingCalculateParamsKelly, type ISizingParams, type ISizingParamsATR, type ISizingParamsFixedPercentage, type ISizingParamsKelly, type ISizingSchema, type ISizingSchemaATR, type ISizingSchemaFixedPercentage, type ISizingSchemaKelly, type IStorageSignalRow, type IStorageUtils, type IStrategyPnL, type IStrategyResult, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IStrategyTickResultWaiting, type ITrailingStopCommitRow, type ITrailingTakeCommitRow, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, type InfoErrorNotification, Live, type LiveStatisticsModel, Log, type LogData, Markdown, MarkdownFileBase, MarkdownFolderBase, type MarkdownName, type MeasureData, MethodContextService, type MetricStats, Notification, NotificationBacktest, type NotificationData, NotificationLive, type NotificationModel, Partial$1 as Partial, type PartialData, type PartialEvent, type PartialLossAvailableNotification, type PartialLossCommit, type PartialLossCommitNotification, type PartialLossContract, type PartialProfitAvailableNotification, type PartialProfitCommit, type PartialProfitCommitNotification, type PartialProfitContract, type PartialStatisticsModel, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatisticsModel, PersistBase, PersistBreakevenAdapter, PersistCandleAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PersistStorageAdapter, PositionSize, type ProgressBacktestContract, type ProgressWalkerContract, Report, ReportBase, type ReportName, Risk, type RiskContract, type RiskData, type RiskEvent, type RiskRejectionNotification, type RiskStatisticsModel, Schedule, type ScheduleData, type SchedulePingContract, type ScheduleStatisticsModel, type ScheduledEvent, type SignalCancelledNotification, type SignalCloseContract, type SignalClosedNotification, type SignalData, type SignalInterval, type SignalOpenContract, type SignalOpenedNotification, type SignalScheduledNotification, type SignalSyncCloseNotification, type SignalSyncContract, type SignalSyncOpenNotification, Storage, StorageBacktest, type StorageData, StorageLive, Strategy, type StrategyActionType, type StrategyCancelReason, type StrategyCloseReason, type StrategyCommitContract, type StrategyEvent, type StrategyStatisticsModel, Sync, type SyncEvent, type SyncStatisticsModel, type TBrokerCtor, type TLogCtor, type TMarkdownBase, type TNotificationUtilsCtor, type TPersistBase, type TPersistBaseCtor, type TReportBase, type TStorageUtilsCtor, type TickEvent, type TrailingStopCommit, type TrailingStopCommitNotification, type TrailingTakeCommit, type TrailingTakeCommitNotification, type ValidationErrorNotification, Walker, type WalkerCompleteContract, type WalkerContract, type WalkerMetric, type SignalData$1 as WalkerSignalData, type WalkerStatisticsModel, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, dumpMessages, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionCountdownMinutes, getPositionDrawdownMinutes, getPositionEffectivePrice, getPositionEntries, getPositionEntryOverlap, getPositionEstimateMinutes, getPositionHighestPnlCost, getPositionHighestPnlPercentage, getPositionHighestProfitBreakeven, getPositionHighestProfitPrice, getPositionHighestProfitTimestamp, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionPartialOverlap, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getRawCandles, getRiskSchema, getScheduledSignal, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasTradeContext, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenHighestProfit, listenHighestProfitOnce, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, roundTicks, set, setColumns, setConfig, setLogger, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, waitForCandle, warmCandles };
|
|
27101
|
+
export { ActionBase, type ActivateScheduledCommit, type ActivateScheduledCommitNotification, type ActivePingContract, type AverageBuyCommit, type AverageBuyCommitNotification, Backtest, type BacktestStatisticsModel, Breakeven, type BreakevenAvailableNotification, type BreakevenCommit, type BreakevenCommitNotification, type BreakevenContract, type BreakevenData, type BreakevenEvent, type BreakevenStatisticsModel, Broker, type BrokerAverageBuyPayload, BrokerBase, type BrokerBreakevenPayload, type BrokerPartialLossPayload, type BrokerPartialProfitPayload, type BrokerSignalClosePayload, type BrokerSignalOpenPayload, type BrokerTrailingStopPayload, type BrokerTrailingTakePayload, Cache, type CancelScheduledCommit, type CancelScheduledCommitNotification, type CandleData, type CandleInterval, type ClosePendingCommit, type ClosePendingCommitNotification, type ColumnConfig, type ColumnModel, Constant, type CriticalErrorNotification, type DoneContract, type EntityId, Exchange, ExecutionContextService, type FrameInterval, type GlobalConfig, Heat, type HeatmapStatisticsModel, HighestProfit, type HighestProfitContract, type HighestProfitEvent, type HighestProfitStatisticsModel, type IActionSchema, type IActivateScheduledCommitRow, type IAggregatedTradeData, type IBidData, type IBreakevenCommitRow, type IBroker, type ICandleData, type ICommitRow, type IExchangeSchema, type IFrameSchema, type IHeatmapRow, type ILog, type ILogEntry, type ILogger, type IMarkdownDumpOptions, type INotificationUtils, type IOrderBookData, type IPartialLossCommitRow, type IPartialProfitCommitRow, type IPersistBase, type IPositionSizeATRParams, type IPositionSizeFixedPercentageParams, type IPositionSizeKellyParams, type IPublicAction, type IPublicCandleData, type IPublicSignalRow, type IReportDumpOptions, type IRiskActivePosition, type IRiskCheckArgs, type IRiskSchema, type IRiskSignalRow, type IRiskValidation, type IRiskValidationFn, type IRiskValidationPayload, type IScheduledSignalCancelRow, type IScheduledSignalRow, type ISignalDto, type ISignalRow, type ISizingCalculateParams, type ISizingCalculateParamsATR, type ISizingCalculateParamsFixedPercentage, type ISizingCalculateParamsKelly, type ISizingParams, type ISizingParamsATR, type ISizingParamsFixedPercentage, type ISizingParamsKelly, type ISizingSchema, type ISizingSchemaATR, type ISizingSchemaFixedPercentage, type ISizingSchemaKelly, type IStorageSignalRow, type IStorageUtils, type IStrategyPnL, type IStrategyResult, type IStrategySchema, type IStrategyTickResult, type IStrategyTickResultActive, type IStrategyTickResultCancelled, type IStrategyTickResultClosed, type IStrategyTickResultIdle, type IStrategyTickResultOpened, type IStrategyTickResultScheduled, type IStrategyTickResultWaiting, type ITrailingStopCommitRow, type ITrailingTakeCommitRow, type IWalkerResults, type IWalkerSchema, type IWalkerStrategyResult, type InfoErrorNotification, Live, type LiveStatisticsModel, Log, type LogData, Markdown, MarkdownFileBase, MarkdownFolderBase, type MarkdownName, type MeasureData, MethodContextService, type MetricStats, Notification, NotificationBacktest, type NotificationData, NotificationLive, type NotificationModel, Partial$1 as Partial, type PartialData, type PartialEvent, type PartialLossAvailableNotification, type PartialLossCommit, type PartialLossCommitNotification, type PartialLossContract, type PartialProfitAvailableNotification, type PartialProfitCommit, type PartialProfitCommitNotification, type PartialProfitContract, type PartialStatisticsModel, Performance, type PerformanceContract, type PerformanceMetricType, type PerformanceStatisticsModel, PersistBase, PersistBreakevenAdapter, PersistCandleAdapter, PersistLogAdapter, PersistMeasureAdapter, PersistNotificationAdapter, PersistPartialAdapter, PersistRiskAdapter, PersistScheduleAdapter, PersistSignalAdapter, PersistStorageAdapter, PositionSize, type ProgressBacktestContract, type ProgressWalkerContract, Report, ReportBase, type ReportName, Risk, type RiskContract, type RiskData, type RiskEvent, type RiskRejectionNotification, type RiskStatisticsModel, Schedule, type ScheduleData, type SchedulePingContract, type ScheduleStatisticsModel, type ScheduledEvent, type SignalCancelledNotification, type SignalCloseContract, type SignalClosedNotification, type SignalData, type SignalInterval, type SignalOpenContract, type SignalOpenedNotification, type SignalScheduledNotification, type SignalSyncCloseNotification, type SignalSyncContract, type SignalSyncOpenNotification, Storage, StorageBacktest, type StorageData, StorageLive, Strategy, type StrategyActionType, type StrategyCancelReason, type StrategyCloseReason, type StrategyCommitContract, type StrategyEvent, type StrategyStatisticsModel, Sync, type SyncEvent, type SyncStatisticsModel, type TBrokerCtor, type TLogCtor, type TMarkdownBase, type TNotificationUtilsCtor, type TPersistBase, type TPersistBaseCtor, type TReportBase, type TStorageUtilsCtor, type TickEvent, type TrailingStopCommit, type TrailingStopCommitNotification, type TrailingTakeCommit, type TrailingTakeCommitNotification, type ValidationErrorNotification, Walker, type WalkerCompleteContract, type WalkerContract, type WalkerMetric, type SignalData$1 as WalkerSignalData, type WalkerStatisticsModel, addActionSchema, addExchangeSchema, addFrameSchema, addRiskSchema, addSizingSchema, addStrategySchema, addWalkerSchema, alignToInterval, checkCandles, commitActivateScheduled, commitAverageBuy, commitBreakeven, commitCancelScheduled, commitClosePending, commitPartialLoss, commitPartialLossCost, commitPartialProfit, commitPartialProfitCost, commitTrailingStop, commitTrailingStopCost, commitTrailingTake, commitTrailingTakeCost, dumpMessages, emitters, formatPrice, formatQuantity, get, getActionSchema, getAggregatedTrades, getAveragePrice, getBacktestTimeframe, getBreakeven, getCandles, getColumns, getConfig, getContext, getDate, getDefaultColumns, getDefaultConfig, getEffectivePriceOpen, getExchangeSchema, getFrameSchema, getMode, getNextCandles, getOrderBook, getPendingSignal, getPositionCountdownMinutes, getPositionDrawdownMinutes, getPositionEffectivePrice, getPositionEntries, getPositionEntryOverlap, getPositionEstimateMinutes, getPositionHighestPnlCost, getPositionHighestPnlPercentage, getPositionHighestProfitBreakeven, getPositionHighestProfitPrice, getPositionHighestProfitTimestamp, getPositionInvestedCost, getPositionInvestedCount, getPositionLevels, getPositionPartialOverlap, getPositionPartials, getPositionPnlCost, getPositionPnlPercent, getRawCandles, getRiskSchema, getScheduledSignal, getSizingSchema, getStrategySchema, getSymbol, getTimestamp, getTotalClosed, getTotalCostClosed, getTotalPercentClosed, getWalkerSchema, hasNoPendingSignal, hasNoScheduledSignal, hasTradeContext, investedCostToPercent, backtest as lib, listExchangeSchema, listFrameSchema, listRiskSchema, listSizingSchema, listStrategySchema, listWalkerSchema, listenActivePing, listenActivePingOnce, listenBacktestProgress, listenBreakevenAvailable, listenBreakevenAvailableOnce, listenDoneBacktest, listenDoneBacktestOnce, listenDoneLive, listenDoneLiveOnce, listenDoneWalker, listenDoneWalkerOnce, listenError, listenExit, listenHighestProfit, listenHighestProfitOnce, listenPartialLossAvailable, listenPartialLossAvailableOnce, listenPartialProfitAvailable, listenPartialProfitAvailableOnce, listenPerformance, listenRisk, listenRiskOnce, listenSchedulePing, listenSchedulePingOnce, listenSignal, listenSignalBacktest, listenSignalBacktestOnce, listenSignalLive, listenSignalLiveOnce, listenSignalOnce, listenStrategyCommit, listenStrategyCommitOnce, listenSync, listenSyncOnce, listenValidation, listenWalker, listenWalkerComplete, listenWalkerOnce, listenWalkerProgress, overrideActionSchema, overrideExchangeSchema, overrideFrameSchema, overrideRiskSchema, overrideSizingSchema, overrideStrategySchema, overrideWalkerSchema, parseArgs, percentDiff, percentToCloseCost, percentValue, roundTicks, set, setColumns, setConfig, setLogger, shutdown, slPercentShiftToPrice, slPriceToPercentShift, stopStrategy, toProfitLossDto, tpPercentShiftToPrice, tpPriceToPercentShift, validate, waitForCandle, warmCandles };
|