@tradejs/node 1.0.10 → 1.0.11
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/README.md +1 -1
- package/dist/backtest.js +3 -0
- package/dist/backtest.mjs +7 -1
- package/dist/strategies.js +12 -1
- package/dist/strategies.mjs +14 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ export default defineConfig(basePreset);
|
|
|
41
41
|
- strategy runtime execution
|
|
42
42
|
- connector/plugin registries
|
|
43
43
|
- backtest orchestration helpers
|
|
44
|
-
- Pine loading/runtime helpers
|
|
44
|
+
- Pine-backed strategy loading/runtime helpers
|
|
45
45
|
- runtime-side operational helpers used by CLI/app
|
|
46
46
|
|
|
47
47
|
## Public Surface
|
package/dist/backtest.js
CHANGED
|
@@ -3352,6 +3352,9 @@ var filterClosedAlignedCandles = (data, btcData, interval) => {
|
|
|
3352
3352
|
};
|
|
3353
3353
|
};
|
|
3354
3354
|
var shouldLoadBacktestExecutionCandles = (interval) => {
|
|
3355
|
+
if (!import_constants4.BACKTEST_LOWER_TIMEFRAME_EXECUTION_ENABLED) {
|
|
3356
|
+
return false;
|
|
3357
|
+
}
|
|
3355
3358
|
const executionInterval = resolveBacktestExecutionInterval(interval);
|
|
3356
3359
|
if (!executionInterval) {
|
|
3357
3360
|
return false;
|
package/dist/backtest.mjs
CHANGED
|
@@ -24,7 +24,10 @@ export * from "@tradejs/core/backtest";
|
|
|
24
24
|
|
|
25
25
|
// src/testing.ts
|
|
26
26
|
import { alignSortedCandlesByTimestamp } from "@tradejs/core/indicators";
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
BACKTEST_EXECUTION_INTERVAL,
|
|
29
|
+
BACKTEST_LOWER_TIMEFRAME_EXECUTION_ENABLED
|
|
30
|
+
} from "@tradejs/core/constants";
|
|
28
31
|
import {
|
|
29
32
|
releaseStrategyIndicatorsReplayCache,
|
|
30
33
|
releaseStrategyReplayCache
|
|
@@ -1092,6 +1095,9 @@ var filterClosedAlignedCandles = (data, btcData, interval) => {
|
|
|
1092
1095
|
};
|
|
1093
1096
|
};
|
|
1094
1097
|
var shouldLoadBacktestExecutionCandles = (interval) => {
|
|
1098
|
+
if (!BACKTEST_LOWER_TIMEFRAME_EXECUTION_ENABLED) {
|
|
1099
|
+
return false;
|
|
1100
|
+
}
|
|
1095
1101
|
const executionInterval = resolveBacktestExecutionInterval(interval);
|
|
1096
1102
|
if (!executionInterval) {
|
|
1097
1103
|
return false;
|
package/dist/strategies.js
CHANGED
|
@@ -9983,6 +9983,17 @@ var createStrategyRuntime = ({
|
|
|
9983
9983
|
return void 0;
|
|
9984
9984
|
};
|
|
9985
9985
|
const resolveBacktestExecutionCandle = (candle, btcCandle) => {
|
|
9986
|
+
if (!import_constants4.BACKTEST_LOWER_TIMEFRAME_EXECUTION_ENABLED) {
|
|
9987
|
+
return {
|
|
9988
|
+
candle,
|
|
9989
|
+
btcCandle,
|
|
9990
|
+
source: "primary_timeframe",
|
|
9991
|
+
requestedExecutionTimestamp: candle.timestamp,
|
|
9992
|
+
executionInterval: String(config.INTERVAL ?? "15"),
|
|
9993
|
+
executionDelayMs: 0,
|
|
9994
|
+
primaryExecutionTimestamp: candle.timestamp
|
|
9995
|
+
};
|
|
9996
|
+
}
|
|
9986
9997
|
const requestedExecutionTimestamp = candle.timestamp + backtestExecutionDelayMs;
|
|
9987
9998
|
const primaryExecutionTimestamp = candle.timestamp;
|
|
9988
9999
|
if (!canUseLowerBacktestExecution || primaryIntervalMs == null) {
|
|
@@ -10052,7 +10063,7 @@ var createStrategyRuntime = ({
|
|
|
10052
10063
|
const execution = applyBacktestDelayedEntryExecution({
|
|
10053
10064
|
decision: pending.decision,
|
|
10054
10065
|
execution: executionCandleResolution,
|
|
10055
|
-
backtestPriceMode,
|
|
10066
|
+
backtestPriceMode: executionCandleResolution.source === "primary_timeframe" ? "open" : backtestPriceMode,
|
|
10056
10067
|
delayBars: pending.delayBars
|
|
10057
10068
|
});
|
|
10058
10069
|
if (execution.skipReason) {
|
package/dist/strategies.mjs
CHANGED
|
@@ -57,7 +57,8 @@ export * from "@tradejs/core/strategies";
|
|
|
57
57
|
import path from "path";
|
|
58
58
|
import {
|
|
59
59
|
BACKTEST_EXECUTION_DELAY_MS,
|
|
60
|
-
BACKTEST_EXECUTION_INTERVAL
|
|
60
|
+
BACKTEST_EXECUTION_INTERVAL,
|
|
61
|
+
BACKTEST_LOWER_TIMEFRAME_EXECUTION_ENABLED
|
|
61
62
|
} from "@tradejs/core/constants";
|
|
62
63
|
import { intervalToMs } from "@tradejs/core/data";
|
|
63
64
|
import {
|
|
@@ -1826,6 +1827,17 @@ var createStrategyRuntime = ({
|
|
|
1826
1827
|
return void 0;
|
|
1827
1828
|
};
|
|
1828
1829
|
const resolveBacktestExecutionCandle = (candle, btcCandle) => {
|
|
1830
|
+
if (!BACKTEST_LOWER_TIMEFRAME_EXECUTION_ENABLED) {
|
|
1831
|
+
return {
|
|
1832
|
+
candle,
|
|
1833
|
+
btcCandle,
|
|
1834
|
+
source: "primary_timeframe",
|
|
1835
|
+
requestedExecutionTimestamp: candle.timestamp,
|
|
1836
|
+
executionInterval: String(config.INTERVAL ?? "15"),
|
|
1837
|
+
executionDelayMs: 0,
|
|
1838
|
+
primaryExecutionTimestamp: candle.timestamp
|
|
1839
|
+
};
|
|
1840
|
+
}
|
|
1829
1841
|
const requestedExecutionTimestamp = candle.timestamp + backtestExecutionDelayMs;
|
|
1830
1842
|
const primaryExecutionTimestamp = candle.timestamp;
|
|
1831
1843
|
if (!canUseLowerBacktestExecution || primaryIntervalMs == null) {
|
|
@@ -1895,7 +1907,7 @@ var createStrategyRuntime = ({
|
|
|
1895
1907
|
const execution = applyBacktestDelayedEntryExecution({
|
|
1896
1908
|
decision: pending.decision,
|
|
1897
1909
|
execution: executionCandleResolution,
|
|
1898
|
-
backtestPriceMode,
|
|
1910
|
+
backtestPriceMode: executionCandleResolution.source === "primary_timeframe" ? "open" : backtestPriceMode,
|
|
1899
1911
|
delayBars: pending.delayBars
|
|
1900
1912
|
});
|
|
1901
1913
|
if (execution.skipReason) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradejs/node",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Node-only runtime for the TradeJS open-source framework: strategies, backtests, Pine loading, and plugin registries.",
|
|
3
|
+
"version": "1.0.11",
|
|
4
|
+
"description": "Node-only runtime for the TradeJS open-source framework: strategies, backtests, Pine strategy loading, and plugin registries.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tradejs",
|
|
7
7
|
"trading",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@langchain/core": "^1.1.42",
|
|
69
69
|
"@langchain/openai": "^1.4.5",
|
|
70
|
-
"@tradejs/core": "^1.0.
|
|
71
|
-
"@tradejs/infra": "^1.0.
|
|
72
|
-
"@tradejs/types": "^1.0.
|
|
70
|
+
"@tradejs/core": "^1.0.11",
|
|
71
|
+
"@tradejs/infra": "^1.0.11",
|
|
72
|
+
"@tradejs/types": "^1.0.11",
|
|
73
73
|
"chalk": "4.1.2",
|
|
74
74
|
"ioredis": "5.8.0",
|
|
75
75
|
"pinets": "0.8.12",
|