ohlcv-indicators 3.5.45 → 3.5.47

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.
@@ -25,7 +25,7 @@ export const buildArray = (arrayType, len) => {
25
25
  }
26
26
 
27
27
  export const assignTypes = main => {
28
- const {firstRow, notNumberKeys} = main
28
+ const {firstRow} = main
29
29
  const inputTypes = {}
30
30
  const arrayTypes = {}
31
31
 
@@ -34,13 +34,11 @@ export const assignTypes = main => {
34
34
  if (colName === 'date') {
35
35
  inputTypes[colName] = selectDateFormatter(cellValue, true)
36
36
  arrayTypes[colName] = 'Array'
37
- notNumberKeys.add(colName)
38
37
  }
39
38
  else if(colName === 'volume')
40
39
  {
41
40
  inputTypes[colName] = classifyNum(cellValue, true)
42
41
  arrayTypes[colName] = 'Int32Array'
43
- notNumberKeys.add(colName)
44
42
  }
45
43
  else if(numberKeys.has(colName))
46
44
  {
@@ -50,14 +48,16 @@ export const assignTypes = main => {
50
48
  const thisType = classifyNum(cellValue, false)
51
49
  inputTypes[colName] = thisType
52
50
  arrayTypes[colName] = (thisType === 'number') ? 'Float64Array' : 'Array'
53
-
54
- if(!thisType.startsWith('number'))
55
- {
56
- notNumberKeys.add(colName)
57
- }
58
-
59
51
  }
60
52
  }
61
53
 
62
54
  return { inputTypes, arrayTypes }
63
55
  }
56
+
57
+
58
+ export const getArrayType = (key, arr) => {
59
+ if (!arr || typeof arr !== 'object') {
60
+ throw new TypeError(`Invalid array type: "${key}"`);
61
+ }
62
+ return arr.constructor.name;
63
+ }
@@ -2,7 +2,7 @@ import { dateOutputFormaters } from "./dateUtilities.js"
2
2
 
3
3
  export const verticalToHorizontal = ({main, skipNull = false, startIndex = 0, dateFormat}) => {
4
4
 
5
- const {precisionMultiplier, precision, verticalOhlcv, invalidValueIndex, len, verticalOhlcvKeyNames, verticalOhlcvTempCols, notNumberKeys} = main
5
+ const {verticalOhlcv, invalidValueIndex, len, verticalOhlcvKeyNames, verticalOhlcvTempCols} = main
6
6
 
7
7
  if (verticalOhlcvKeyNames.length === 0) return []
8
8
 
@@ -13,16 +13,10 @@ export const verticalToHorizontal = ({main, skipNull = false, startIndex = 0, da
13
13
 
14
14
  for(const [key, arr] of Object.entries(verticalOhlcv)){
15
15
  if(verticalOhlcvTempCols.has(key)) continue
16
- const shouldApplyPrecision = precision && !notNumberKeys.has(key)
17
16
 
18
17
  for (let i = maxStartIndex; i < len; i++)
19
18
  {
20
- if(shouldApplyPrecision)
21
- {
22
- result[i - maxStartIndex][key] = arr[i] / precisionMultiplier
23
-
24
- }
25
- else if(key === 'date')
19
+ if(key === 'date')
26
20
  {
27
21
  result[i - maxStartIndex][key] = dateOutputFormaters[dateFormat](arr[i])
28
22
  }
@@ -7,7 +7,7 @@ export const atr = (main, index, size, {lag, percentage, upper, lower}) => {
7
7
 
8
8
  if (index === 0) {
9
9
 
10
- const {instances, verticalOhlcv, arrayTypes, len} = main
10
+ const {instances, verticalOhlcv, len} = main
11
11
 
12
12
  instances[baseKeyName] = new FasterATR(size, FasterWSMA)
13
13
 
@@ -20,7 +20,6 @@ export const atr = (main, index, size, {lag, percentage, upper, lower}) => {
20
20
  for(const k of keyNames)
21
21
  {
22
22
  verticalOhlcv[k] = new Float64Array(len).fill(NaN)
23
- arrayTypes[k] = 'Float64Array'
24
23
  }
25
24
 
26
25
  if(lag > 0)