@tradejs/core 1.0.8 → 1.0.10
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.d.mts +109 -9
- package/dist/backtest.d.ts +109 -9
- package/dist/backtest.js +487 -145
- package/dist/backtest.mjs +414 -82
- package/dist/chunk-7P2KNFD4.mjs +11847 -0
- package/dist/{chunk-JLORHLL6.mjs → chunk-DXJ4NCFJ.mjs} +65 -6
- package/dist/chunk-OJPHC3S2.mjs +8 -0
- package/dist/{chunk-PQETJ42A.mjs → chunk-PNBS6J3G.mjs} +22 -1
- package/dist/constants.d.mts +26 -5
- package/dist/constants.d.ts +26 -5
- package/dist/constants.js +81 -9
- package/dist/constants.mjs +31 -5
- package/dist/data.mjs +3 -5
- package/dist/grid.d.mts +9 -0
- package/dist/grid.d.ts +9 -0
- package/dist/grid.js +168 -0
- package/dist/grid.mjs +98 -0
- package/dist/indicators-Da_i06-8.d.mts +288 -0
- package/dist/indicators-Da_i06-8.d.ts +288 -0
- package/dist/indicators.d.mts +4 -39
- package/dist/indicators.d.ts +4 -39
- package/dist/indicators.js +10488 -423
- package/dist/indicators.mjs +11 -3
- package/dist/strategies.d.mts +31 -12
- package/dist/strategies.d.ts +31 -12
- package/dist/strategies.js +11283 -336
- package/dist/strategies.mjs +1246 -119
- package/dist/{time-BMkFD4Kd.d.mts → time-BQ3AXmxo.d.mts} +3 -1
- package/dist/{time-BMkFD4Kd.d.ts → time-BQ3AXmxo.d.ts} +3 -1
- package/dist/time.d.mts +1 -1
- package/dist/time.d.ts +1 -1
- package/dist/time.js +38 -0
- package/dist/time.mjs +6 -2
- package/dist/trade.d.mts +54 -0
- package/dist/trade.d.ts +54 -0
- package/dist/trade.js +352 -0
- package/dist/trade.mjs +264 -0
- package/package.json +19 -5
- package/dist/chunk-622V7IAT.mjs +0 -1810
- package/dist/indicators-B-GGjP5F.d.mts +0 -65
- package/dist/indicators-B-GGjP5F.d.ts +0 -65
|
@@ -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 };
|
package/dist/indicators.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { KlineChartItem, DerivativesInterval, DerivativesRow, Direction, DerivativesContext, IndicatorPluginRenderer, Indicator, IndicatorPluginEntry,
|
|
2
|
-
export { I as IndicatorPeriods, a as applyIndicatorsToHistory,
|
|
1
|
+
import { KlineChartItem, DerivativesInterval, DerivativesRow, Direction, DerivativesContext, IndicatorPluginRenderer, Indicator, IndicatorPluginEntry, TrendLine, TrendLineOptions } from '@tradejs/types';
|
|
2
|
+
export { C as COMPACT_INDICATORS_SNAPSHOT_KEY, c as COMPACT_INDICATORS_SNAPSHOT_SYMBOL, I as IndicatorPeriods, b as IndicatorsControllerCheckpointState, a as IndicatorsControllerRuntimeState, P as PricePoint, S as SpreadSmootherState, d as alignSpreadRows, e as applyIndicatorsToHistory, f as buildMlCandleIndicators, g as buildMlTimeframeIndicators, h as coinbaseProductFromSymbol, i as createIndicators, j as createSerializableSpreadSmoother, k as createSpreadSmoother, l as getRequiredControllerSeedWindow, m as intervalToMs, r as rollingMeanStd, s as smoothSpreadSeries } from './indicators-Da_i06-8.mjs';
|
|
3
3
|
import { KLineData } from 'klinecharts';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -55,6 +55,7 @@ declare const buildDerivativesContext: (params: {
|
|
|
55
55
|
direction: Direction;
|
|
56
56
|
timestamp: number;
|
|
57
57
|
rowsByInterval: Partial<Record<DerivativesInterval, DerivativesRow[]>>;
|
|
58
|
+
priceChangePct1h?: number | null;
|
|
58
59
|
intervals?: DerivativesInterval[];
|
|
59
60
|
staleAfterMsByInterval?: Partial<Record<DerivativesInterval, number>>;
|
|
60
61
|
}) => DerivativesContext;
|
|
@@ -69,42 +70,6 @@ type IndicatorRendererDescriptor = {
|
|
|
69
70
|
declare const getPluginIndicatorRenderers: (scope?: string) => IndicatorRendererDescriptor[];
|
|
70
71
|
declare const resetIndicatorRegistryCache: (scope?: string) => void;
|
|
71
72
|
|
|
72
|
-
type SpreadValue = number | null | undefined;
|
|
73
|
-
type SpreadPointInput = {
|
|
74
|
-
timestamp: number;
|
|
75
|
-
spread?: SpreadValue;
|
|
76
|
-
binancePrice?: SpreadValue;
|
|
77
|
-
coinbasePrice?: SpreadValue;
|
|
78
|
-
};
|
|
79
|
-
declare const createSpreadSmoother: (window?: number) => {
|
|
80
|
-
next: (params: {
|
|
81
|
-
binancePrice?: SpreadValue;
|
|
82
|
-
coinbasePrice?: SpreadValue;
|
|
83
|
-
fallbackSpread?: SpreadValue;
|
|
84
|
-
}) => number | null;
|
|
85
|
-
};
|
|
86
|
-
declare const smoothSpreadSeries: (points: SpreadPointInput[], window?: number) => Array<{
|
|
87
|
-
timestamp: number;
|
|
88
|
-
spread: number | null;
|
|
89
|
-
}>;
|
|
90
|
-
type PricePoint = {
|
|
91
|
-
ts: number;
|
|
92
|
-
close: number;
|
|
93
|
-
};
|
|
94
|
-
declare const intervalToMs: (interval: DerivativesInterval) => number;
|
|
95
|
-
declare const coinbaseProductFromSymbol: (symbol: string) => string | null;
|
|
96
|
-
declare const alignSpreadRows: (params: {
|
|
97
|
-
symbol: string;
|
|
98
|
-
interval: DerivativesInterval;
|
|
99
|
-
binance: PricePoint[];
|
|
100
|
-
coinbase: PricePoint[];
|
|
101
|
-
source: string;
|
|
102
|
-
}) => SpreadRow[];
|
|
103
|
-
declare const rollingMeanStd: (values: number[], endIndex: number, window: number) => {
|
|
104
|
-
mean: number;
|
|
105
|
-
std: number;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
73
|
type Level = {
|
|
109
74
|
id: string;
|
|
110
75
|
price: number;
|
|
@@ -128,4 +93,4 @@ type TrendlineEngine = {
|
|
|
128
93
|
};
|
|
129
94
|
declare const createTrendlineEngine: (initialCandles: KLineData[], options: TrendLineOptions) => TrendlineEngine;
|
|
130
95
|
|
|
131
|
-
export { type CoinalyzePoint, type IndicatorRendererDescriptor, type
|
|
96
|
+
export { type CoinalyzePoint, type IndicatorRendererDescriptor, type TrendlineEngine, alignSortedCandlesByTimestamp, buildDerivativesContext, buildReturnsFromCandles, calculateCoinBtcCorrelation, calculatePearsonCorrelation, coinalyzePointsToRows, createTrendlineEngine, detectRawSupportResistance, getPluginIndicatorCatalog, getPluginIndicatorRenderers, getRegisteredIndicatorEntries, getSupportResistanceLevels, mergeCoinalyzeMetrics, normalizeCoinalyzeSymbols, normalizeDerivativesIntervals, registerIndicatorEntries, resetIndicatorRegistryCache, toArrayData, toCoinalyzeTimestampMs, toFiniteNumber };
|
package/dist/indicators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { KlineChartItem, DerivativesInterval, DerivativesRow, Direction, DerivativesContext, IndicatorPluginRenderer, Indicator, IndicatorPluginEntry,
|
|
2
|
-
export { I as IndicatorPeriods, a as applyIndicatorsToHistory,
|
|
1
|
+
import { KlineChartItem, DerivativesInterval, DerivativesRow, Direction, DerivativesContext, IndicatorPluginRenderer, Indicator, IndicatorPluginEntry, TrendLine, TrendLineOptions } from '@tradejs/types';
|
|
2
|
+
export { C as COMPACT_INDICATORS_SNAPSHOT_KEY, c as COMPACT_INDICATORS_SNAPSHOT_SYMBOL, I as IndicatorPeriods, b as IndicatorsControllerCheckpointState, a as IndicatorsControllerRuntimeState, P as PricePoint, S as SpreadSmootherState, d as alignSpreadRows, e as applyIndicatorsToHistory, f as buildMlCandleIndicators, g as buildMlTimeframeIndicators, h as coinbaseProductFromSymbol, i as createIndicators, j as createSerializableSpreadSmoother, k as createSpreadSmoother, l as getRequiredControllerSeedWindow, m as intervalToMs, r as rollingMeanStd, s as smoothSpreadSeries } from './indicators-Da_i06-8.js';
|
|
3
3
|
import { KLineData } from 'klinecharts';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -55,6 +55,7 @@ declare const buildDerivativesContext: (params: {
|
|
|
55
55
|
direction: Direction;
|
|
56
56
|
timestamp: number;
|
|
57
57
|
rowsByInterval: Partial<Record<DerivativesInterval, DerivativesRow[]>>;
|
|
58
|
+
priceChangePct1h?: number | null;
|
|
58
59
|
intervals?: DerivativesInterval[];
|
|
59
60
|
staleAfterMsByInterval?: Partial<Record<DerivativesInterval, number>>;
|
|
60
61
|
}) => DerivativesContext;
|
|
@@ -69,42 +70,6 @@ type IndicatorRendererDescriptor = {
|
|
|
69
70
|
declare const getPluginIndicatorRenderers: (scope?: string) => IndicatorRendererDescriptor[];
|
|
70
71
|
declare const resetIndicatorRegistryCache: (scope?: string) => void;
|
|
71
72
|
|
|
72
|
-
type SpreadValue = number | null | undefined;
|
|
73
|
-
type SpreadPointInput = {
|
|
74
|
-
timestamp: number;
|
|
75
|
-
spread?: SpreadValue;
|
|
76
|
-
binancePrice?: SpreadValue;
|
|
77
|
-
coinbasePrice?: SpreadValue;
|
|
78
|
-
};
|
|
79
|
-
declare const createSpreadSmoother: (window?: number) => {
|
|
80
|
-
next: (params: {
|
|
81
|
-
binancePrice?: SpreadValue;
|
|
82
|
-
coinbasePrice?: SpreadValue;
|
|
83
|
-
fallbackSpread?: SpreadValue;
|
|
84
|
-
}) => number | null;
|
|
85
|
-
};
|
|
86
|
-
declare const smoothSpreadSeries: (points: SpreadPointInput[], window?: number) => Array<{
|
|
87
|
-
timestamp: number;
|
|
88
|
-
spread: number | null;
|
|
89
|
-
}>;
|
|
90
|
-
type PricePoint = {
|
|
91
|
-
ts: number;
|
|
92
|
-
close: number;
|
|
93
|
-
};
|
|
94
|
-
declare const intervalToMs: (interval: DerivativesInterval) => number;
|
|
95
|
-
declare const coinbaseProductFromSymbol: (symbol: string) => string | null;
|
|
96
|
-
declare const alignSpreadRows: (params: {
|
|
97
|
-
symbol: string;
|
|
98
|
-
interval: DerivativesInterval;
|
|
99
|
-
binance: PricePoint[];
|
|
100
|
-
coinbase: PricePoint[];
|
|
101
|
-
source: string;
|
|
102
|
-
}) => SpreadRow[];
|
|
103
|
-
declare const rollingMeanStd: (values: number[], endIndex: number, window: number) => {
|
|
104
|
-
mean: number;
|
|
105
|
-
std: number;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
73
|
type Level = {
|
|
109
74
|
id: string;
|
|
110
75
|
price: number;
|
|
@@ -128,4 +93,4 @@ type TrendlineEngine = {
|
|
|
128
93
|
};
|
|
129
94
|
declare const createTrendlineEngine: (initialCandles: KLineData[], options: TrendLineOptions) => TrendlineEngine;
|
|
130
95
|
|
|
131
|
-
export { type CoinalyzePoint, type IndicatorRendererDescriptor, type
|
|
96
|
+
export { type CoinalyzePoint, type IndicatorRendererDescriptor, type TrendlineEngine, alignSortedCandlesByTimestamp, buildDerivativesContext, buildReturnsFromCandles, calculateCoinBtcCorrelation, calculatePearsonCorrelation, coinalyzePointsToRows, createTrendlineEngine, detectRawSupportResistance, getPluginIndicatorCatalog, getPluginIndicatorRenderers, getRegisteredIndicatorEntries, getSupportResistanceLevels, mergeCoinalyzeMetrics, normalizeCoinalyzeSymbols, normalizeDerivativesIntervals, registerIndicatorEntries, resetIndicatorRegistryCache, toArrayData, toCoinalyzeTimestampMs, toFiniteNumber };
|