Skip to content

Commit

Permalink
Update stockstats.py
Browse files Browse the repository at this point in the history
  • Loading branch information
GleammerRay committed Jan 3, 2024
1 parent 82292a1 commit cde6e8a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions stockstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class StockStatsError(Exception):
'wt': (10, 21),
'vr': 26,
'vwma': 14,
'num': 0,
}


Expand Down Expand Up @@ -1744,6 +1745,14 @@ def _get_qqe(self, meta: _Meta):
self[meta.name_ex('l')] = self.to_series(qqe_long)
self[meta.name_ex('s')] = self.to_series(qqe_short)

def _get_num(self, meta):
split = meta.name.split(',')
decimal_places = 0.0
if (len(split) > 1):
decimal_places_str = split[1]
decimal_places = int(decimal_places_str) * pow(0.1, len(decimal_places_str))
self[meta.name] = meta.int0 + decimal_places

def to_series(self, arr: list):
return pd.Series(arr, index=self.close.index).fillna(0)

Expand Down Expand Up @@ -1900,6 +1909,7 @@ def handler(self):
('eribull', 'eribear'): self._get_eri,
('rvgi', 'rvgis'): self._get_rvgi,
('kst',): self._get_kst,
('num',): self._get_num,
}
for k in _dft_windows.keys():
if k not in ret:
Expand Down

0 comments on commit cde6e8a

Please sign in to comment.