@tradejs/core 1.0.9 → 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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/backtest.d.mts +109 -9
  3. package/dist/backtest.d.ts +109 -9
  4. package/dist/backtest.js +487 -145
  5. package/dist/backtest.mjs +414 -82
  6. package/dist/{chunk-FNLPYYML.mjs → chunk-BOETNABM.mjs} +22 -1
  7. package/dist/chunk-EQEIRB6P.mjs +11847 -0
  8. package/dist/{chunk-2ORZC66W.mjs → chunk-MKCQSB4H.mjs} +65 -6
  9. package/dist/chunk-OJPHC3S2.mjs +8 -0
  10. package/dist/constants.d.mts +26 -5
  11. package/dist/constants.d.ts +26 -5
  12. package/dist/constants.js +81 -9
  13. package/dist/constants.mjs +31 -5
  14. package/dist/data.mjs +3 -5
  15. package/dist/grid.d.mts +9 -0
  16. package/dist/grid.d.ts +9 -0
  17. package/dist/grid.js +168 -0
  18. package/dist/grid.mjs +98 -0
  19. package/dist/indicators-Da_i06-8.d.mts +288 -0
  20. package/dist/indicators-Da_i06-8.d.ts +288 -0
  21. package/dist/indicators.d.mts +4 -39
  22. package/dist/indicators.d.ts +4 -39
  23. package/dist/indicators.js +10488 -423
  24. package/dist/indicators.mjs +11 -3
  25. package/dist/strategies.d.mts +31 -12
  26. package/dist/strategies.d.ts +31 -12
  27. package/dist/strategies.js +11283 -336
  28. package/dist/strategies.mjs +1246 -119
  29. package/dist/{time-BMkFD4Kd.d.mts → time-BQ3AXmxo.d.mts} +3 -1
  30. package/dist/{time-BMkFD4Kd.d.ts → time-BQ3AXmxo.d.ts} +3 -1
  31. package/dist/time.d.mts +1 -1
  32. package/dist/time.d.ts +1 -1
  33. package/dist/time.js +38 -0
  34. package/dist/time.mjs +6 -2
  35. package/dist/trade.d.mts +54 -0
  36. package/dist/trade.d.ts +54 -0
  37. package/dist/trade.js +352 -0
  38. package/dist/trade.mjs +264 -0
  39. package/package.json +19 -5
  40. package/dist/chunk-UK6VTOUX.mjs +0 -1810
  41. package/dist/indicators-B-GGjP5F.d.mts +0 -65
  42. package/dist/indicators-B-GGjP5F.d.ts +0 -65
package/dist/grid.js ADDED
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/grid.ts
31
+ var grid_exports = {};
32
+ __export(grid_exports, {
33
+ createTestSuite: () => createTestSuite,
34
+ generateName: () => generateName,
35
+ generateParamGrid: () => generateParamGrid,
36
+ mergeConfigs: () => mergeConfigs
37
+ });
38
+ module.exports = __toCommonJS(grid_exports);
39
+
40
+ // src/utils/grid.ts
41
+ var import_lodash = __toESM(require("lodash"));
42
+
43
+ // src/constants/index.ts
44
+ var BACKTEST_EXECUTION_DELAY_MS = 5 * 6e4;
45
+ var BACKTEST_DEFAULT_DAYS = 160;
46
+ var DERIVATIVES_CONTEXT_BASE_REFERENCE_SYMBOLS = [
47
+ "BTCUSDT",
48
+ "ETHUSDT"
49
+ ];
50
+ var DERIVATIVES_CONTEXT_DEFAULT_EXTRA_REFERENCE_SYMBOLS = [
51
+ "BNBUSDT",
52
+ "SOLUSDT",
53
+ "TRXUSDT",
54
+ "XRPUSDT"
55
+ ];
56
+ var DERIVATIVES_CONTEXT_REFERENCE_SYMBOLS = [
57
+ ...DERIVATIVES_CONTEXT_BASE_REFERENCE_SYMBOLS,
58
+ ...DERIVATIVES_CONTEXT_DEFAULT_EXTRA_REFERENCE_SYMBOLS
59
+ ];
60
+
61
+ // src/utils/timestamp.ts
62
+ var import_date_fns = require("date-fns");
63
+ var import_date_fns2 = require("date-fns");
64
+ var RUNTIME_STORAGE_DAY_OFFSET_MS = 6 * 60 * 60 * 1e3;
65
+ var getTimestamp = (days = 0) => {
66
+ if (days > 0) {
67
+ return (0, import_date_fns2.getUnixTime)((0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), days)) * 1e3;
68
+ }
69
+ return (0, import_date_fns2.getUnixTime)(/* @__PURE__ */ new Date()) * 1e3;
70
+ };
71
+
72
+ // src/utils/toJson.ts
73
+ var toJson = (data, stringify = false) => {
74
+ return stringify ? JSON.stringify(data, null, 2) : JSON.stringify(data);
75
+ };
76
+
77
+ // src/utils/uuid.ts
78
+ var import_node_crypto = require("crypto");
79
+ var uuid = (len = 12) => {
80
+ const uuid2 = (0, import_node_crypto.randomUUID)();
81
+ return uuid2.slice(-len);
82
+ };
83
+
84
+ // src/utils/grid.ts
85
+ var generateParamGrid = (paramOptions) => {
86
+ const keys = Object.keys(paramOptions);
87
+ const combinations = [];
88
+ const helper = (index = 0, current = {}) => {
89
+ if (index === keys.length) {
90
+ combinations.push(current);
91
+ return;
92
+ }
93
+ const key = keys[index];
94
+ for (const value of paramOptions[key] || []) {
95
+ const copiedValue = typeof value === "object" && value !== null ? structuredClone(value) : value;
96
+ helper(index + 1, {
97
+ ...current,
98
+ [key]: copiedValue
99
+ });
100
+ }
101
+ };
102
+ helper();
103
+ return combinations;
104
+ };
105
+ var generateName = (prefix) => `${prefix}_${uuid(6)}`;
106
+ var toBase36Hash = (value) => {
107
+ let hash = 0;
108
+ for (let index = 0; index < value.length; index += 1) {
109
+ hash = hash * 31 + value.charCodeAt(index) >>> 0;
110
+ }
111
+ return hash.toString(36).padStart(6, "0");
112
+ };
113
+ var buildConfigTestId = (config) => toBase36Hash(toJson(config)).slice(0, 6);
114
+ var mergeConfigs = (configs) => {
115
+ const result = {};
116
+ for (const config of configs) {
117
+ for (const [key, value] of Object.entries(config)) {
118
+ if (!result[key]) {
119
+ result[key] = [];
120
+ }
121
+ const clonedValue = typeof value === "object" && value !== null ? import_lodash.default.cloneDeep(value) : value;
122
+ const isDuplicate = result[key].some(
123
+ (existing) => import_lodash.default.isEqual(existing, value)
124
+ );
125
+ if (!isDuplicate) {
126
+ result[key].push(clonedValue);
127
+ }
128
+ }
129
+ }
130
+ for (const key in result) {
131
+ if (result[key].every((v) => typeof v === "number")) {
132
+ result[key] = import_lodash.default.sortBy(result[key]);
133
+ }
134
+ }
135
+ return result;
136
+ };
137
+ var createTestSuite = (userName, tickers, strategyName, backtestConfig, connectorName, interval = "15") => {
138
+ const start = getTimestamp(BACKTEST_DEFAULT_DAYS);
139
+ const end = getTimestamp();
140
+ const testSuiteId = uuid(6);
141
+ const paramGrid = generateParamGrid(backtestConfig);
142
+ return tickers.flatMap(
143
+ (symbol) => paramGrid.map((params) => {
144
+ const testId = uuid(6);
145
+ const configId = buildConfigTestId(params);
146
+ return {
147
+ userName,
148
+ name: `${symbol}_${testSuiteId}_${testId}`,
149
+ testId,
150
+ testSuiteId,
151
+ configId,
152
+ symbol,
153
+ interval,
154
+ options: { start, end },
155
+ strategyName,
156
+ strategyConfig: params,
157
+ connectorName
158
+ };
159
+ })
160
+ );
161
+ };
162
+ // Annotate the CommonJS export names for ESM import in node:
163
+ 0 && (module.exports = {
164
+ createTestSuite,
165
+ generateName,
166
+ generateParamGrid,
167
+ mergeConfigs
168
+ });
package/dist/grid.mjs ADDED
@@ -0,0 +1,98 @@
1
+ import {
2
+ uuid
3
+ } from "./chunk-AJK4NS7Y.mjs";
4
+ import {
5
+ getTimestamp
6
+ } from "./chunk-BOETNABM.mjs";
7
+ import {
8
+ BACKTEST_DEFAULT_DAYS
9
+ } from "./chunk-MKCQSB4H.mjs";
10
+ import {
11
+ toJson
12
+ } from "./chunk-OJPHC3S2.mjs";
13
+
14
+ // src/utils/grid.ts
15
+ import _ from "lodash";
16
+ var generateParamGrid = (paramOptions) => {
17
+ const keys = Object.keys(paramOptions);
18
+ const combinations = [];
19
+ const helper = (index = 0, current = {}) => {
20
+ if (index === keys.length) {
21
+ combinations.push(current);
22
+ return;
23
+ }
24
+ const key = keys[index];
25
+ for (const value of paramOptions[key] || []) {
26
+ const copiedValue = typeof value === "object" && value !== null ? structuredClone(value) : value;
27
+ helper(index + 1, {
28
+ ...current,
29
+ [key]: copiedValue
30
+ });
31
+ }
32
+ };
33
+ helper();
34
+ return combinations;
35
+ };
36
+ var generateName = (prefix) => `${prefix}_${uuid(6)}`;
37
+ var toBase36Hash = (value) => {
38
+ let hash = 0;
39
+ for (let index = 0; index < value.length; index += 1) {
40
+ hash = hash * 31 + value.charCodeAt(index) >>> 0;
41
+ }
42
+ return hash.toString(36).padStart(6, "0");
43
+ };
44
+ var buildConfigTestId = (config) => toBase36Hash(toJson(config)).slice(0, 6);
45
+ var mergeConfigs = (configs) => {
46
+ const result = {};
47
+ for (const config of configs) {
48
+ for (const [key, value] of Object.entries(config)) {
49
+ if (!result[key]) {
50
+ result[key] = [];
51
+ }
52
+ const clonedValue = typeof value === "object" && value !== null ? _.cloneDeep(value) : value;
53
+ const isDuplicate = result[key].some(
54
+ (existing) => _.isEqual(existing, value)
55
+ );
56
+ if (!isDuplicate) {
57
+ result[key].push(clonedValue);
58
+ }
59
+ }
60
+ }
61
+ for (const key in result) {
62
+ if (result[key].every((v) => typeof v === "number")) {
63
+ result[key] = _.sortBy(result[key]);
64
+ }
65
+ }
66
+ return result;
67
+ };
68
+ var createTestSuite = (userName, tickers, strategyName, backtestConfig, connectorName, interval = "15") => {
69
+ const start = getTimestamp(BACKTEST_DEFAULT_DAYS);
70
+ const end = getTimestamp();
71
+ const testSuiteId = uuid(6);
72
+ const paramGrid = generateParamGrid(backtestConfig);
73
+ return tickers.flatMap(
74
+ (symbol) => paramGrid.map((params) => {
75
+ const testId = uuid(6);
76
+ const configId = buildConfigTestId(params);
77
+ return {
78
+ userName,
79
+ name: `${symbol}_${testSuiteId}_${testId}`,
80
+ testId,
81
+ testSuiteId,
82
+ configId,
83
+ symbol,
84
+ interval,
85
+ options: { start, end },
86
+ strategyName,
87
+ strategyConfig: params,
88
+ connectorName
89
+ };
90
+ })
91
+ );
92
+ };
93
+ export {
94
+ createTestSuite,
95
+ generateName,
96
+ generateParamGrid,
97
+ mergeConfigs
98
+ };
@@ -0,0 +1,288 @@
1
+ import { Candle, MlCandleIndicatorsSnapshot, DerivativesInterval, SpreadRow, IndicatorSnapshot, IndicatorsHistorySnapshot } from '@tradejs/types';
2
+
3
+ type NumericHistoryBuffer = {
4
+ values: number[];
5
+ start: number;
6
+ size: number;
7
+ };
8
+
9
+ type CloseStreakRuntimeState = {
10
+ up: number;
11
+ down: number;
12
+ };
13
+ type BreakoutRuntimeState = {
14
+ side: 'high' | 'low' | null;
15
+ barsSinceBreakout: number | null;
16
+ };
17
+
18
+ declare const buildMlCandleIndicators: (candles: Candle[], btcCandles: Candle[]) => MlCandleIndicatorsSnapshot;
19
+ type IndicatorValue = number | null | undefined;
20
+
21
+ type RollingWindowState = {
22
+ period: number;
23
+ values: number[];
24
+ sum: number;
25
+ };
26
+ type SerializableSmaState = RollingWindowState;
27
+ type SerializableEmaState = {
28
+ period: number;
29
+ exponent: number;
30
+ current: number | null;
31
+ seedSma: SerializableSmaState;
32
+ };
33
+ type SerializableObvState = {
34
+ current: number;
35
+ lastClose: number | null;
36
+ };
37
+ type SerializableAtrState = {
38
+ period: number;
39
+ prevClose: number | null;
40
+ wema: SerializableEmaState;
41
+ };
42
+ type SerializablePsarState = {
43
+ start: number;
44
+ increment: number;
45
+ maximum: number;
46
+ initialized: boolean;
47
+ isLong: boolean | null;
48
+ sar: number | null;
49
+ extremePoint: number | null;
50
+ acceleration: number;
51
+ previousHigh: number | null;
52
+ previousLow: number | null;
53
+ previousPreviousHigh: number | null;
54
+ previousPreviousLow: number | null;
55
+ previousClose: number | null;
56
+ };
57
+ type SerializableRsiState = {
58
+ period: number;
59
+ previousValue: number | null;
60
+ gains: number[];
61
+ losses: number[];
62
+ avgGain: number;
63
+ avgLoss: number;
64
+ initialized: boolean;
65
+ };
66
+ type SerializableAdxState = {
67
+ period: number;
68
+ smoothingPeriod: number;
69
+ previousHigh: number | null;
70
+ previousLow: number | null;
71
+ previousClose: number | null;
72
+ plusDMValues: number[];
73
+ minusDMValues: number[];
74
+ trValues: number[];
75
+ smoothedPlusDM: number | null;
76
+ smoothedMinusDM: number | null;
77
+ smoothedTR: number | null;
78
+ smaSum: number;
79
+ smaCount: number;
80
+ adxEMA: number | null;
81
+ };
82
+ type SerializableSdState = {
83
+ period: number;
84
+ values: number[];
85
+ sum: number;
86
+ sumSquares: number;
87
+ };
88
+ type SerializableBollingerState = {
89
+ period: number;
90
+ stdDev: number;
91
+ sma: SerializableSmaState;
92
+ sd: SerializableSdState;
93
+ };
94
+ type SerializableMacdState = {
95
+ fastPeriod: number;
96
+ slowPeriod: number;
97
+ signalPeriod: number;
98
+ fast: SerializableEmaState | SerializableSmaState;
99
+ slow: SerializableEmaState | SerializableSmaState;
100
+ signal: SerializableEmaState | SerializableSmaState;
101
+ simpleOscillator: boolean;
102
+ simpleSignal: boolean;
103
+ index: number;
104
+ };
105
+
106
+ type SpreadValue = number | null | undefined;
107
+ type SpreadPointInput = {
108
+ timestamp: number;
109
+ spread?: SpreadValue;
110
+ binancePrice?: SpreadValue;
111
+ coinbasePrice?: SpreadValue;
112
+ };
113
+ declare const createSpreadSmoother: (window?: number) => {
114
+ next: (params: {
115
+ binancePrice?: SpreadValue;
116
+ coinbasePrice?: SpreadValue;
117
+ fallbackSpread?: SpreadValue;
118
+ }) => number | null;
119
+ };
120
+ type SpreadSmootherState = {
121
+ binanceWindow: number[];
122
+ coinbaseWindow: number[];
123
+ binanceSum: number;
124
+ coinbaseSum: number;
125
+ };
126
+ declare const createSerializableSpreadSmoother: (window?: number, state?: Partial<SpreadSmootherState>) => {
127
+ next: (params: {
128
+ binancePrice?: SpreadValue;
129
+ coinbasePrice?: SpreadValue;
130
+ fallbackSpread?: SpreadValue;
131
+ }) => number | null;
132
+ snapshot: () => SpreadSmootherState;
133
+ };
134
+ declare const smoothSpreadSeries: (points: SpreadPointInput[], window?: number) => Array<{
135
+ timestamp: number;
136
+ spread: number | null;
137
+ }>;
138
+ type PricePoint = {
139
+ ts: number;
140
+ close: number;
141
+ };
142
+ declare const intervalToMs: (interval: DerivativesInterval) => number;
143
+ declare const coinbaseProductFromSymbol: (symbol: string) => string | null;
144
+ declare const alignSpreadRows: (params: {
145
+ symbol: string;
146
+ interval: DerivativesInterval;
147
+ binance: PricePoint[];
148
+ coinbase: PricePoint[];
149
+ source: string;
150
+ }) => SpreadRow[];
151
+ declare const rollingMeanStd: (values: number[], endIndex: number, window: number) => {
152
+ mean: number;
153
+ std: number;
154
+ };
155
+
156
+ type TrendlineIndicatorHistoryPush = (key: string, value: number | null | undefined) => void;
157
+ type IndicatorRuntimeState = {
158
+ maFast: SerializableSmaState;
159
+ maMedium: SerializableSmaState;
160
+ maSlow: SerializableSmaState;
161
+ atr: SerializableAtrState;
162
+ atrPctShort: SerializableSmaState;
163
+ atrPctLong: SerializableSmaState;
164
+ bb: SerializableBollingerState;
165
+ obv: SerializableObvState;
166
+ smaObv: SerializableSmaState;
167
+ macd: SerializableMacdState;
168
+ rsi: SerializableRsiState;
169
+ adx: SerializableAdxState;
170
+ baseContextHl2Ema: Record<string, SerializableEmaState>;
171
+ baseContextCloseEma34: SerializableEmaState;
172
+ baseContextTypicalSma20: SerializableSmaState;
173
+ baseContextAdaptivePreviousCenterline: number | null;
174
+ baseContextPsar: SerializablePsarState;
175
+ baseContextPsarEma50: SerializableEmaState;
176
+ baseContextPsarFilterBarsSinceSignal: number | null;
177
+ btcMaFast: SerializableSmaState;
178
+ btcMaSlow: SerializableSmaState;
179
+ spreadSmoother: SpreadSmootherState;
180
+ };
181
+ declare const getRequiredControllerSeedWindow: (periods?: Partial<IndicatorPeriods>) => number;
182
+ type IndicatorsControllerRuntimeState = {
183
+ indicatorState: IndicatorRuntimeState;
184
+ indicatorHistory: Record<string, NumericHistoryBuffer>;
185
+ btcRuntimeHistory: Record<string, NumericHistoryBuffer>;
186
+ latestIndicatorValues: Record<string, number>;
187
+ rawCoinCandles: Candle[];
188
+ rawBtcCandles: Candle[];
189
+ rawEthCandles?: Candle[];
190
+ coinResampledCandles: {
191
+ h1: Candle[];
192
+ h4: Candle[];
193
+ d1: Candle[];
194
+ };
195
+ btcResampledCandles: {
196
+ h1: Candle[];
197
+ h4: Candle[];
198
+ d1: Candle[];
199
+ };
200
+ ethResampledCandles?: {
201
+ h1: Candle[];
202
+ h4: Candle[];
203
+ d1: Candle[];
204
+ };
205
+ closeStreaks: CloseStreakRuntimeState;
206
+ breakoutState: BreakoutRuntimeState;
207
+ btcCloses: number[];
208
+ btcBinanceCursor: number;
209
+ btcCoinbaseCursor: number;
210
+ };
211
+ type IndicatorsControllerCheckpointState = Pick<IndicatorsControllerRuntimeState, 'indicatorState' | 'rawCoinCandles' | 'rawBtcCandles' | 'rawEthCandles' | 'coinResampledCandles' | 'btcResampledCandles' | 'ethResampledCandles' | 'closeStreaks' | 'breakoutState' | 'btcCloses' | 'btcBinanceCursor' | 'btcCoinbaseCursor'> & Partial<Pick<IndicatorsControllerRuntimeState, 'indicatorHistory' | 'btcRuntimeHistory' | 'latestIndicatorValues'>>;
212
+ type TrendlineIndicators = {
213
+ maFast: IndicatorValue;
214
+ maMedium: IndicatorValue;
215
+ maSlow: IndicatorValue;
216
+ atr: IndicatorValue;
217
+ atrPct: IndicatorValue;
218
+ bbUpper: IndicatorValue;
219
+ bbMiddle: IndicatorValue;
220
+ bbLower: IndicatorValue;
221
+ obv: IndicatorValue;
222
+ smaObv: IndicatorValue;
223
+ macd: IndicatorValue;
224
+ macdSignal: IndicatorValue;
225
+ macdHistogram: IndicatorValue;
226
+ price24hPcnt: IndicatorValue;
227
+ price1hPcnt: IndicatorValue;
228
+ highPrice1h: IndicatorValue;
229
+ lowPrice1h: IndicatorValue;
230
+ volume1h: IndicatorValue;
231
+ highPrice24h: IndicatorValue;
232
+ lowPrice24h: IndicatorValue;
233
+ volume24h: IndicatorValue;
234
+ highLevel: IndicatorValue;
235
+ lowLevel: IndicatorValue;
236
+ prevClose: IndicatorValue;
237
+ correlation: IndicatorValue;
238
+ spread: IndicatorValue;
239
+ };
240
+ type CreateIndicatorsOptions = {
241
+ includeMlPayload?: boolean;
242
+ runtimeOnly?: boolean;
243
+ ethData?: Candle[];
244
+ btcBinanceData?: Candle[];
245
+ btcCoinbaseData?: Candle[];
246
+ pluginRegistryScope?: string;
247
+ initialRuntimeState?: IndicatorsControllerRuntimeState | IndicatorsControllerCheckpointState;
248
+ };
249
+ declare const COMPACT_INDICATORS_SNAPSHOT_SYMBOL: unique symbol;
250
+ declare const COMPACT_INDICATORS_SNAPSHOT_KEY = "__tradejsCompactIndicatorsSnapshot";
251
+ interface IndicatorPeriods {
252
+ maFast: number;
253
+ maMedium: number;
254
+ maSlow: number;
255
+ obvSma: number;
256
+ atr: number;
257
+ atrPctShort: number;
258
+ atrPctLong: number;
259
+ bb: number;
260
+ bbStd: number;
261
+ macdFast: number;
262
+ macdSlow: number;
263
+ macdSignal: number;
264
+ levelLookback: number;
265
+ levelDelay: number;
266
+ }
267
+ declare const applyIndicatorsToHistory: (indicators: TrendlineIndicators, pushIndicator: TrendlineIndicatorHistoryPush) => void;
268
+ declare const createIndicators: (data: Candle[], btcData?: Candle[], options?: CreateIndicatorsOptions & {
269
+ periods?: Partial<IndicatorPeriods>;
270
+ }) => {
271
+ next: (candle: Candle, btcCandle?: Candle, ethCandle?: Candle) => IndicatorSnapshot | null;
272
+ updateReferenceData: ({ btcBinanceData, btcCoinbaseData, }: {
273
+ btcBinanceData?: Candle[];
274
+ btcCoinbaseData?: Candle[];
275
+ }) => void;
276
+ snapshot: (options?: {
277
+ compact?: boolean;
278
+ limit?: number;
279
+ }) => IndicatorsHistorySnapshot;
280
+ checkpointRuntimeState: () => IndicatorsControllerCheckpointState;
281
+ latestSnapshot: () => IndicatorSnapshot | null;
282
+ runtimeState: () => IndicatorsControllerRuntimeState;
283
+ latestNumber: (key: string) => number | undefined;
284
+ result: () => IndicatorsHistorySnapshot;
285
+ };
286
+ declare const buildMlTimeframeIndicators: (candles: Candle[], periods?: Partial<IndicatorPeriods>) => Record<string, number[]>;
287
+
288
+ export { COMPACT_INDICATORS_SNAPSHOT_KEY as C, type IndicatorPeriods as I, type PricePoint as P, type SpreadSmootherState as S, type IndicatorsControllerRuntimeState as a, type IndicatorsControllerCheckpointState as b, COMPACT_INDICATORS_SNAPSHOT_SYMBOL as c, alignSpreadRows as d, applyIndicatorsToHistory as e, buildMlCandleIndicators as f, buildMlTimeframeIndicators as g, coinbaseProductFromSymbol as h, createIndicators as i, createSerializableSpreadSmoother as j, createSpreadSmoother as k, getRequiredControllerSeedWindow as l, intervalToMs as m, rollingMeanStd as r, smoothSpreadSeries as s };