2.3 TA-Lib包装指标¶
由于内建指标还不完整,在交互工具里对TA-Lib进行了包装,命名方式统一为 TA_FUNC名称。其中,ta-lib指标的lookback属性,用discard属性代替。
In [23]:
RuntimeError Traceback (most recent call last)
in ()
----> 1 x = TA_SMA(CLOSE(k))
2 print(x)
3 x.plot()
4
5 print(x.discard)
~/hikyuu/tools/hikyuu/indicator/init.py in TA_SMA(ind, timeperiod)
881 params={'timeperiod': timeperiod})
882 if ind is not None:
--> 883 imp.calculate(ind)
884 return Indicator(imp)
885
~/hikyuu/tools/hikyuu/indicator/init.py in tawrap_calculate(self, ind)
254 func_params = {}
255 for name in param_names:
--> 256 func_params[name] = self.getParam(name)
257
258 self._tafunc.set_parameters(func_params)
RuntimeError: boost::bad_any_cast: failed conversion using boost::any_cast