@tradejs/node 1.0.5 → 1.0.6
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/ai.d.mts +31 -0
- package/dist/ai.d.ts +31 -0
- package/dist/ai.js +926 -0
- package/dist/ai.mjs +35 -0
- package/dist/backtest.js +408 -5687
- package/dist/backtest.mjs +331 -175
- package/dist/chunk-72FKXJ2I.mjs +473 -0
- package/dist/{chunk-P2ZUWONT.mjs → chunk-CGJ2UU6H.mjs} +1 -1
- package/dist/{chunk-ZY6ULOWK.mjs → chunk-EOZSJKUM.mjs} +1 -1
- package/dist/{chunk-7ICOZAKA.mjs → chunk-H6LIYHU4.mjs} +29 -11
- package/dist/{chunk-RBE4PZER.mjs → chunk-PQH5PAFC.mjs} +1 -1
- package/dist/{chunk-CIY64D57.mjs → chunk-XW5L327F.mjs} +1 -1
- package/dist/cli.d.mts +4 -4
- package/dist/cli.d.ts +4 -4
- package/dist/cli.js +711 -125
- package/dist/cli.mjs +199 -71
- package/dist/connectors.js +1 -1
- package/dist/connectors.mjs +2 -2
- package/dist/pine.d.mts +10 -6
- package/dist/pine.d.ts +10 -6
- package/dist/pine.js +40 -18
- package/dist/pine.mjs +21 -13
- package/dist/registry.js +1 -1
- package/dist/registry.mjs +2 -2
- package/dist/strategies.d.mts +6 -12
- package/dist/strategies.d.ts +6 -12
- package/dist/strategies.js +426 -83
- package/dist/strategies.mjs +200 -34
- package/package.json +9 -4
- package/dist/ai-G7ATN4YL.mjs +0 -19
- package/dist/chunk-LMAKIC3C.mjs +0 -294
package/dist/pine.mjs
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
createPineScriptLoader,
|
|
3
|
+
getLatestPineBooleanPlotValue,
|
|
4
|
+
getLatestPineBooleanPlotValues,
|
|
5
|
+
getLatestPineNumberPlotValue,
|
|
6
|
+
getLatestPineNumberPlotValues,
|
|
7
|
+
getLatestPineRawPlotValue,
|
|
6
8
|
getPinePlotSeries,
|
|
7
|
-
|
|
8
|
-
runPineScript
|
|
9
|
-
|
|
9
|
+
loadPineScriptFile,
|
|
10
|
+
runPineScript,
|
|
11
|
+
toFiniteNumber,
|
|
12
|
+
toPineBoolean
|
|
13
|
+
} from "./chunk-H6LIYHU4.mjs";
|
|
10
14
|
import "./chunk-6DZX6EAA.mjs";
|
|
11
15
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
createPineScriptLoader,
|
|
17
|
+
getLatestPineBooleanPlotValue,
|
|
18
|
+
getLatestPineBooleanPlotValues,
|
|
19
|
+
getLatestPineNumberPlotValue,
|
|
20
|
+
getLatestPineNumberPlotValues,
|
|
21
|
+
getLatestPineRawPlotValue,
|
|
16
22
|
getPinePlotSeries,
|
|
17
|
-
|
|
18
|
-
runPineScript
|
|
23
|
+
loadPineScriptFile,
|
|
24
|
+
runPineScript,
|
|
25
|
+
toFiniteNumber,
|
|
26
|
+
toPineBoolean
|
|
19
27
|
};
|
package/dist/registry.js
CHANGED
|
@@ -259,7 +259,7 @@ var loadTradejsConfig = async (cwd = getTradejsProjectCwd()) => {
|
|
|
259
259
|
cachedByCwd.set(cwd, config);
|
|
260
260
|
if (!announcedConfigFile.has(configFilePath)) {
|
|
261
261
|
announcedConfigFile.add(configFilePath);
|
|
262
|
-
import_logger.logger.log("
|
|
262
|
+
import_logger.logger.log("debug", "Loaded TradeJS config: %s", configFilePath);
|
|
263
263
|
}
|
|
264
264
|
return config;
|
|
265
265
|
} catch (error) {
|
package/dist/registry.mjs
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
registerStrategyEntries,
|
|
12
12
|
resetStrategyRegistryCache,
|
|
13
13
|
strategies
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-EOZSJKUM.mjs";
|
|
15
|
+
import "./chunk-CGJ2UU6H.mjs";
|
|
16
16
|
import "./chunk-6DZX6EAA.mjs";
|
|
17
17
|
export {
|
|
18
18
|
ensureIndicatorPluginsLoaded,
|
package/dist/strategies.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Connector, StrategyEntrySignalContext,
|
|
1
|
+
import { Connector, StrategyEntrySignalContext, StrategyConfig, CreateStrategyCore, StrategyManifest, StrategyCreator, Signal, Direction, StrategyRuntimeMlOptions, StrategyRuntimeAiOptions, Tp } from '@tradejs/types';
|
|
2
2
|
export * from '@tradejs/core/strategies';
|
|
3
|
+
export { DEFAULT_AI_MODEL, MAX_AI_SERIES_POINTS, askAI, buildAiHumanPrompt, buildAiPayload, buildAiPrompts, buildAiSystemPrompt, ensureAiStrategyPluginsLoaded, getDeterministicAiGateContext, getOpenRouterModelKwargs, resetAiRuntimeCache, runAiPrompt, runAiPromptLocal, trimSeriesDeep } from './ai.mjs';
|
|
3
4
|
export { ensureIndicatorPluginsLoaded, ensureStrategyPluginsLoaded, getAvailableStrategyNames, getRegisteredManifests, getRegisteredStrategies, getStrategyCreator, getStrategyManifest, isKnownStrategy, registerStrategyEntries, resetStrategyRegistryCache, strategies } from './registry.mjs';
|
|
4
5
|
|
|
5
6
|
type CloseOppositePositionsBeforeOpenOptions = {
|
|
@@ -8,14 +9,6 @@ type CloseOppositePositionsBeforeOpenOptions = {
|
|
|
8
9
|
};
|
|
9
10
|
declare const closeOppositePositionsBeforeOpen: ({ connector, entryContext, }: CloseOppositePositionsBeforeOpenOptions) => Promise<void>;
|
|
10
11
|
|
|
11
|
-
declare const MAX_AI_SERIES_POINTS = 5;
|
|
12
|
-
declare const trimSeriesDeep: (value: any) => any;
|
|
13
|
-
|
|
14
|
-
declare const buildAiSystemPrompt: (signal?: Signal) => string;
|
|
15
|
-
declare const buildAiPayload: (signal: Signal) => AiPayload;
|
|
16
|
-
declare const buildAiHumanPrompt: (signal: Signal, payload?: AiPayload) => string;
|
|
17
|
-
declare const askAI: (signal: Signal) => Promise<Partial<SignalAnalysis>>;
|
|
18
|
-
|
|
19
12
|
interface CreateStrategyRuntimeParams<TConfig extends StrategyConfig> {
|
|
20
13
|
strategyName: string;
|
|
21
14
|
defaults: TConfig;
|
|
@@ -39,6 +32,7 @@ declare const resolveStrategyConfig: <TConfig extends StrategyConfig>({ strategy
|
|
|
39
32
|
|
|
40
33
|
interface EnrichSignalWithMlAiParams {
|
|
41
34
|
signal: Signal;
|
|
35
|
+
userName?: string;
|
|
42
36
|
symbol: string;
|
|
43
37
|
direction: Direction;
|
|
44
38
|
env: string;
|
|
@@ -46,8 +40,8 @@ interface EnrichSignalWithMlAiParams {
|
|
|
46
40
|
ai?: StrategyRuntimeAiOptions;
|
|
47
41
|
}
|
|
48
42
|
declare const enrichSignalWithMl: ({ signal, env, ml, }: Pick<EnrichSignalWithMlAiParams, "signal" | "env" | "ml">) => Promise<void>;
|
|
49
|
-
declare const enrichSignalWithAi: ({ signal, symbol, direction, env, ai, }: Pick<EnrichSignalWithMlAiParams, "signal" | "symbol" | "direction" | "env" | "ai">) => Promise<number | undefined>;
|
|
50
|
-
declare const enrichSignalWithMlAi: ({ signal, symbol, direction, env, ml, ai, }: EnrichSignalWithMlAiParams) => Promise<number | undefined>;
|
|
43
|
+
declare const enrichSignalWithAi: ({ signal, symbol, userName, direction, env, ai, }: Pick<EnrichSignalWithMlAiParams, "signal" | "userName" | "symbol" | "direction" | "env" | "ai">) => Promise<number | undefined>;
|
|
44
|
+
declare const enrichSignalWithMlAi: ({ signal, userName, symbol, direction, env, ml, ai, }: EnrichSignalWithMlAiParams) => Promise<number | undefined>;
|
|
51
45
|
interface ExecuteEntryOrderParams {
|
|
52
46
|
connector: Connector;
|
|
53
47
|
symbol: string;
|
|
@@ -68,4 +62,4 @@ interface CreateCloseOppositeBeforePlaceOrderHookParams {
|
|
|
68
62
|
}
|
|
69
63
|
declare const createCloseOppositeBeforePlaceOrderHook: ({ isEnabled, }: CreateCloseOppositeBeforePlaceOrderHookParams) => BeforePlaceOrderHook;
|
|
70
64
|
|
|
71
|
-
export {
|
|
65
|
+
export { closeOppositePositionsBeforeOpen, createCloseOppositeBeforePlaceOrderHook, createStrategyRuntime, enrichSignalWithAi, enrichSignalWithMl, enrichSignalWithMlAi, executeEntryOrder, resolveStrategyConfig };
|
package/dist/strategies.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Connector, StrategyEntrySignalContext,
|
|
1
|
+
import { Connector, StrategyEntrySignalContext, StrategyConfig, CreateStrategyCore, StrategyManifest, StrategyCreator, Signal, Direction, StrategyRuntimeMlOptions, StrategyRuntimeAiOptions, Tp } from '@tradejs/types';
|
|
2
2
|
export * from '@tradejs/core/strategies';
|
|
3
|
+
export { DEFAULT_AI_MODEL, MAX_AI_SERIES_POINTS, askAI, buildAiHumanPrompt, buildAiPayload, buildAiPrompts, buildAiSystemPrompt, ensureAiStrategyPluginsLoaded, getDeterministicAiGateContext, getOpenRouterModelKwargs, resetAiRuntimeCache, runAiPrompt, runAiPromptLocal, trimSeriesDeep } from './ai.js';
|
|
3
4
|
export { ensureIndicatorPluginsLoaded, ensureStrategyPluginsLoaded, getAvailableStrategyNames, getRegisteredManifests, getRegisteredStrategies, getStrategyCreator, getStrategyManifest, isKnownStrategy, registerStrategyEntries, resetStrategyRegistryCache, strategies } from './registry.js';
|
|
4
5
|
|
|
5
6
|
type CloseOppositePositionsBeforeOpenOptions = {
|
|
@@ -8,14 +9,6 @@ type CloseOppositePositionsBeforeOpenOptions = {
|
|
|
8
9
|
};
|
|
9
10
|
declare const closeOppositePositionsBeforeOpen: ({ connector, entryContext, }: CloseOppositePositionsBeforeOpenOptions) => Promise<void>;
|
|
10
11
|
|
|
11
|
-
declare const MAX_AI_SERIES_POINTS = 5;
|
|
12
|
-
declare const trimSeriesDeep: (value: any) => any;
|
|
13
|
-
|
|
14
|
-
declare const buildAiSystemPrompt: (signal?: Signal) => string;
|
|
15
|
-
declare const buildAiPayload: (signal: Signal) => AiPayload;
|
|
16
|
-
declare const buildAiHumanPrompt: (signal: Signal, payload?: AiPayload) => string;
|
|
17
|
-
declare const askAI: (signal: Signal) => Promise<Partial<SignalAnalysis>>;
|
|
18
|
-
|
|
19
12
|
interface CreateStrategyRuntimeParams<TConfig extends StrategyConfig> {
|
|
20
13
|
strategyName: string;
|
|
21
14
|
defaults: TConfig;
|
|
@@ -39,6 +32,7 @@ declare const resolveStrategyConfig: <TConfig extends StrategyConfig>({ strategy
|
|
|
39
32
|
|
|
40
33
|
interface EnrichSignalWithMlAiParams {
|
|
41
34
|
signal: Signal;
|
|
35
|
+
userName?: string;
|
|
42
36
|
symbol: string;
|
|
43
37
|
direction: Direction;
|
|
44
38
|
env: string;
|
|
@@ -46,8 +40,8 @@ interface EnrichSignalWithMlAiParams {
|
|
|
46
40
|
ai?: StrategyRuntimeAiOptions;
|
|
47
41
|
}
|
|
48
42
|
declare const enrichSignalWithMl: ({ signal, env, ml, }: Pick<EnrichSignalWithMlAiParams, "signal" | "env" | "ml">) => Promise<void>;
|
|
49
|
-
declare const enrichSignalWithAi: ({ signal, symbol, direction, env, ai, }: Pick<EnrichSignalWithMlAiParams, "signal" | "symbol" | "direction" | "env" | "ai">) => Promise<number | undefined>;
|
|
50
|
-
declare const enrichSignalWithMlAi: ({ signal, symbol, direction, env, ml, ai, }: EnrichSignalWithMlAiParams) => Promise<number | undefined>;
|
|
43
|
+
declare const enrichSignalWithAi: ({ signal, symbol, userName, direction, env, ai, }: Pick<EnrichSignalWithMlAiParams, "signal" | "userName" | "symbol" | "direction" | "env" | "ai">) => Promise<number | undefined>;
|
|
44
|
+
declare const enrichSignalWithMlAi: ({ signal, userName, symbol, direction, env, ml, ai, }: EnrichSignalWithMlAiParams) => Promise<number | undefined>;
|
|
51
45
|
interface ExecuteEntryOrderParams {
|
|
52
46
|
connector: Connector;
|
|
53
47
|
symbol: string;
|
|
@@ -68,4 +62,4 @@ interface CreateCloseOppositeBeforePlaceOrderHookParams {
|
|
|
68
62
|
}
|
|
69
63
|
declare const createCloseOppositeBeforePlaceOrderHook: ({ isEnabled, }: CreateCloseOppositeBeforePlaceOrderHookParams) => BeforePlaceOrderHook;
|
|
70
64
|
|
|
71
|
-
export {
|
|
65
|
+
export { closeOppositePositionsBeforeOpen, createCloseOppositeBeforePlaceOrderHook, createStrategyRuntime, enrichSignalWithAi, enrichSignalWithMl, enrichSignalWithMlAi, executeEntryOrder, resolveStrategyConfig };
|