@tradejs/strategy-trend-follow 3.0.4 → 3.0.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/dist/index.cjs +6 -4
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -6
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -44,7 +44,9 @@ var config = {
|
|
|
44
44
|
ML_ENABLED: false,
|
|
45
45
|
ML_THRESHOLD: 0.1,
|
|
46
46
|
MIN_AI_QUALITY: 3,
|
|
47
|
-
|
|
47
|
+
RISK_FEE_RATE: import_constants.FEE_PERCENT,
|
|
48
|
+
RISK_SLIPPAGE_BPS: 0,
|
|
49
|
+
RISK_MARKET_IMPACT_BPS: 0,
|
|
48
50
|
MAX_LOSS_VALUE: 10,
|
|
49
51
|
MA_FAST: 14,
|
|
50
52
|
MA_MEDIUM: 49,
|
|
@@ -688,8 +690,8 @@ var createTrendFollowCore = async ({ config: config2, data: initialData, strateg
|
|
|
688
690
|
fallback: 2
|
|
689
691
|
}),
|
|
690
692
|
maxLossValue: config2.MAX_LOSS_VALUE,
|
|
691
|
-
feeRate: Number(config2.
|
|
692
|
-
slippageBps: Number(config2.
|
|
693
|
+
feeRate: Number(config2.RISK_FEE_RATE ?? 0),
|
|
694
|
+
slippageBps: Number(config2.RISK_SLIPPAGE_BPS ?? 0) + Number(config2.RISK_MARKET_IMPACT_BPS ?? 0)
|
|
693
695
|
});
|
|
694
696
|
if (!qty || !Number.isFinite(qty) || qty <= 0) {
|
|
695
697
|
return strategyApi.skip("INVALID_QTY");
|
|
@@ -1291,7 +1293,7 @@ var trendFollowManifest = {
|
|
|
1291
1293
|
// src/TrendFollow/strategy.ts
|
|
1292
1294
|
var TrendFollowStrategyDefinition = {
|
|
1293
1295
|
defaults: config,
|
|
1294
|
-
parseConfig: (0, import_config3.
|
|
1296
|
+
parseConfig: (0, import_config3.createCostIsolatedStrategyConfigParser)({
|
|
1295
1297
|
strategyName: "TrendFollow",
|
|
1296
1298
|
defaults: config
|
|
1297
1299
|
}),
|
package/dist/index.d.cts
CHANGED
|
@@ -17,7 +17,9 @@ declare const config: {
|
|
|
17
17
|
readonly ML_ENABLED: false;
|
|
18
18
|
readonly ML_THRESHOLD: 0.1;
|
|
19
19
|
readonly MIN_AI_QUALITY: 3;
|
|
20
|
-
readonly
|
|
20
|
+
readonly RISK_FEE_RATE: 0.001;
|
|
21
|
+
readonly RISK_SLIPPAGE_BPS: 0;
|
|
22
|
+
readonly RISK_MARKET_IMPACT_BPS: 0;
|
|
21
23
|
readonly MAX_LOSS_VALUE: 10;
|
|
22
24
|
readonly MA_FAST: 14;
|
|
23
25
|
readonly MA_MEDIUM: 49;
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,9 @@ declare const config: {
|
|
|
17
17
|
readonly ML_ENABLED: false;
|
|
18
18
|
readonly ML_THRESHOLD: 0.1;
|
|
19
19
|
readonly MIN_AI_QUALITY: 3;
|
|
20
|
-
readonly
|
|
20
|
+
readonly RISK_FEE_RATE: 0.001;
|
|
21
|
+
readonly RISK_SLIPPAGE_BPS: 0;
|
|
22
|
+
readonly RISK_MARKET_IMPACT_BPS: 0;
|
|
21
23
|
readonly MAX_LOSS_VALUE: 10;
|
|
22
24
|
readonly MA_FAST: 14;
|
|
23
25
|
readonly MA_MEDIUM: 49;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { defineStrategyPlugin } from "@tradejs/core/config";
|
|
3
3
|
|
|
4
4
|
// src/TrendFollow/config.ts
|
|
5
|
-
import { FEE_PERCENT } from "@tradejs/core/constants";
|
|
5
|
+
import { FEE_PERCENT as RISK_FEE_RATE } from "@tradejs/core/constants";
|
|
6
6
|
var config = {
|
|
7
7
|
ENV: "BACKTEST",
|
|
8
8
|
INTERVAL: "15",
|
|
@@ -14,7 +14,9 @@ var config = {
|
|
|
14
14
|
ML_ENABLED: false,
|
|
15
15
|
ML_THRESHOLD: 0.1,
|
|
16
16
|
MIN_AI_QUALITY: 3,
|
|
17
|
-
|
|
17
|
+
RISK_FEE_RATE,
|
|
18
|
+
RISK_SLIPPAGE_BPS: 0,
|
|
19
|
+
RISK_MARKET_IMPACT_BPS: 0,
|
|
18
20
|
MAX_LOSS_VALUE: 10,
|
|
19
21
|
MA_FAST: 14,
|
|
20
22
|
MA_MEDIUM: 49,
|
|
@@ -71,7 +73,7 @@ var config = {
|
|
|
71
73
|
};
|
|
72
74
|
|
|
73
75
|
// src/TrendFollow/strategy.ts
|
|
74
|
-
import {
|
|
76
|
+
import { createCostIsolatedStrategyConfigParser } from "@tradejs/strategy-kit/config";
|
|
75
77
|
|
|
76
78
|
// src/TrendFollow/core.ts
|
|
77
79
|
import { round } from "@tradejs/core/math";
|
|
@@ -661,8 +663,8 @@ var createTrendFollowCore = async ({ config: config2, data: initialData, strateg
|
|
|
661
663
|
fallback: 2
|
|
662
664
|
}),
|
|
663
665
|
maxLossValue: config2.MAX_LOSS_VALUE,
|
|
664
|
-
feeRate: Number(config2.
|
|
665
|
-
slippageBps: Number(config2.
|
|
666
|
+
feeRate: Number(config2.RISK_FEE_RATE ?? 0),
|
|
667
|
+
slippageBps: Number(config2.RISK_SLIPPAGE_BPS ?? 0) + Number(config2.RISK_MARKET_IMPACT_BPS ?? 0)
|
|
666
668
|
});
|
|
667
669
|
if (!qty || !Number.isFinite(qty) || qty <= 0) {
|
|
668
670
|
return strategyApi.skip("INVALID_QTY");
|
|
@@ -1267,7 +1269,7 @@ var trendFollowManifest = {
|
|
|
1267
1269
|
// src/TrendFollow/strategy.ts
|
|
1268
1270
|
var TrendFollowStrategyDefinition = {
|
|
1269
1271
|
defaults: config,
|
|
1270
|
-
parseConfig:
|
|
1272
|
+
parseConfig: createCostIsolatedStrategyConfigParser({
|
|
1271
1273
|
strategyName: "TrendFollow",
|
|
1272
1274
|
defaults: config
|
|
1273
1275
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradejs/strategy-trend-follow",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.5",
|
|
4
4
|
"description": "ATR trailing-trend strategy using pivot structure, optional breakout and benchmark filters, and trail or opposite-signal exits for TradeJS.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "yarn@4.13.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"sideEffects": false,
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@tradejs/core": "^3.0.1",
|
|
49
|
-
"@tradejs/strategy-kit": "^3.0.
|
|
49
|
+
"@tradejs/strategy-kit": "^3.0.5",
|
|
50
50
|
"@tradejs/types": "^3.0.1",
|
|
51
51
|
"@types/jest": "^29.5.14",
|
|
52
52
|
"jest": "^29.7.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"author": "aleksnick (https://github.com/aleksnick)",
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"@tradejs/core": "^3.0.1",
|
|
73
|
-
"@tradejs/strategy-kit": "^3.0.
|
|
73
|
+
"@tradejs/strategy-kit": "^3.0.5",
|
|
74
74
|
"@tradejs/types": "^3.0.1"
|
|
75
75
|
}
|
|
76
76
|
}
|