File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 11[metadata]
22name = rtta
3- version = 0.1.3
3+ version = 0.1.4
44description = Low latency incremental technical analysis
55long_description = file: README.md
66long_description_content_type = text/markdown
Original file line number Diff line number Diff line change @@ -331,6 +331,7 @@ cdef class SMA():
331331 cdef int window
332332 cdef bint fillna
333333 cdef double tally
334+ cdef double mean
334335
335336 def __init__ (self , int window , bint fillna = False ):
336337 self .history = np.zeros(window)
@@ -340,6 +341,7 @@ cdef class SMA():
340341 self .window = window
341342 self .fillna = fillna
342343 self .tally = 0
344+ self .mean = float (' nan' )
343345
344346 @ cython.boundscheck (False ) # turn off bounds-checking for entire function
345347 @ cython.wraparound (False )
@@ -356,9 +358,12 @@ cdef class SMA():
356358
357359 if self .first_pass:
358360 if not self .fillna:
359- return np.nan
360- return self .tally / self .index
361- return self .tally/ self .window
361+ self .mean = np.nan
362+ return self .mean
363+ self .mean = self .tally / self .index
364+ return self .mean
365+ self .mean = self .tally/ self .window
366+ return self .mean
362367
363368 cpdef batch(self , input ):
364369 cdef long i
You can’t perform that action at this time.
0 commit comments