ohlcv-indicators 1.8.9 → 1.9.0
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/index.js +32 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -236,4 +236,36 @@ export default class OHLCV_INDICATORS {
|
|
|
236
236
|
return this
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
+
map(callback)
|
|
240
|
+
{
|
|
241
|
+
this.compute()
|
|
242
|
+
|
|
243
|
+
const keyNames = Object.keys(this.verticalOhlcv)
|
|
244
|
+
const result = {}
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
for(let x = 0; x < this.len; x++)
|
|
248
|
+
{
|
|
249
|
+
let row = {}
|
|
250
|
+
|
|
251
|
+
for(let k = 0; k < keyNames.length; k++)
|
|
252
|
+
{
|
|
253
|
+
Object.assign(row, {[keyNames[k]]: this.verticalOhlcv[keyNames[k]][x]})
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
for(const [k, value] of Object.entries(callback(row)))
|
|
257
|
+
{
|
|
258
|
+
if(x === 0)
|
|
259
|
+
{
|
|
260
|
+
result[k] = new Array(this.len).fill(null)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
result[k][x] = value
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
Object.assign(this.indicators, result)
|
|
268
|
+
|
|
269
|
+
return this
|
|
270
|
+
}
|
|
239
271
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ohlcv-indicators",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
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",
|