ohlcv-indicators 1.1.3 → 1.1.4

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 CHANGED
@@ -25,10 +25,10 @@ export default class OHLCV_INDICATORS {
25
25
  acc.low.push(BigNumber(low))
26
26
  acc.close.push(BigNumber(close))
27
27
  acc.volume.push(BigNumber(volume))
28
- Object.keys(rest).forEach(key => {
29
- if (!acc[key]) acc[key] = []
30
- acc[key].push(rest[key])
31
- });
28
+ for (const key of Object.keys(rest)) {
29
+ if (!acc[key]) acc[key] = [];
30
+ acc[key].push(rest[key]);
31
+ }
32
32
  return acc;
33
33
  }, { open: [], high: [], low: [], close: [], volume: [] })
34
34
 
@@ -63,9 +63,9 @@ export default class OHLCV_INDICATORS {
63
63
 
64
64
  // Use Array.prototype.unshift to add NaN elements efficiently
65
65
  const nanArray = new Array(ohlcvLength - arr.length).fill(NaN)
66
- arr = nanArray.concat(arr)
67
-
68
- this.ohlcv[key] = arr.map(o => isNaN(o) ? o : o.toNumber())
66
+ arr = [...nanArray, ...arr]
67
+
68
+ this.ohlcv[key] = arr
69
69
  }
70
70
 
71
71
  crossPairs(arr)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohlcv-indicators",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "A JavaScript library featuring optimized trading indicators for OHLCV arrays [{open, high, low, close, value}], utilizing BigNumber precision for enhanced accuracy. This library is optimized for backtesting and trading bot development.",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/utilities.js CHANGED
@@ -43,5 +43,5 @@ export const findCrosses = (BigNumber, fast, slow) => {
43
43
  }
44
44
  }
45
45
 
46
- return crosses.map(o => BigNumber(o))
46
+ return crosses
47
47
  }
package/test/test.js CHANGED
@@ -10,21 +10,21 @@ const TEST = async () => {
10
10
 
11
11
  indicators
12
12
  .init(unparsedOHLCV)
13
- //.EMA(21)
14
- //.EMA(9, 'ema21')
15
- //.SMA(200)
16
- //.SMA(100, 'sma_200')
17
- //.MACD(12, 26, 9)
18
- //.BollingerBands(20, 2)
13
+ .EMA(21)
14
+ .EMA(9, 'ema21')
15
+ .SMA(200)
16
+ .SMA(100, 'sma_200')
17
+ .MACD(12, 26, 9)
18
+ .BollingerBands(20, 2)
19
19
  .IchimokuCloud(9, 26, 52)
20
20
  .RSI(14)
21
- //.MFI(14)
22
- //.RelativeVolume(10)
23
- //.RelativeVolume(20)
21
+ .MFI(14)
22
+ .RelativeVolume(10)
23
+ .RelativeVolume(20)
24
24
  .crossPairs([{fast: 'ema_9', slow: 'ema_21'}, {fast: 'close', slow: 'sma_200'}, {fast: 'rsi_14', slow: 70}])
25
25
 
26
26
  console.log(indicators.getLastValues())
27
- //console.log(VolumeProfile(BigNumber, indicators.getData(), 5))
27
+ console.log(VolumeProfile(BigNumber, indicators.getData(), 5))
28
28
  }
29
29
 
30
30
  TEST()