Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSAR fires InvalidOptionError when it should raise InvalidInputError #38

Open
smauermann opened this issue Aug 11, 2019 · 1 comment
Open

Comments

@smauermann
Copy link

smauermann commented Aug 11, 2019

Consider following snippet, where I pass arrays of length 1 to ti.psar():

>>> import tulipy as ti
>>> import numpy as np
>>> ti.psar(np.array([3]), np.array([1]),0.2,2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "xxx/lib/python3.7/site-packages/tulipy/__init__.py", line 919, in psar
    return lib.psar([high, low], [acceleration_factor_step, acceleration_factor_maximum])
  File "tulipy/lib/__init__.pyx", line 105, in tulipy.lib._Indicator.__call__
tulipy.lib.InvalidOptionError

To me the error type is confusing, since clearly the inputs do not conform here. Wouldn't it make sense to raise InvalidInputError here?

@cirla
Copy link
Collaborator

cirla commented Aug 28, 2019

Probably this code.

Looks like ti_psar_start always returns 1 so the Cython code will raise InvalidOptionError but the tulipy behavior is to silently do nothing with the output.

I'm not sure how to generically implement this, we'd have to special case certain indicators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants