ohlcv-indicators 1.9.7 → 1.9.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ohlcv-indicators",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.8",
|
|
4
4
|
"description": "A JavaScript library featuring optimized trading indicators for OHLCV arrays [{open, high, low, close, value}]. This library is optimized for backtesting and trading bot development.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -150,24 +150,7 @@ export const parseOhlcvToVertical = (input, main, startIndex = 0) => {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// Pre-process indicator params
|
|
153
|
-
const indicatorCalls =
|
|
154
|
-
if (inputParams && typeof inputParams === 'object') {
|
|
155
|
-
for (const key in inputParams) {
|
|
156
|
-
const technical = inputParams[key]
|
|
157
|
-
if (Array.isArray(technical)) {
|
|
158
|
-
for (let i = 0; i < technical.length; i++) {
|
|
159
|
-
const params = technical[i];
|
|
160
|
-
if (Array.isArray(params)) {
|
|
161
|
-
indicatorCalls.push({
|
|
162
|
-
key,
|
|
163
|
-
fn: indicatorFunctions[key],
|
|
164
|
-
args: params
|
|
165
|
-
})
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
153
|
+
const indicatorCalls = processIndicatorCalls(inputParams)
|
|
171
154
|
|
|
172
155
|
// Store references for numeric arrays to avoid repeated dictionary lookups
|
|
173
156
|
const vo_open = vert.open
|
|
@@ -258,11 +241,12 @@ export const parseOhlcvToVertical = (input, main, startIndex = 0) => {
|
|
|
258
241
|
if(key === 'crossPairs' || key === 'lag') continue
|
|
259
242
|
fn(main, x, ...args)
|
|
260
243
|
}
|
|
261
|
-
|
|
262
|
-
lag(main, x, inputParams.lag)
|
|
263
|
-
crossPairs(main, x, main.crossPairsList)
|
|
264
|
-
main.lastComputedIndex++
|
|
265
244
|
}
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
lag(main, x, inputParams.lag)
|
|
248
|
+
crossPairs(main, x, main.crossPairsList)
|
|
249
|
+
main.lastComputedIndex++
|
|
266
250
|
}
|
|
267
251
|
|
|
268
252
|
// Store current state so that we can continue from here in subsequent calls
|
|
@@ -271,3 +255,23 @@ export const parseOhlcvToVertical = (input, main, startIndex = 0) => {
|
|
|
271
255
|
main.sessionIntradayIndexCount = sessionIntradayIndexCount
|
|
272
256
|
main.cachedDayInfo = cachedDayInfo
|
|
273
257
|
}
|
|
258
|
+
|
|
259
|
+
const processIndicatorCalls = (inputParams) => {
|
|
260
|
+
if (!inputParams || typeof inputParams !== 'object') return [];
|
|
261
|
+
|
|
262
|
+
const indicatorCalls = [];
|
|
263
|
+
for (const [key, technical] of Object.entries(inputParams)) {
|
|
264
|
+
if (Array.isArray(technical)) {
|
|
265
|
+
for (const params of technical) {
|
|
266
|
+
if (Array.isArray(params)) {
|
|
267
|
+
indicatorCalls.push({
|
|
268
|
+
key,
|
|
269
|
+
fn: indicatorFunctions[key],
|
|
270
|
+
args: params,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return indicatorCalls;
|
|
277
|
+
};
|