@tradejs/core 1.0.5 → 1.0.8

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/config.js CHANGED
@@ -23,18 +23,53 @@ __export(config_exports, {
23
23
  defineConfig: () => defineConfig,
24
24
  defineConnectorPlugin: () => defineConnectorPlugin,
25
25
  defineIndicatorPlugin: () => defineIndicatorPlugin,
26
- defineStrategyPlugin: () => defineStrategyPlugin
26
+ defineStrategyPlugin: () => defineStrategyPlugin,
27
+ mergeTradejsConfigHooks: () => mergeTradejsConfigHooks,
28
+ normalizeTradejsConfigHooks: () => normalizeTradejsConfigHooks
27
29
  });
28
30
  module.exports = __toCommonJS(config_exports);
29
31
  var normalizePlugins = (values) => Array.isArray(values) ? values.map((value) => String(value ?? "").trim()).filter(Boolean) : [];
30
32
  var mergePluginSpecifiers = (...groups) => [
31
33
  ...new Set(groups.flatMap((group) => normalizePlugins(group)))
32
34
  ];
35
+ var normalizeHookList = (value) => {
36
+ if (Array.isArray(value)) {
37
+ return value.filter((item) => typeof item === "function");
38
+ }
39
+ return typeof value === "function" ? [value] : [];
40
+ };
41
+ var mergeHookLists = (...groups) => [...new Set(groups.flatMap((group) => normalizeHookList(group)))];
42
+ var setMergedHook = (key, groups, target) => {
43
+ const merged = mergeHookLists(...groups.map((group) => group?.[key]));
44
+ if (merged.length > 0) {
45
+ target[key] = merged;
46
+ }
47
+ };
48
+ var mergeTradejsConfigHooks = (...groups) => {
49
+ const hooks = {};
50
+ setMergedHook("beforeSignals", groups, hooks);
51
+ setMergedHook("afterSignals", groups, hooks);
52
+ setMergedHook("onInit", groups, hooks);
53
+ setMergedHook("onBar", groups, hooks);
54
+ setMergedHook("afterCoreDecision", groups, hooks);
55
+ setMergedHook("afterBarDecision", groups, hooks);
56
+ setMergedHook("onSkip", groups, hooks);
57
+ setMergedHook("beforeClosePosition", groups, hooks);
58
+ setMergedHook("afterEnrichMl", groups, hooks);
59
+ setMergedHook("afterEnrichAi", groups, hooks);
60
+ setMergedHook("beforeEntryGate", groups, hooks);
61
+ setMergedHook("beforePlaceOrder", groups, hooks);
62
+ setMergedHook("afterPlaceOrder", groups, hooks);
63
+ setMergedHook("onRuntimeError", groups, hooks);
64
+ return Object.keys(hooks).length > 0 ? hooks : void 0;
65
+ };
66
+ var normalizeTradejsConfigHooks = (hooks) => mergeTradejsConfigHooks(hooks);
33
67
  function defineConfig(...configs) {
34
68
  return {
35
69
  strategies: mergePluginSpecifiers(...configs.map((cfg) => cfg.strategies)),
36
70
  indicators: mergePluginSpecifiers(...configs.map((cfg) => cfg.indicators)),
37
- connectors: mergePluginSpecifiers(...configs.map((cfg) => cfg.connectors))
71
+ connectors: mergePluginSpecifiers(...configs.map((cfg) => cfg.connectors)),
72
+ hooks: mergeTradejsConfigHooks(...configs.map((cfg) => cfg.hooks))
38
73
  };
39
74
  }
40
75
  var defineStrategyPlugin = (plugin) => plugin;
@@ -45,5 +80,7 @@ var defineConnectorPlugin = (plugin) => plugin;
45
80
  defineConfig,
46
81
  defineConnectorPlugin,
47
82
  defineIndicatorPlugin,
48
- defineStrategyPlugin
83
+ defineStrategyPlugin,
84
+ mergeTradejsConfigHooks,
85
+ normalizeTradejsConfigHooks
49
86
  });
package/dist/config.mjs CHANGED
@@ -3,11 +3,44 @@ var normalizePlugins = (values) => Array.isArray(values) ? values.map((value) =>
3
3
  var mergePluginSpecifiers = (...groups) => [
4
4
  ...new Set(groups.flatMap((group) => normalizePlugins(group)))
5
5
  ];
6
+ var normalizeHookList = (value) => {
7
+ if (Array.isArray(value)) {
8
+ return value.filter((item) => typeof item === "function");
9
+ }
10
+ return typeof value === "function" ? [value] : [];
11
+ };
12
+ var mergeHookLists = (...groups) => [...new Set(groups.flatMap((group) => normalizeHookList(group)))];
13
+ var setMergedHook = (key, groups, target) => {
14
+ const merged = mergeHookLists(...groups.map((group) => group?.[key]));
15
+ if (merged.length > 0) {
16
+ target[key] = merged;
17
+ }
18
+ };
19
+ var mergeTradejsConfigHooks = (...groups) => {
20
+ const hooks = {};
21
+ setMergedHook("beforeSignals", groups, hooks);
22
+ setMergedHook("afterSignals", groups, hooks);
23
+ setMergedHook("onInit", groups, hooks);
24
+ setMergedHook("onBar", groups, hooks);
25
+ setMergedHook("afterCoreDecision", groups, hooks);
26
+ setMergedHook("afterBarDecision", groups, hooks);
27
+ setMergedHook("onSkip", groups, hooks);
28
+ setMergedHook("beforeClosePosition", groups, hooks);
29
+ setMergedHook("afterEnrichMl", groups, hooks);
30
+ setMergedHook("afterEnrichAi", groups, hooks);
31
+ setMergedHook("beforeEntryGate", groups, hooks);
32
+ setMergedHook("beforePlaceOrder", groups, hooks);
33
+ setMergedHook("afterPlaceOrder", groups, hooks);
34
+ setMergedHook("onRuntimeError", groups, hooks);
35
+ return Object.keys(hooks).length > 0 ? hooks : void 0;
36
+ };
37
+ var normalizeTradejsConfigHooks = (hooks) => mergeTradejsConfigHooks(hooks);
6
38
  function defineConfig(...configs) {
7
39
  return {
8
40
  strategies: mergePluginSpecifiers(...configs.map((cfg) => cfg.strategies)),
9
41
  indicators: mergePluginSpecifiers(...configs.map((cfg) => cfg.indicators)),
10
- connectors: mergePluginSpecifiers(...configs.map((cfg) => cfg.connectors))
42
+ connectors: mergePluginSpecifiers(...configs.map((cfg) => cfg.connectors)),
43
+ hooks: mergeTradejsConfigHooks(...configs.map((cfg) => cfg.hooks))
11
44
  };
12
45
  }
13
46
  var defineStrategyPlugin = (plugin) => plugin;
@@ -17,5 +50,7 @@ export {
17
50
  defineConfig,
18
51
  defineConnectorPlugin,
19
52
  defineIndicatorPlugin,
20
- defineStrategyPlugin
53
+ defineStrategyPlugin,
54
+ mergeTradejsConfigHooks,
55
+ normalizeTradejsConfigHooks
21
56
  };
@@ -5,7 +5,9 @@ declare const CORRELATION_WINDOW = 50;
5
5
  declare const SPREAD_WINDOW = 50;
6
6
  declare const PRELOAD_DAYS = 200;
7
7
  declare const SIGNALS_PRELOAD_DAYS = 60;
8
- declare const BACKTEST_PRELOAD_DAYS = 160;
8
+ declare const SIGNALS_CLI_PRELOAD_DAYS = 10;
9
+ declare const BACKTEST_DEFAULT_DAYS = 160;
10
+ declare const BACKTEST_PRELOAD_DAYS = 60;
9
11
  declare const DASHBOARD_PRELOAD_DAYS = 160;
10
12
  declare const BOT_PRELOAD_DAYS = 160;
11
13
  declare const PRELOAD_FALLBACK_DAYS = 160;
@@ -13,6 +15,7 @@ declare const TTL_1H = 3600;
13
15
  declare const TTL_3H = 10800;
14
16
  declare const TTL_12H = 43300;
15
17
  declare const TTL_1D = 86400;
18
+ declare const TTL_3D = 259200;
16
19
  declare const TTL_1M = 2600000;
17
20
  declare const TTL_3M = 7800000;
18
21
  declare const TESTS_TOP_LIMIT = 50;
@@ -21,6 +24,7 @@ declare const TESTS_ORDERS_MIN_LIMIT = 3;
21
24
  declare const MARKET_CATEGORY = "linear";
22
25
  declare const ML_CANDLE_FEATURE_WINDOW = 50;
23
26
  declare const ML_BASE_CANDLES_WINDOW = 50;
27
+ declare const DERIVATIVES_CONTEXT_REFERENCE_SYMBOLS: readonly ["BTCUSDT", "ETHUSDT"];
24
28
  declare const TRENDLINE_DEFAULTS: {
25
29
  maxLines: number;
26
30
  range: number;
@@ -38,4 +42,4 @@ declare const TRENDLINE_DEFAULTS: {
38
42
  };
39
43
  declare const TestThresholdsConfig: TestThresholds;
40
44
 
41
- export { BACKTEST_PRELOAD_DAYS, BOT_PRELOAD_DAYS, CORRELATION_WINDOW, DASHBOARD_PRELOAD_DAYS, FEE_PERCENT, MARKET_CATEGORY, ML_BASE_CANDLES_WINDOW, ML_CANDLE_FEATURE_WINDOW, PRELOAD_DAYS, PRELOAD_FALLBACK_DAYS, SIGNALS_PRELOAD_DAYS, SPREAD_WINDOW, TESTS_LIMIT, TESTS_ORDERS_MIN_LIMIT, TESTS_TOP_LIMIT, TRENDLINE_DEFAULTS, TTL_12H, TTL_1D, TTL_1H, TTL_1M, TTL_3H, TTL_3M, TestThresholdsConfig };
45
+ export { BACKTEST_DEFAULT_DAYS, BACKTEST_PRELOAD_DAYS, BOT_PRELOAD_DAYS, CORRELATION_WINDOW, DASHBOARD_PRELOAD_DAYS, DERIVATIVES_CONTEXT_REFERENCE_SYMBOLS, FEE_PERCENT, MARKET_CATEGORY, ML_BASE_CANDLES_WINDOW, ML_CANDLE_FEATURE_WINDOW, PRELOAD_DAYS, PRELOAD_FALLBACK_DAYS, SIGNALS_CLI_PRELOAD_DAYS, SIGNALS_PRELOAD_DAYS, SPREAD_WINDOW, TESTS_LIMIT, TESTS_ORDERS_MIN_LIMIT, TESTS_TOP_LIMIT, TRENDLINE_DEFAULTS, TTL_12H, TTL_1D, TTL_1H, TTL_1M, TTL_3D, TTL_3H, TTL_3M, TestThresholdsConfig };
@@ -5,7 +5,9 @@ declare const CORRELATION_WINDOW = 50;
5
5
  declare const SPREAD_WINDOW = 50;
6
6
  declare const PRELOAD_DAYS = 200;
7
7
  declare const SIGNALS_PRELOAD_DAYS = 60;
8
- declare const BACKTEST_PRELOAD_DAYS = 160;
8
+ declare const SIGNALS_CLI_PRELOAD_DAYS = 10;
9
+ declare const BACKTEST_DEFAULT_DAYS = 160;
10
+ declare const BACKTEST_PRELOAD_DAYS = 60;
9
11
  declare const DASHBOARD_PRELOAD_DAYS = 160;
10
12
  declare const BOT_PRELOAD_DAYS = 160;
11
13
  declare const PRELOAD_FALLBACK_DAYS = 160;
@@ -13,6 +15,7 @@ declare const TTL_1H = 3600;
13
15
  declare const TTL_3H = 10800;
14
16
  declare const TTL_12H = 43300;
15
17
  declare const TTL_1D = 86400;
18
+ declare const TTL_3D = 259200;
16
19
  declare const TTL_1M = 2600000;
17
20
  declare const TTL_3M = 7800000;
18
21
  declare const TESTS_TOP_LIMIT = 50;
@@ -21,6 +24,7 @@ declare const TESTS_ORDERS_MIN_LIMIT = 3;
21
24
  declare const MARKET_CATEGORY = "linear";
22
25
  declare const ML_CANDLE_FEATURE_WINDOW = 50;
23
26
  declare const ML_BASE_CANDLES_WINDOW = 50;
27
+ declare const DERIVATIVES_CONTEXT_REFERENCE_SYMBOLS: readonly ["BTCUSDT", "ETHUSDT"];
24
28
  declare const TRENDLINE_DEFAULTS: {
25
29
  maxLines: number;
26
30
  range: number;
@@ -38,4 +42,4 @@ declare const TRENDLINE_DEFAULTS: {
38
42
  };
39
43
  declare const TestThresholdsConfig: TestThresholds;
40
44
 
41
- export { BACKTEST_PRELOAD_DAYS, BOT_PRELOAD_DAYS, CORRELATION_WINDOW, DASHBOARD_PRELOAD_DAYS, FEE_PERCENT, MARKET_CATEGORY, ML_BASE_CANDLES_WINDOW, ML_CANDLE_FEATURE_WINDOW, PRELOAD_DAYS, PRELOAD_FALLBACK_DAYS, SIGNALS_PRELOAD_DAYS, SPREAD_WINDOW, TESTS_LIMIT, TESTS_ORDERS_MIN_LIMIT, TESTS_TOP_LIMIT, TRENDLINE_DEFAULTS, TTL_12H, TTL_1D, TTL_1H, TTL_1M, TTL_3H, TTL_3M, TestThresholdsConfig };
45
+ export { BACKTEST_DEFAULT_DAYS, BACKTEST_PRELOAD_DAYS, BOT_PRELOAD_DAYS, CORRELATION_WINDOW, DASHBOARD_PRELOAD_DAYS, DERIVATIVES_CONTEXT_REFERENCE_SYMBOLS, FEE_PERCENT, MARKET_CATEGORY, ML_BASE_CANDLES_WINDOW, ML_CANDLE_FEATURE_WINDOW, PRELOAD_DAYS, PRELOAD_FALLBACK_DAYS, SIGNALS_CLI_PRELOAD_DAYS, SIGNALS_PRELOAD_DAYS, SPREAD_WINDOW, TESTS_LIMIT, TESTS_ORDERS_MIN_LIMIT, TESTS_TOP_LIMIT, TRENDLINE_DEFAULTS, TTL_12H, TTL_1D, TTL_1H, TTL_1M, TTL_3D, TTL_3H, TTL_3M, TestThresholdsConfig };
package/dist/constants.js CHANGED
@@ -20,16 +20,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/constants.ts
21
21
  var constants_exports = {};
22
22
  __export(constants_exports, {
23
+ BACKTEST_DEFAULT_DAYS: () => BACKTEST_DEFAULT_DAYS,
23
24
  BACKTEST_PRELOAD_DAYS: () => BACKTEST_PRELOAD_DAYS,
24
25
  BOT_PRELOAD_DAYS: () => BOT_PRELOAD_DAYS,
25
26
  CORRELATION_WINDOW: () => CORRELATION_WINDOW,
26
27
  DASHBOARD_PRELOAD_DAYS: () => DASHBOARD_PRELOAD_DAYS,
28
+ DERIVATIVES_CONTEXT_REFERENCE_SYMBOLS: () => DERIVATIVES_CONTEXT_REFERENCE_SYMBOLS,
27
29
  FEE_PERCENT: () => FEE_PERCENT,
28
30
  MARKET_CATEGORY: () => MARKET_CATEGORY,
29
31
  ML_BASE_CANDLES_WINDOW: () => ML_BASE_CANDLES_WINDOW,
30
32
  ML_CANDLE_FEATURE_WINDOW: () => ML_CANDLE_FEATURE_WINDOW,
31
33
  PRELOAD_DAYS: () => PRELOAD_DAYS,
32
34
  PRELOAD_FALLBACK_DAYS: () => PRELOAD_FALLBACK_DAYS,
35
+ SIGNALS_CLI_PRELOAD_DAYS: () => SIGNALS_CLI_PRELOAD_DAYS,
33
36
  SIGNALS_PRELOAD_DAYS: () => SIGNALS_PRELOAD_DAYS,
34
37
  SPREAD_WINDOW: () => SPREAD_WINDOW,
35
38
  TESTS_LIMIT: () => TESTS_LIMIT,
@@ -40,6 +43,7 @@ __export(constants_exports, {
40
43
  TTL_1D: () => TTL_1D,
41
44
  TTL_1H: () => TTL_1H,
42
45
  TTL_1M: () => TTL_1M,
46
+ TTL_3D: () => TTL_3D,
43
47
  TTL_3H: () => TTL_3H,
44
48
  TTL_3M: () => TTL_3M,
45
49
  TestThresholdsConfig: () => TestThresholdsConfig
@@ -52,7 +56,9 @@ var CORRELATION_WINDOW = 50;
52
56
  var SPREAD_WINDOW = 50;
53
57
  var PRELOAD_DAYS = 200;
54
58
  var SIGNALS_PRELOAD_DAYS = 60;
55
- var BACKTEST_PRELOAD_DAYS = 160;
59
+ var SIGNALS_CLI_PRELOAD_DAYS = 10;
60
+ var BACKTEST_DEFAULT_DAYS = 160;
61
+ var BACKTEST_PRELOAD_DAYS = 60;
56
62
  var DASHBOARD_PRELOAD_DAYS = 160;
57
63
  var BOT_PRELOAD_DAYS = 160;
58
64
  var PRELOAD_FALLBACK_DAYS = 160;
@@ -60,6 +66,7 @@ var TTL_1H = 3600;
60
66
  var TTL_3H = 10800;
61
67
  var TTL_12H = 43300;
62
68
  var TTL_1D = 86400;
69
+ var TTL_3D = 259200;
63
70
  var TTL_1M = 26e5;
64
71
  var TTL_3M = 78e5;
65
72
  var TESTS_TOP_LIMIT = 50;
@@ -68,6 +75,10 @@ var TESTS_ORDERS_MIN_LIMIT = 3;
68
75
  var MARKET_CATEGORY = "linear";
69
76
  var ML_CANDLE_FEATURE_WINDOW = 50;
70
77
  var ML_BASE_CANDLES_WINDOW = 50;
78
+ var DERIVATIVES_CONTEXT_REFERENCE_SYMBOLS = [
79
+ "BTCUSDT",
80
+ "ETHUSDT"
81
+ ];
71
82
  var TRENDLINE_DEFAULTS = {
72
83
  maxLines: 20,
73
84
  range: 15,
@@ -212,16 +223,19 @@ var TestThresholdsConfig = {
212
223
  };
213
224
  // Annotate the CommonJS export names for ESM import in node:
214
225
  0 && (module.exports = {
226
+ BACKTEST_DEFAULT_DAYS,
215
227
  BACKTEST_PRELOAD_DAYS,
216
228
  BOT_PRELOAD_DAYS,
217
229
  CORRELATION_WINDOW,
218
230
  DASHBOARD_PRELOAD_DAYS,
231
+ DERIVATIVES_CONTEXT_REFERENCE_SYMBOLS,
219
232
  FEE_PERCENT,
220
233
  MARKET_CATEGORY,
221
234
  ML_BASE_CANDLES_WINDOW,
222
235
  ML_CANDLE_FEATURE_WINDOW,
223
236
  PRELOAD_DAYS,
224
237
  PRELOAD_FALLBACK_DAYS,
238
+ SIGNALS_CLI_PRELOAD_DAYS,
225
239
  SIGNALS_PRELOAD_DAYS,
226
240
  SPREAD_WINDOW,
227
241
  TESTS_LIMIT,
@@ -232,6 +246,7 @@ var TestThresholdsConfig = {
232
246
  TTL_1D,
233
247
  TTL_1H,
234
248
  TTL_1M,
249
+ TTL_3D,
235
250
  TTL_3H,
236
251
  TTL_3M,
237
252
  TestThresholdsConfig
@@ -1,14 +1,17 @@
1
1
  import {
2
+ BACKTEST_DEFAULT_DAYS,
2
3
  BACKTEST_PRELOAD_DAYS,
3
4
  BOT_PRELOAD_DAYS,
4
5
  CORRELATION_WINDOW,
5
6
  DASHBOARD_PRELOAD_DAYS,
7
+ DERIVATIVES_CONTEXT_REFERENCE_SYMBOLS,
6
8
  FEE_PERCENT,
7
9
  MARKET_CATEGORY,
8
10
  ML_BASE_CANDLES_WINDOW,
9
11
  ML_CANDLE_FEATURE_WINDOW,
10
12
  PRELOAD_DAYS,
11
13
  PRELOAD_FALLBACK_DAYS,
14
+ SIGNALS_CLI_PRELOAD_DAYS,
12
15
  SIGNALS_PRELOAD_DAYS,
13
16
  SPREAD_WINDOW,
14
17
  TESTS_LIMIT,
@@ -19,21 +22,25 @@ import {
19
22
  TTL_1D,
20
23
  TTL_1H,
21
24
  TTL_1M,
25
+ TTL_3D,
22
26
  TTL_3H,
23
27
  TTL_3M,
24
28
  TestThresholdsConfig
25
- } from "./chunk-JG2QPVAV.mjs";
29
+ } from "./chunk-JLORHLL6.mjs";
26
30
  export {
31
+ BACKTEST_DEFAULT_DAYS,
27
32
  BACKTEST_PRELOAD_DAYS,
28
33
  BOT_PRELOAD_DAYS,
29
34
  CORRELATION_WINDOW,
30
35
  DASHBOARD_PRELOAD_DAYS,
36
+ DERIVATIVES_CONTEXT_REFERENCE_SYMBOLS,
31
37
  FEE_PERCENT,
32
38
  MARKET_CATEGORY,
33
39
  ML_BASE_CANDLES_WINDOW,
34
40
  ML_CANDLE_FEATURE_WINDOW,
35
41
  PRELOAD_DAYS,
36
42
  PRELOAD_FALLBACK_DAYS,
43
+ SIGNALS_CLI_PRELOAD_DAYS,
37
44
  SIGNALS_PRELOAD_DAYS,
38
45
  SPREAD_WINDOW,
39
46
  TESTS_LIMIT,
@@ -44,6 +51,7 @@ export {
44
51
  TTL_1D,
45
52
  TTL_1H,
46
53
  TTL_1M,
54
+ TTL_3D,
47
55
  TTL_3H,
48
56
  TTL_3M,
49
57
  TestThresholdsConfig
@@ -1,4 +1,4 @@
1
- import { KlineChartItem, DerivativesInterval, DerivativesRow, IndicatorPluginRenderer, Indicator, IndicatorPluginEntry, SpreadRow, TrendLine, TrendLineOptions } from '@tradejs/types';
1
+ import { KlineChartItem, DerivativesInterval, DerivativesRow, Direction, DerivativesContext, IndicatorPluginRenderer, Indicator, IndicatorPluginEntry, SpreadRow, TrendLine, TrendLineOptions } from '@tradejs/types';
2
2
  export { I as IndicatorPeriods, a as applyIndicatorsToHistory, b as buildMlCandleIndicators, c as buildMlTimeframeIndicators, d as createIndicators } from './indicators-B-GGjP5F.mjs';
3
3
  import { KLineData } from 'klinecharts';
4
4
 
@@ -50,6 +50,15 @@ declare const mergeCoinalyzeMetrics: (params: {
50
50
  }) => CoinalyzePoint[];
51
51
  declare const coinalyzePointsToRows: (points: CoinalyzePoint[], interval: DerivativesInterval, source: string) => DerivativesRow[];
52
52
 
53
+ declare const buildDerivativesContext: (params: {
54
+ symbol: string;
55
+ direction: Direction;
56
+ timestamp: number;
57
+ rowsByInterval: Partial<Record<DerivativesInterval, DerivativesRow[]>>;
58
+ intervals?: DerivativesInterval[];
59
+ staleAfterMsByInterval?: Partial<Record<DerivativesInterval, number>>;
60
+ }) => DerivativesContext;
61
+
53
62
  declare const registerIndicatorEntries: (entries: readonly IndicatorPluginEntry[], source: string, scope?: string) => void;
54
63
  declare const getRegisteredIndicatorEntries: (scope?: string) => IndicatorPluginEntry[];
55
64
  declare const getPluginIndicatorCatalog: (scope?: string) => Indicator[];
@@ -119,4 +128,4 @@ type TrendlineEngine = {
119
128
  };
120
129
  declare const createTrendlineEngine: (initialCandles: KLineData[], options: TrendLineOptions) => TrendlineEngine;
121
130
 
122
- export { type CoinalyzePoint, type IndicatorRendererDescriptor, type PricePoint, type TrendlineEngine, alignSortedCandlesByTimestamp, alignSpreadRows, buildReturnsFromCandles, calculateCoinBtcCorrelation, calculatePearsonCorrelation, coinalyzePointsToRows, coinbaseProductFromSymbol, createSpreadSmoother, createTrendlineEngine, detectRawSupportResistance, getPluginIndicatorCatalog, getPluginIndicatorRenderers, getRegisteredIndicatorEntries, getSupportResistanceLevels, intervalToMs, mergeCoinalyzeMetrics, normalizeCoinalyzeSymbols, normalizeDerivativesIntervals, registerIndicatorEntries, resetIndicatorRegistryCache, rollingMeanStd, smoothSpreadSeries, toArrayData, toCoinalyzeTimestampMs, toFiniteNumber };
131
+ export { type CoinalyzePoint, type IndicatorRendererDescriptor, type PricePoint, type TrendlineEngine, alignSortedCandlesByTimestamp, alignSpreadRows, buildDerivativesContext, buildReturnsFromCandles, calculateCoinBtcCorrelation, calculatePearsonCorrelation, coinalyzePointsToRows, coinbaseProductFromSymbol, createSpreadSmoother, createTrendlineEngine, detectRawSupportResistance, getPluginIndicatorCatalog, getPluginIndicatorRenderers, getRegisteredIndicatorEntries, getSupportResistanceLevels, intervalToMs, mergeCoinalyzeMetrics, normalizeCoinalyzeSymbols, normalizeDerivativesIntervals, registerIndicatorEntries, resetIndicatorRegistryCache, rollingMeanStd, smoothSpreadSeries, toArrayData, toCoinalyzeTimestampMs, toFiniteNumber };
@@ -1,4 +1,4 @@
1
- import { KlineChartItem, DerivativesInterval, DerivativesRow, IndicatorPluginRenderer, Indicator, IndicatorPluginEntry, SpreadRow, TrendLine, TrendLineOptions } from '@tradejs/types';
1
+ import { KlineChartItem, DerivativesInterval, DerivativesRow, Direction, DerivativesContext, IndicatorPluginRenderer, Indicator, IndicatorPluginEntry, SpreadRow, TrendLine, TrendLineOptions } from '@tradejs/types';
2
2
  export { I as IndicatorPeriods, a as applyIndicatorsToHistory, b as buildMlCandleIndicators, c as buildMlTimeframeIndicators, d as createIndicators } from './indicators-B-GGjP5F.js';
3
3
  import { KLineData } from 'klinecharts';
4
4
 
@@ -50,6 +50,15 @@ declare const mergeCoinalyzeMetrics: (params: {
50
50
  }) => CoinalyzePoint[];
51
51
  declare const coinalyzePointsToRows: (points: CoinalyzePoint[], interval: DerivativesInterval, source: string) => DerivativesRow[];
52
52
 
53
+ declare const buildDerivativesContext: (params: {
54
+ symbol: string;
55
+ direction: Direction;
56
+ timestamp: number;
57
+ rowsByInterval: Partial<Record<DerivativesInterval, DerivativesRow[]>>;
58
+ intervals?: DerivativesInterval[];
59
+ staleAfterMsByInterval?: Partial<Record<DerivativesInterval, number>>;
60
+ }) => DerivativesContext;
61
+
53
62
  declare const registerIndicatorEntries: (entries: readonly IndicatorPluginEntry[], source: string, scope?: string) => void;
54
63
  declare const getRegisteredIndicatorEntries: (scope?: string) => IndicatorPluginEntry[];
55
64
  declare const getPluginIndicatorCatalog: (scope?: string) => Indicator[];
@@ -119,4 +128,4 @@ type TrendlineEngine = {
119
128
  };
120
129
  declare const createTrendlineEngine: (initialCandles: KLineData[], options: TrendLineOptions) => TrendlineEngine;
121
130
 
122
- export { type CoinalyzePoint, type IndicatorRendererDescriptor, type PricePoint, type TrendlineEngine, alignSortedCandlesByTimestamp, alignSpreadRows, buildReturnsFromCandles, calculateCoinBtcCorrelation, calculatePearsonCorrelation, coinalyzePointsToRows, coinbaseProductFromSymbol, createSpreadSmoother, createTrendlineEngine, detectRawSupportResistance, getPluginIndicatorCatalog, getPluginIndicatorRenderers, getRegisteredIndicatorEntries, getSupportResistanceLevels, intervalToMs, mergeCoinalyzeMetrics, normalizeCoinalyzeSymbols, normalizeDerivativesIntervals, registerIndicatorEntries, resetIndicatorRegistryCache, rollingMeanStd, smoothSpreadSeries, toArrayData, toCoinalyzeTimestampMs, toFiniteNumber };
131
+ export { type CoinalyzePoint, type IndicatorRendererDescriptor, type PricePoint, type TrendlineEngine, alignSortedCandlesByTimestamp, alignSpreadRows, buildDerivativesContext, buildReturnsFromCandles, calculateCoinBtcCorrelation, calculatePearsonCorrelation, coinalyzePointsToRows, coinbaseProductFromSymbol, createSpreadSmoother, createTrendlineEngine, detectRawSupportResistance, getPluginIndicatorCatalog, getPluginIndicatorRenderers, getRegisteredIndicatorEntries, getSupportResistanceLevels, intervalToMs, mergeCoinalyzeMetrics, normalizeCoinalyzeSymbols, normalizeDerivativesIntervals, registerIndicatorEntries, resetIndicatorRegistryCache, rollingMeanStd, smoothSpreadSeries, toArrayData, toCoinalyzeTimestampMs, toFiniteNumber };