ohlcv-indicators 1.7.9 → 1.8.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.
Files changed (2) hide show
  1. package/index.js +8 -14
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -19,7 +19,7 @@ export default class OHLCV_INDICATORS {
19
19
  if(input.length === 0) throw Error('input ohlcv must not be empty: ' + ticker)
20
20
  if(!input[0].hasOwnProperty('close')) throw Error('input ohlcv array objects require at least close property: ' + ticker)
21
21
 
22
- this.priceBased = new Set(['open', 'high', 'low', 'close', 'mid_price_open_close', 'mid_price_high_low'])
22
+ this.priceBased = ['open', 'high', 'low', 'close', 'mid_price_open_close', 'mid_price_high_low']
23
23
  this.len = input.length
24
24
  this.crossPairsArr = []
25
25
  this.inputOhlcv = input
@@ -140,9 +140,9 @@ export default class OHLCV_INDICATORS {
140
140
 
141
141
  Object.assign(this.indicators, {[key]: values})
142
142
 
143
- if([...priceBased].find(v => key.startsWith(v)))
143
+ if(priceBased.find(v => key.startsWith(v)))
144
144
  {
145
- this.priceBased.add(key)
145
+ this.priceBased.push(key)
146
146
  }
147
147
  }
148
148
  }
@@ -167,7 +167,7 @@ export default class OHLCV_INDICATORS {
167
167
  const result = ema(this, size)
168
168
  Object.assign(this.indicators, result)
169
169
 
170
- this.priceBased.add(`ema_${size}`)
170
+ this.priceBased.push(`ema_${size}`)
171
171
 
172
172
  return this
173
173
  }
@@ -176,7 +176,7 @@ export default class OHLCV_INDICATORS {
176
176
  const result = sma(this, size)
177
177
  Object.assign(this.indicators, result)
178
178
 
179
- this.priceBased.add(`sma_${size}`)
179
+ this.priceBased.push(`sma_${size}`)
180
180
 
181
181
  return this
182
182
  }
@@ -194,9 +194,7 @@ export default class OHLCV_INDICATORS {
194
194
  const result = bollingerBands(this, size, times)
195
195
  Object.assign(this.indicators, result)
196
196
 
197
- this.priceBased.add('bollinger_bands_middle')
198
- this.priceBased.add('bollinger_bands_upper')
199
- this.priceBased.add('bollinger_bands_lower')
197
+ this.priceBased.push('bollinger_bands_middle', 'bollinger_bands_upper', 'bollinger_bands_lower')
200
198
 
201
199
  return this
202
200
  }
@@ -213,8 +211,7 @@ export default class OHLCV_INDICATORS {
213
211
  const result = orb(this)
214
212
  Object.assign(this.indicators, result)
215
213
 
216
- this.priceBased.add('orb_high')
217
- this.priceBased.add('orb_low')
214
+ this.priceBased.push('orb_high', 'orb_low')
218
215
 
219
216
  return this
220
217
  }
@@ -223,10 +220,7 @@ export default class OHLCV_INDICATORS {
223
220
  const result = donchianChannels(this, period, offset)
224
221
  Object.assign(this.indicators, result)
225
222
 
226
-
227
- this.priceBased.add('donchian_channel_upper')
228
- this.priceBased.add('donchian_channel_lower')
229
- this.priceBased.add('donchian_channel_basis')
223
+ this.priceBased.push('donchian_channel_upper', 'donchian_channel_lower', 'donchian_channel_basis')
230
224
 
231
225
  return this
232
226
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohlcv-indicators",
3
- "version": "1.7.9",
3
+ "version": "1.8.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",