Closed xuanngo2001 closed 5 years ago
It's showing names as they are in Tulip Indicators. They are defined here.
Some of the names have percent signs in them too. e.g., Stochastic Oscillator has the "%k period" option.
Why are spaces in the name a problem? Maybe for consistency the output names should have the underscores replaced with spaces.
Because I use the print_info()
to discover what are the available input parameters. In the case of print_info(macd)
, to use it in Python, I have to call it as follows:
(macd, macd_signal, macd_histogram) = ti.macd(macd_input, short_period=2,
long_period=5,
signal_period=9)
When options print ['short period', 'long period', 'signal period'], you have to guess on the correct permutation. Is it short_period, shortperiod?
I haven't use the Stochastic Oscillator yet but if it prints "%k period". Then, what is the correct parameter? Is it k_period? kperiod? period?
I have to clean the names to make them valid python identifiers, but I wanted to preserve the .inputs
, .outputs
, and .options
as they are in the original Tulip Indicators.
Instead of using the demo print_info
function from the README, you could use inspect, e.g.:
# python 3
>>> inspect.signature(tulipy.macd)
<Signature (real, short_period, long_period, signal_period)>
# python 2
>>> inspect.getargspec(tulipy.macd)
ArgSpec(args=['real', 'short_period', 'long_period', 'signal_period'], varargs=None, keywords=None, defaults=None)
I'll see if I can find some time to add the parameter names to the function docstrings as well, so you could just print(tulipy.macd.__doc__)
.
For
print_info(indicator)
function provided in the readme.md, options names returned are not very accurate. For example,print_info(macd)
, it displays space in options names instead of underscore.I'm not sure whether to modify
print_info()
orindicator.options
. Notice that Outputs returns names with underscore.