ohlcv-indicators 3.3.2 → 3.3.5

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.
@@ -1,63 +0,0 @@
1
- export const pushToMain = ({main, index, key, value}) => {
2
-
3
- const {precision, priceBased, minMaxRanges, verticalOhlcv, autoMinMaxKeys, precisionMultiplier} = main
4
-
5
- if(value === null || typeof value === 'undefined')
6
- {
7
- main.invalidValueIndex = index //do not use let for main.invalidValueIndex
8
-
9
- for(const k of Object.keys(minMaxRanges))
10
- {
11
- minMaxRanges[k] = {min: Infinity, max: -Infinity}
12
- }
13
-
14
- verticalOhlcv[key][index] = null
15
- return false
16
- }
17
-
18
- verticalOhlcv[key][index] = value
19
-
20
- if(typeof value === 'number' && !key.includes('_x_'))
21
- {
22
- const keyInAutoMinMax = autoMinMaxKeys.includes(key)
23
-
24
- if(key.includes('_diff_') && keyInAutoMinMax)
25
- {
26
- if(!minMaxRanges.hasOwnProperty(key) || (minMaxRanges[key].min === Infinity || minMaxRanges[key].max === -Infinity))
27
- {
28
- minMaxRanges[key] = { min: -1, max: 1}
29
- }
30
- }
31
- else if(key.startsWith('candle_') && keyInAutoMinMax)
32
- {
33
- minMaxRanges[key] = { min: -3, max: 3}
34
- }
35
- else if(key.includes('_range_') && keyInAutoMinMax)
36
- {
37
- minMaxRanges[key] = { min: 0, max: 1 }
38
- }
39
- else if(key.startsWith('rsi_') && keyInAutoMinMax)
40
- {
41
- minMaxRanges[key] = { min: 0, max: 1 }
42
- }
43
- else {
44
- const newValue = (precision && priceBased.includes(key)) ? (value / precisionMultiplier) : value
45
-
46
- if(!minMaxRanges.hasOwnProperty(key))
47
- {
48
- minMaxRanges[key] = { min: Infinity, max: -Infinity }
49
- }
50
-
51
- if(newValue < minMaxRanges[key].min)
52
- {
53
- minMaxRanges[key].min = newValue
54
- }
55
- if(newValue > minMaxRanges[key].max)
56
- {
57
- minMaxRanges[key].max = newValue
58
- }
59
- }
60
- }
61
-
62
- return true
63
- }