backtest-kit 1.6.4 → 1.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 +11 -9
- package/build/index.mjs +11 -9
- package/package.json +1 -1
package/build/index.cjs
CHANGED
|
@@ -3734,11 +3734,22 @@ class RiskUtils {
|
|
|
3734
3734
|
*/
|
|
3735
3735
|
const Risk = new RiskUtils();
|
|
3736
3736
|
|
|
3737
|
+
/**
|
|
3738
|
+
* No-operation IRisk implementation.
|
|
3739
|
+
* Always allows signals and performs no actions.
|
|
3740
|
+
*/
|
|
3737
3741
|
const NOOP_RISK = {
|
|
3738
3742
|
checkSignal: () => Promise.resolve(true),
|
|
3739
3743
|
addSignal: () => Promise.resolve(),
|
|
3740
3744
|
removeSignal: () => Promise.resolve(),
|
|
3741
3745
|
};
|
|
3746
|
+
/**
|
|
3747
|
+
* Determines the appropriate IRisk instance based on provided riskName and riskList.
|
|
3748
|
+
* @param dto - Object containing riskName and riskList
|
|
3749
|
+
* @param backtest - Whether running in backtest mode
|
|
3750
|
+
* @param self - Reference to StrategyConnectionService instance
|
|
3751
|
+
* @returns Configured IRisk instance (single or merged)
|
|
3752
|
+
*/
|
|
3742
3753
|
const GET_RISK_FN = (dto, backtest, self) => {
|
|
3743
3754
|
const hasRiskName = !!dto.riskName;
|
|
3744
3755
|
const hasRiskList = !!dto.riskList?.length;
|
|
@@ -4978,9 +4989,6 @@ class StrategyCoreService {
|
|
|
4978
4989
|
symbol,
|
|
4979
4990
|
strategyName,
|
|
4980
4991
|
});
|
|
4981
|
-
if (!MethodContextService.hasContext()) {
|
|
4982
|
-
throw new Error("strategyCoreService getPendingSignal requires a method context");
|
|
4983
|
-
}
|
|
4984
4992
|
await this.validate(symbol, strategyName);
|
|
4985
4993
|
return await this.strategyConnectionService.getPendingSignal(backtest, symbol, strategyName);
|
|
4986
4994
|
};
|
|
@@ -4998,9 +5006,6 @@ class StrategyCoreService {
|
|
|
4998
5006
|
symbol,
|
|
4999
5007
|
strategyName,
|
|
5000
5008
|
});
|
|
5001
|
-
if (!MethodContextService.hasContext()) {
|
|
5002
|
-
throw new Error("strategyCoreService getScheduledSignal requires a method context");
|
|
5003
|
-
}
|
|
5004
5009
|
await this.validate(symbol, strategyName);
|
|
5005
5010
|
return await this.strategyConnectionService.getScheduledSignal(backtest, symbol, strategyName);
|
|
5006
5011
|
};
|
|
@@ -5020,9 +5025,6 @@ class StrategyCoreService {
|
|
|
5020
5025
|
strategyName,
|
|
5021
5026
|
backtest,
|
|
5022
5027
|
});
|
|
5023
|
-
if (!MethodContextService.hasContext()) {
|
|
5024
|
-
throw new Error("strategyCoreService getStopped requires a method context");
|
|
5025
|
-
}
|
|
5026
5028
|
await this.validate(symbol, strategyName);
|
|
5027
5029
|
return await this.strategyConnectionService.getStopped(backtest, symbol, strategyName);
|
|
5028
5030
|
};
|
package/build/index.mjs
CHANGED
|
@@ -3732,11 +3732,22 @@ class RiskUtils {
|
|
|
3732
3732
|
*/
|
|
3733
3733
|
const Risk = new RiskUtils();
|
|
3734
3734
|
|
|
3735
|
+
/**
|
|
3736
|
+
* No-operation IRisk implementation.
|
|
3737
|
+
* Always allows signals and performs no actions.
|
|
3738
|
+
*/
|
|
3735
3739
|
const NOOP_RISK = {
|
|
3736
3740
|
checkSignal: () => Promise.resolve(true),
|
|
3737
3741
|
addSignal: () => Promise.resolve(),
|
|
3738
3742
|
removeSignal: () => Promise.resolve(),
|
|
3739
3743
|
};
|
|
3744
|
+
/**
|
|
3745
|
+
* Determines the appropriate IRisk instance based on provided riskName and riskList.
|
|
3746
|
+
* @param dto - Object containing riskName and riskList
|
|
3747
|
+
* @param backtest - Whether running in backtest mode
|
|
3748
|
+
* @param self - Reference to StrategyConnectionService instance
|
|
3749
|
+
* @returns Configured IRisk instance (single or merged)
|
|
3750
|
+
*/
|
|
3740
3751
|
const GET_RISK_FN = (dto, backtest, self) => {
|
|
3741
3752
|
const hasRiskName = !!dto.riskName;
|
|
3742
3753
|
const hasRiskList = !!dto.riskList?.length;
|
|
@@ -4976,9 +4987,6 @@ class StrategyCoreService {
|
|
|
4976
4987
|
symbol,
|
|
4977
4988
|
strategyName,
|
|
4978
4989
|
});
|
|
4979
|
-
if (!MethodContextService.hasContext()) {
|
|
4980
|
-
throw new Error("strategyCoreService getPendingSignal requires a method context");
|
|
4981
|
-
}
|
|
4982
4990
|
await this.validate(symbol, strategyName);
|
|
4983
4991
|
return await this.strategyConnectionService.getPendingSignal(backtest, symbol, strategyName);
|
|
4984
4992
|
};
|
|
@@ -4996,9 +5004,6 @@ class StrategyCoreService {
|
|
|
4996
5004
|
symbol,
|
|
4997
5005
|
strategyName,
|
|
4998
5006
|
});
|
|
4999
|
-
if (!MethodContextService.hasContext()) {
|
|
5000
|
-
throw new Error("strategyCoreService getScheduledSignal requires a method context");
|
|
5001
|
-
}
|
|
5002
5007
|
await this.validate(symbol, strategyName);
|
|
5003
5008
|
return await this.strategyConnectionService.getScheduledSignal(backtest, symbol, strategyName);
|
|
5004
5009
|
};
|
|
@@ -5018,9 +5023,6 @@ class StrategyCoreService {
|
|
|
5018
5023
|
strategyName,
|
|
5019
5024
|
backtest,
|
|
5020
5025
|
});
|
|
5021
|
-
if (!MethodContextService.hasContext()) {
|
|
5022
|
-
throw new Error("strategyCoreService getStopped requires a method context");
|
|
5023
|
-
}
|
|
5024
5026
|
await this.validate(symbol, strategyName);
|
|
5025
5027
|
return await this.strategyConnectionService.getStopped(backtest, symbol, strategyName);
|
|
5026
5028
|
};
|