Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix gen
  • Loading branch information
cirla committed Sep 14, 2018
1 parent e6df8c3 commit c85f165
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 27 deletions.
9 changes: 9 additions & 0 deletions gen/tulipy_gen.pyx
Expand Up @@ -77,6 +77,9 @@ TI_BUILD = ti.TI_BUILD
class InvalidOptionError(ValueError):
pass
class InvalidInputError(ValueError):
pass
cdef dict _type_names = {{
ti.TI_TYPE_OVERLAY: b'overlay',
ti.TI_TYPE_INDICATOR: b'indicator',
Expand Down Expand Up @@ -140,6 +143,12 @@ cdef class _Indicator:
cdef np.ndarray[np.float64_t, ndim=1, mode='c'] input_ref
for i in range(self.info.inputs):
if inputs[i].dtype == np.float64:
input_ref = inputs[i][-min_input_len:]
elif np.issubdtype(inputs[i].dtype, np.number):
input_ref = inputs[i][-min_input_len:].astype(np.float64)
else:
raise InvalidInputError("Input arrays must have a numeric dtype")
input_ref = inputs[i][-min_input_len:]
c_inputs[i] = &input_ref[0]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -20,7 +20,7 @@
description='Financial Technical Analysis Indicator Library. Python bindings for https://github.com/TulipCharts/tulipindicators',
long_description=long_description,
long_description_content_type='text/markdown',
version='0.3.0',
version='0.3.1',
url='https://github.com/cirla/tulipy',
author='https://github.com/cirla/tulipy/blob/master/AUTHORS',
license='LGPL-3.0',
Expand Down
14 changes: 14 additions & 0 deletions tulipy/__init__.py
Expand Up @@ -1107,6 +1107,20 @@ def stoch(high, low, close, pct_k_period, pct_k_slowing_period, pct_d_period):
stoch.outputs = [x.decode() for x in lib.stoch.outputs]


def stochrsi(real, period):
"""
Stochastic RSI
"""

return lib.stochrsi([real], [period])

stochrsi.full_name = lib.stochrsi.full_name.decode()
stochrsi.type = lib.stochrsi.type.decode()
stochrsi.inputs = [x.decode() for x in lib.stochrsi.inputs]
stochrsi.options = [x.decode() for x in lib.stochrsi.options]
stochrsi.outputs = [x.decode() for x in lib.stochrsi.outputs]


def sub(real, real2):
"""
Vector Subtraction
Expand Down
56 changes: 30 additions & 26 deletions tulipy/lib/__init__.pyx
Expand Up @@ -114,6 +114,7 @@ cdef class _Indicator:
input_ref = inputs[i][-min_input_len:].astype(np.float64)
else:
raise InvalidInputError("Input arrays must have a numeric dtype")
input_ref = inputs[i][-min_input_len:]
c_inputs[i] = &input_ref[0]

cdef ti.TI_REAL * c_outputs[ti.TI_MAXINDPARAMS]
Expand Down Expand Up @@ -362,80 +363,83 @@ stderr = _Indicator(75)
stoch = _Indicator(76)


sub = _Indicator(77)
stochrsi = _Indicator(77)


sum = _Indicator(78)
sub = _Indicator(78)


tan = _Indicator(79)
sum = _Indicator(79)


tanh = _Indicator(80)
tan = _Indicator(80)


tema = _Indicator(81)
tanh = _Indicator(81)


todeg = _Indicator(82)
tema = _Indicator(82)


torad = _Indicator(83)
todeg = _Indicator(83)


tr = _Indicator(84)
torad = _Indicator(84)


trima = _Indicator(85)
tr = _Indicator(85)


trix = _Indicator(86)
trima = _Indicator(86)


trunc = _Indicator(87)
trix = _Indicator(87)


tsf = _Indicator(88)
trunc = _Indicator(88)


typprice = _Indicator(89)
tsf = _Indicator(89)


ultosc = _Indicator(90)
typprice = _Indicator(90)


var = _Indicator(91)
ultosc = _Indicator(91)


vhf = _Indicator(92)
var = _Indicator(92)


vidya = _Indicator(93)
vhf = _Indicator(93)


volatility = _Indicator(94)
vidya = _Indicator(94)


vosc = _Indicator(95)
volatility = _Indicator(95)


vwma = _Indicator(96)
vosc = _Indicator(96)


wad = _Indicator(97)
vwma = _Indicator(97)


wcprice = _Indicator(98)
wad = _Indicator(98)


wilders = _Indicator(99)
wcprice = _Indicator(99)


willr = _Indicator(100)
wilders = _Indicator(100)


wma = _Indicator(101)
willr = _Indicator(101)


zlema = _Indicator(102)
wma = _Indicator(102)


zlema = _Indicator(103)

0 comments on commit c85f165

Please sign in to comment.