@tradejs/core 2.0.18 → 2.0.19
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/backtest.js +2 -3
- package/dist/backtest.mjs +1 -1
- package/dist/{chunk-NN7Z3GIK.mjs → chunk-Q3OFPRVV.mjs} +115 -125
- package/dist/{chunk-BOETNABM.mjs → chunk-S4KHOAXM.mjs} +1 -2
- package/dist/chunk-U3GDILUZ.mjs +13 -0
- package/dist/grid.d.mts +3 -2
- package/dist/grid.d.ts +3 -2
- package/dist/grid.js +13 -11
- package/dist/grid.mjs +6 -6
- package/dist/{indicators-C4AaiFrs.d.ts → indicatorControllerContracts-DdSuUzb2.d.mts} +26 -92
- package/dist/{indicators-C4AaiFrs.d.mts → indicatorControllerContracts-DdSuUzb2.d.ts} +26 -92
- package/dist/indicators.d.mts +70 -3
- package/dist/indicators.d.ts +70 -3
- package/dist/indicators.js +114 -125
- package/dist/indicators.mjs +2 -2
- package/dist/strategies.d.mts +6 -3
- package/dist/strategies.d.ts +6 -3
- package/dist/strategies.js +133 -138
- package/dist/strategies.mjs +9 -6
- package/dist/time.js +2 -3
- package/dist/time.mjs +1 -1
- package/dist/uuid-DMoErO_1.d.mts +3 -0
- package/dist/uuid-DMoErO_1.d.ts +3 -0
- package/package.json +2 -2
- package/dist/chunk-AJK4NS7Y.mjs +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DerivativesInterval, SpreadRow, Candle } from '@tradejs/types';
|
|
2
2
|
|
|
3
3
|
type NumericHistoryBuffer = {
|
|
4
4
|
values: number[];
|
|
@@ -6,18 +6,6 @@ type NumericHistoryBuffer = {
|
|
|
6
6
|
size: number;
|
|
7
7
|
};
|
|
8
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
9
|
type RollingWindowState = {
|
|
22
10
|
period: number;
|
|
23
11
|
values: number[];
|
|
@@ -153,7 +141,30 @@ declare const rollingMeanStd: (values: number[], endIndex: number, window: numbe
|
|
|
153
141
|
std: number;
|
|
154
142
|
};
|
|
155
143
|
|
|
156
|
-
|
|
144
|
+
interface IndicatorPeriods {
|
|
145
|
+
maFast: number;
|
|
146
|
+
maMedium: number;
|
|
147
|
+
maSlow: number;
|
|
148
|
+
obvSma: number;
|
|
149
|
+
atr: number;
|
|
150
|
+
atrPctShort: number;
|
|
151
|
+
atrPctLong: number;
|
|
152
|
+
bb: number;
|
|
153
|
+
bbStd: number;
|
|
154
|
+
macdFast: number;
|
|
155
|
+
macdSlow: number;
|
|
156
|
+
macdSignal: number;
|
|
157
|
+
levelLookback: number;
|
|
158
|
+
levelDelay: number;
|
|
159
|
+
}
|
|
160
|
+
type CloseStreakRuntimeState = {
|
|
161
|
+
up: number;
|
|
162
|
+
down: number;
|
|
163
|
+
};
|
|
164
|
+
type BreakoutRuntimeState = {
|
|
165
|
+
side: 'high' | 'low' | null;
|
|
166
|
+
barsSinceBreakout: number | null;
|
|
167
|
+
};
|
|
157
168
|
type IndicatorRuntimeState = {
|
|
158
169
|
maFast: SerializableSmaState;
|
|
159
170
|
maMedium: SerializableSmaState;
|
|
@@ -178,7 +189,6 @@ type IndicatorRuntimeState = {
|
|
|
178
189
|
btcMaSlow: SerializableSmaState;
|
|
179
190
|
spreadSmoother: SpreadSmootherState;
|
|
180
191
|
};
|
|
181
|
-
declare const getRequiredControllerSeedWindow: (periods?: Partial<IndicatorPeriods>) => number;
|
|
182
192
|
type IndicatorsControllerRuntimeState = {
|
|
183
193
|
indicatorState: IndicatorRuntimeState;
|
|
184
194
|
indicatorHistory: Record<string, NumericHistoryBuffer>;
|
|
@@ -209,81 +219,5 @@ type IndicatorsControllerRuntimeState = {
|
|
|
209
219
|
btcCoinbaseCursor: number;
|
|
210
220
|
};
|
|
211
221
|
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
|
-
latestNumbers: (key: string, count: number) => number[];
|
|
285
|
-
result: () => IndicatorsHistorySnapshot;
|
|
286
|
-
};
|
|
287
|
-
declare const buildMlTimeframeIndicators: (candles: Candle[], periods?: Partial<IndicatorPeriods>) => Record<string, number[]>;
|
|
288
222
|
|
|
289
|
-
export {
|
|
223
|
+
export { type IndicatorPeriods as I, type PricePoint as P, type SpreadSmootherState as S, type IndicatorsControllerRuntimeState as a, type IndicatorsControllerCheckpointState as b, type IndicatorRuntimeState as c, alignSpreadRows as d, coinbaseProductFromSymbol as e, createSerializableSpreadSmoother as f, createSpreadSmoother as g, intervalToMs as i, rollingMeanStd as r, smoothSpreadSeries as s };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DerivativesInterval, SpreadRow, Candle } from '@tradejs/types';
|
|
2
2
|
|
|
3
3
|
type NumericHistoryBuffer = {
|
|
4
4
|
values: number[];
|
|
@@ -6,18 +6,6 @@ type NumericHistoryBuffer = {
|
|
|
6
6
|
size: number;
|
|
7
7
|
};
|
|
8
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
9
|
type RollingWindowState = {
|
|
22
10
|
period: number;
|
|
23
11
|
values: number[];
|
|
@@ -153,7 +141,30 @@ declare const rollingMeanStd: (values: number[], endIndex: number, window: numbe
|
|
|
153
141
|
std: number;
|
|
154
142
|
};
|
|
155
143
|
|
|
156
|
-
|
|
144
|
+
interface IndicatorPeriods {
|
|
145
|
+
maFast: number;
|
|
146
|
+
maMedium: number;
|
|
147
|
+
maSlow: number;
|
|
148
|
+
obvSma: number;
|
|
149
|
+
atr: number;
|
|
150
|
+
atrPctShort: number;
|
|
151
|
+
atrPctLong: number;
|
|
152
|
+
bb: number;
|
|
153
|
+
bbStd: number;
|
|
154
|
+
macdFast: number;
|
|
155
|
+
macdSlow: number;
|
|
156
|
+
macdSignal: number;
|
|
157
|
+
levelLookback: number;
|
|
158
|
+
levelDelay: number;
|
|
159
|
+
}
|
|
160
|
+
type CloseStreakRuntimeState = {
|
|
161
|
+
up: number;
|
|
162
|
+
down: number;
|
|
163
|
+
};
|
|
164
|
+
type BreakoutRuntimeState = {
|
|
165
|
+
side: 'high' | 'low' | null;
|
|
166
|
+
barsSinceBreakout: number | null;
|
|
167
|
+
};
|
|
157
168
|
type IndicatorRuntimeState = {
|
|
158
169
|
maFast: SerializableSmaState;
|
|
159
170
|
maMedium: SerializableSmaState;
|
|
@@ -178,7 +189,6 @@ type IndicatorRuntimeState = {
|
|
|
178
189
|
btcMaSlow: SerializableSmaState;
|
|
179
190
|
spreadSmoother: SpreadSmootherState;
|
|
180
191
|
};
|
|
181
|
-
declare const getRequiredControllerSeedWindow: (periods?: Partial<IndicatorPeriods>) => number;
|
|
182
192
|
type IndicatorsControllerRuntimeState = {
|
|
183
193
|
indicatorState: IndicatorRuntimeState;
|
|
184
194
|
indicatorHistory: Record<string, NumericHistoryBuffer>;
|
|
@@ -209,81 +219,5 @@ type IndicatorsControllerRuntimeState = {
|
|
|
209
219
|
btcCoinbaseCursor: number;
|
|
210
220
|
};
|
|
211
221
|
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
|
-
latestNumbers: (key: string, count: number) => number[];
|
|
285
|
-
result: () => IndicatorsHistorySnapshot;
|
|
286
|
-
};
|
|
287
|
-
declare const buildMlTimeframeIndicators: (candles: Candle[], periods?: Partial<IndicatorPeriods>) => Record<string, number[]>;
|
|
288
222
|
|
|
289
|
-
export {
|
|
223
|
+
export { type IndicatorPeriods as I, type PricePoint as P, type SpreadSmootherState as S, type IndicatorsControllerRuntimeState as a, type IndicatorsControllerCheckpointState as b, type IndicatorRuntimeState as c, alignSpreadRows as d, coinbaseProductFromSymbol as e, createSerializableSpreadSmoother as f, createSpreadSmoother as g, intervalToMs as i, rollingMeanStd as r, smoothSpreadSeries as s };
|
package/dist/indicators.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { KlineChartItem, DerivativesRow, DerivativesInterval, Direction, DerivativesContext, IndicatorPluginRenderer, Indicator, IndicatorPluginEntry, TrendLine, TrendLineOptions } from '@tradejs/types';
|
|
2
|
-
|
|
1
|
+
import { KlineChartItem, DerivativesRow, DerivativesInterval, Direction, DerivativesContext, Candle, MlCandleIndicatorsSnapshot, IndicatorSnapshot, IndicatorsHistorySnapshot, IndicatorPluginRenderer, Indicator, IndicatorPluginEntry, TrendLine, TrendLineOptions } from '@tradejs/types';
|
|
2
|
+
import { I as IndicatorPeriods, a as IndicatorsControllerRuntimeState, b as IndicatorsControllerCheckpointState } from './indicatorControllerContracts-DdSuUzb2.mjs';
|
|
3
|
+
export { c as IndicatorRuntimeState, P as PricePoint, S as SpreadSmootherState, d as alignSpreadRows, e as coinbaseProductFromSymbol, f as createSerializableSpreadSmoother, g as createSpreadSmoother, i as intervalToMs, r as rollingMeanStd, s as smoothSpreadSeries } from './indicatorControllerContracts-DdSuUzb2.mjs';
|
|
3
4
|
import { KLineData } from 'klinecharts';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -77,6 +78,72 @@ declare const buildDerivativesContext: (params: {
|
|
|
77
78
|
staleAfterMsByInterval?: Partial<Record<DerivativesInterval, number>>;
|
|
78
79
|
}) => DerivativesContext;
|
|
79
80
|
|
|
81
|
+
declare const buildMlCandleIndicators: (candles: Candle[], btcCandles: Candle[]) => MlCandleIndicatorsSnapshot;
|
|
82
|
+
type IndicatorValue = number | null | undefined;
|
|
83
|
+
|
|
84
|
+
type TrendlineIndicatorHistoryPush = (key: string, value: number | null | undefined) => void;
|
|
85
|
+
declare const getRequiredControllerSeedWindow: (periods?: Partial<IndicatorPeriods>) => number;
|
|
86
|
+
type TrendlineIndicators = {
|
|
87
|
+
maFast: IndicatorValue;
|
|
88
|
+
maMedium: IndicatorValue;
|
|
89
|
+
maSlow: IndicatorValue;
|
|
90
|
+
atr: IndicatorValue;
|
|
91
|
+
atrPct: IndicatorValue;
|
|
92
|
+
bbUpper: IndicatorValue;
|
|
93
|
+
bbMiddle: IndicatorValue;
|
|
94
|
+
bbLower: IndicatorValue;
|
|
95
|
+
obv: IndicatorValue;
|
|
96
|
+
smaObv: IndicatorValue;
|
|
97
|
+
macd: IndicatorValue;
|
|
98
|
+
macdSignal: IndicatorValue;
|
|
99
|
+
macdHistogram: IndicatorValue;
|
|
100
|
+
price24hPcnt: IndicatorValue;
|
|
101
|
+
price1hPcnt: IndicatorValue;
|
|
102
|
+
highPrice1h: IndicatorValue;
|
|
103
|
+
lowPrice1h: IndicatorValue;
|
|
104
|
+
volume1h: IndicatorValue;
|
|
105
|
+
highPrice24h: IndicatorValue;
|
|
106
|
+
lowPrice24h: IndicatorValue;
|
|
107
|
+
volume24h: IndicatorValue;
|
|
108
|
+
highLevel: IndicatorValue;
|
|
109
|
+
lowLevel: IndicatorValue;
|
|
110
|
+
prevClose: IndicatorValue;
|
|
111
|
+
correlation: IndicatorValue;
|
|
112
|
+
spread: IndicatorValue;
|
|
113
|
+
};
|
|
114
|
+
type CreateIndicatorsOptions = {
|
|
115
|
+
includeMlPayload?: boolean;
|
|
116
|
+
runtimeOnly?: boolean;
|
|
117
|
+
ethData?: Candle[];
|
|
118
|
+
btcBinanceData?: Candle[];
|
|
119
|
+
btcCoinbaseData?: Candle[];
|
|
120
|
+
pluginRegistryScope?: string;
|
|
121
|
+
initialRuntimeState?: IndicatorsControllerRuntimeState | IndicatorsControllerCheckpointState;
|
|
122
|
+
};
|
|
123
|
+
declare const COMPACT_INDICATORS_SNAPSHOT_SYMBOL: unique symbol;
|
|
124
|
+
declare const COMPACT_INDICATORS_SNAPSHOT_KEY = "__tradejsCompactIndicatorsSnapshot";
|
|
125
|
+
declare const applyIndicatorsToHistory: (indicators: TrendlineIndicators, pushIndicator: TrendlineIndicatorHistoryPush) => void;
|
|
126
|
+
declare const createIndicators: (data: Candle[], btcData?: Candle[], options?: CreateIndicatorsOptions & {
|
|
127
|
+
periods?: Partial<IndicatorPeriods>;
|
|
128
|
+
}) => {
|
|
129
|
+
next: (candle: Candle, btcCandle?: Candle, ethCandle?: Candle) => IndicatorSnapshot | null;
|
|
130
|
+
updateReferenceData: ({ btcBinanceData, btcCoinbaseData, }: {
|
|
131
|
+
btcBinanceData?: Candle[];
|
|
132
|
+
btcCoinbaseData?: Candle[];
|
|
133
|
+
}) => void;
|
|
134
|
+
snapshot: (options?: {
|
|
135
|
+
compact?: boolean;
|
|
136
|
+
limit?: number;
|
|
137
|
+
}) => IndicatorsHistorySnapshot;
|
|
138
|
+
checkpointRuntimeState: () => IndicatorsControllerCheckpointState;
|
|
139
|
+
latestSnapshot: () => IndicatorSnapshot | null;
|
|
140
|
+
runtimeState: () => IndicatorsControllerRuntimeState;
|
|
141
|
+
latestNumber: (key: string) => number | undefined;
|
|
142
|
+
latestNumbers: (key: string, count: number) => number[];
|
|
143
|
+
result: () => IndicatorsHistorySnapshot;
|
|
144
|
+
};
|
|
145
|
+
declare const buildMlTimeframeIndicators: (candles: Candle[], periods?: Partial<IndicatorPeriods>) => Record<string, number[]>;
|
|
146
|
+
|
|
80
147
|
declare const registerIndicatorEntries: (entries: readonly IndicatorPluginEntry[], source: string, scope?: string) => void;
|
|
81
148
|
declare const getRegisteredIndicatorEntries: (scope?: string) => IndicatorPluginEntry[];
|
|
82
149
|
declare const getPluginIndicatorCatalog: (scope?: string) => Indicator[];
|
|
@@ -110,4 +177,4 @@ type TrendlineEngine = {
|
|
|
110
177
|
};
|
|
111
178
|
declare const createTrendlineEngine: (initialCandles: KLineData[], options: TrendLineOptions) => TrendlineEngine;
|
|
112
179
|
|
|
113
|
-
export { COINALYZE_MIN_INTRADAY_RETENTION_POINTS, type CoinalyzePoint, type IndicatorRendererDescriptor, type TrendlineEngine, alignSortedCandlesByTimestamp, buildCoinalyzeHourlyRowsWithFallback, buildDerivativesContext, buildReturnsFromCandles, calculateCoinBtcCorrelation, calculatePearsonCorrelation, coinalyzePointsToRows, createTrendlineEngine, deriveCoinalyzeHourlyRowsFrom15m, deriveCoinalyzeRollingHourlyRowsFrom15m, detectRawSupportResistance, getLastClosedDerivativesBarStartMs, getPluginIndicatorCatalog, getPluginIndicatorRenderers, getRegisteredIndicatorEntries, getSupportResistanceLevels, mergeCoinalyzeMetrics, normalizeCoinalyzeSymbols, normalizeDerivativesIntervals, registerIndicatorEntries, resetIndicatorRegistryCache, resolveCoinalyzeConfirmedIntradayCoverage, toArrayData, toCoinalyzeTimestampMs, toFiniteNumber };
|
|
180
|
+
export { COINALYZE_MIN_INTRADAY_RETENTION_POINTS, COMPACT_INDICATORS_SNAPSHOT_KEY, COMPACT_INDICATORS_SNAPSHOT_SYMBOL, type CoinalyzePoint, IndicatorPeriods, type IndicatorRendererDescriptor, IndicatorsControllerCheckpointState, IndicatorsControllerRuntimeState, type TrendlineEngine, alignSortedCandlesByTimestamp, applyIndicatorsToHistory, buildCoinalyzeHourlyRowsWithFallback, buildDerivativesContext, buildMlCandleIndicators, buildMlTimeframeIndicators, buildReturnsFromCandles, calculateCoinBtcCorrelation, calculatePearsonCorrelation, coinalyzePointsToRows, createIndicators, createTrendlineEngine, deriveCoinalyzeHourlyRowsFrom15m, deriveCoinalyzeRollingHourlyRowsFrom15m, detectRawSupportResistance, getLastClosedDerivativesBarStartMs, getPluginIndicatorCatalog, getPluginIndicatorRenderers, getRegisteredIndicatorEntries, getRequiredControllerSeedWindow, getSupportResistanceLevels, mergeCoinalyzeMetrics, normalizeCoinalyzeSymbols, normalizeDerivativesIntervals, registerIndicatorEntries, resetIndicatorRegistryCache, resolveCoinalyzeConfirmedIntradayCoverage, toArrayData, toCoinalyzeTimestampMs, toFiniteNumber };
|
package/dist/indicators.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { KlineChartItem, DerivativesRow, DerivativesInterval, Direction, DerivativesContext, IndicatorPluginRenderer, Indicator, IndicatorPluginEntry, TrendLine, TrendLineOptions } from '@tradejs/types';
|
|
2
|
-
|
|
1
|
+
import { KlineChartItem, DerivativesRow, DerivativesInterval, Direction, DerivativesContext, Candle, MlCandleIndicatorsSnapshot, IndicatorSnapshot, IndicatorsHistorySnapshot, IndicatorPluginRenderer, Indicator, IndicatorPluginEntry, TrendLine, TrendLineOptions } from '@tradejs/types';
|
|
2
|
+
import { I as IndicatorPeriods, a as IndicatorsControllerRuntimeState, b as IndicatorsControllerCheckpointState } from './indicatorControllerContracts-DdSuUzb2.js';
|
|
3
|
+
export { c as IndicatorRuntimeState, P as PricePoint, S as SpreadSmootherState, d as alignSpreadRows, e as coinbaseProductFromSymbol, f as createSerializableSpreadSmoother, g as createSpreadSmoother, i as intervalToMs, r as rollingMeanStd, s as smoothSpreadSeries } from './indicatorControllerContracts-DdSuUzb2.js';
|
|
3
4
|
import { KLineData } from 'klinecharts';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -77,6 +78,72 @@ declare const buildDerivativesContext: (params: {
|
|
|
77
78
|
staleAfterMsByInterval?: Partial<Record<DerivativesInterval, number>>;
|
|
78
79
|
}) => DerivativesContext;
|
|
79
80
|
|
|
81
|
+
declare const buildMlCandleIndicators: (candles: Candle[], btcCandles: Candle[]) => MlCandleIndicatorsSnapshot;
|
|
82
|
+
type IndicatorValue = number | null | undefined;
|
|
83
|
+
|
|
84
|
+
type TrendlineIndicatorHistoryPush = (key: string, value: number | null | undefined) => void;
|
|
85
|
+
declare const getRequiredControllerSeedWindow: (periods?: Partial<IndicatorPeriods>) => number;
|
|
86
|
+
type TrendlineIndicators = {
|
|
87
|
+
maFast: IndicatorValue;
|
|
88
|
+
maMedium: IndicatorValue;
|
|
89
|
+
maSlow: IndicatorValue;
|
|
90
|
+
atr: IndicatorValue;
|
|
91
|
+
atrPct: IndicatorValue;
|
|
92
|
+
bbUpper: IndicatorValue;
|
|
93
|
+
bbMiddle: IndicatorValue;
|
|
94
|
+
bbLower: IndicatorValue;
|
|
95
|
+
obv: IndicatorValue;
|
|
96
|
+
smaObv: IndicatorValue;
|
|
97
|
+
macd: IndicatorValue;
|
|
98
|
+
macdSignal: IndicatorValue;
|
|
99
|
+
macdHistogram: IndicatorValue;
|
|
100
|
+
price24hPcnt: IndicatorValue;
|
|
101
|
+
price1hPcnt: IndicatorValue;
|
|
102
|
+
highPrice1h: IndicatorValue;
|
|
103
|
+
lowPrice1h: IndicatorValue;
|
|
104
|
+
volume1h: IndicatorValue;
|
|
105
|
+
highPrice24h: IndicatorValue;
|
|
106
|
+
lowPrice24h: IndicatorValue;
|
|
107
|
+
volume24h: IndicatorValue;
|
|
108
|
+
highLevel: IndicatorValue;
|
|
109
|
+
lowLevel: IndicatorValue;
|
|
110
|
+
prevClose: IndicatorValue;
|
|
111
|
+
correlation: IndicatorValue;
|
|
112
|
+
spread: IndicatorValue;
|
|
113
|
+
};
|
|
114
|
+
type CreateIndicatorsOptions = {
|
|
115
|
+
includeMlPayload?: boolean;
|
|
116
|
+
runtimeOnly?: boolean;
|
|
117
|
+
ethData?: Candle[];
|
|
118
|
+
btcBinanceData?: Candle[];
|
|
119
|
+
btcCoinbaseData?: Candle[];
|
|
120
|
+
pluginRegistryScope?: string;
|
|
121
|
+
initialRuntimeState?: IndicatorsControllerRuntimeState | IndicatorsControllerCheckpointState;
|
|
122
|
+
};
|
|
123
|
+
declare const COMPACT_INDICATORS_SNAPSHOT_SYMBOL: unique symbol;
|
|
124
|
+
declare const COMPACT_INDICATORS_SNAPSHOT_KEY = "__tradejsCompactIndicatorsSnapshot";
|
|
125
|
+
declare const applyIndicatorsToHistory: (indicators: TrendlineIndicators, pushIndicator: TrendlineIndicatorHistoryPush) => void;
|
|
126
|
+
declare const createIndicators: (data: Candle[], btcData?: Candle[], options?: CreateIndicatorsOptions & {
|
|
127
|
+
periods?: Partial<IndicatorPeriods>;
|
|
128
|
+
}) => {
|
|
129
|
+
next: (candle: Candle, btcCandle?: Candle, ethCandle?: Candle) => IndicatorSnapshot | null;
|
|
130
|
+
updateReferenceData: ({ btcBinanceData, btcCoinbaseData, }: {
|
|
131
|
+
btcBinanceData?: Candle[];
|
|
132
|
+
btcCoinbaseData?: Candle[];
|
|
133
|
+
}) => void;
|
|
134
|
+
snapshot: (options?: {
|
|
135
|
+
compact?: boolean;
|
|
136
|
+
limit?: number;
|
|
137
|
+
}) => IndicatorsHistorySnapshot;
|
|
138
|
+
checkpointRuntimeState: () => IndicatorsControllerCheckpointState;
|
|
139
|
+
latestSnapshot: () => IndicatorSnapshot | null;
|
|
140
|
+
runtimeState: () => IndicatorsControllerRuntimeState;
|
|
141
|
+
latestNumber: (key: string) => number | undefined;
|
|
142
|
+
latestNumbers: (key: string, count: number) => number[];
|
|
143
|
+
result: () => IndicatorsHistorySnapshot;
|
|
144
|
+
};
|
|
145
|
+
declare const buildMlTimeframeIndicators: (candles: Candle[], periods?: Partial<IndicatorPeriods>) => Record<string, number[]>;
|
|
146
|
+
|
|
80
147
|
declare const registerIndicatorEntries: (entries: readonly IndicatorPluginEntry[], source: string, scope?: string) => void;
|
|
81
148
|
declare const getRegisteredIndicatorEntries: (scope?: string) => IndicatorPluginEntry[];
|
|
82
149
|
declare const getPluginIndicatorCatalog: (scope?: string) => Indicator[];
|
|
@@ -110,4 +177,4 @@ type TrendlineEngine = {
|
|
|
110
177
|
};
|
|
111
178
|
declare const createTrendlineEngine: (initialCandles: KLineData[], options: TrendLineOptions) => TrendlineEngine;
|
|
112
179
|
|
|
113
|
-
export { COINALYZE_MIN_INTRADAY_RETENTION_POINTS, type CoinalyzePoint, type IndicatorRendererDescriptor, type TrendlineEngine, alignSortedCandlesByTimestamp, buildCoinalyzeHourlyRowsWithFallback, buildDerivativesContext, buildReturnsFromCandles, calculateCoinBtcCorrelation, calculatePearsonCorrelation, coinalyzePointsToRows, createTrendlineEngine, deriveCoinalyzeHourlyRowsFrom15m, deriveCoinalyzeRollingHourlyRowsFrom15m, detectRawSupportResistance, getLastClosedDerivativesBarStartMs, getPluginIndicatorCatalog, getPluginIndicatorRenderers, getRegisteredIndicatorEntries, getSupportResistanceLevels, mergeCoinalyzeMetrics, normalizeCoinalyzeSymbols, normalizeDerivativesIntervals, registerIndicatorEntries, resetIndicatorRegistryCache, resolveCoinalyzeConfirmedIntradayCoverage, toArrayData, toCoinalyzeTimestampMs, toFiniteNumber };
|
|
180
|
+
export { COINALYZE_MIN_INTRADAY_RETENTION_POINTS, COMPACT_INDICATORS_SNAPSHOT_KEY, COMPACT_INDICATORS_SNAPSHOT_SYMBOL, type CoinalyzePoint, IndicatorPeriods, type IndicatorRendererDescriptor, IndicatorsControllerCheckpointState, IndicatorsControllerRuntimeState, type TrendlineEngine, alignSortedCandlesByTimestamp, applyIndicatorsToHistory, buildCoinalyzeHourlyRowsWithFallback, buildDerivativesContext, buildMlCandleIndicators, buildMlTimeframeIndicators, buildReturnsFromCandles, calculateCoinBtcCorrelation, calculatePearsonCorrelation, coinalyzePointsToRows, createIndicators, createTrendlineEngine, deriveCoinalyzeHourlyRowsFrom15m, deriveCoinalyzeRollingHourlyRowsFrom15m, detectRawSupportResistance, getLastClosedDerivativesBarStartMs, getPluginIndicatorCatalog, getPluginIndicatorRenderers, getRegisteredIndicatorEntries, getRequiredControllerSeedWindow, getSupportResistanceLevels, mergeCoinalyzeMetrics, normalizeCoinalyzeSymbols, normalizeDerivativesIntervals, registerIndicatorEntries, resetIndicatorRegistryCache, resolveCoinalyzeConfirmedIntradayCoverage, toArrayData, toCoinalyzeTimestampMs, toFiniteNumber };
|