Open fswzb opened 7 years ago
C:\Python35\python.exe C:/www/rqalpha-develop/rqalpha run -f C:\www\rqalpha-develop\rqalpha\examples\rsi.py -s 2017-01-01 -e 2017-04-01 --stock-starting-cash 100000 -mc tushare1.enable True 2017-01-03 ERROR Traceback (most recent call last): File C:\www\rqalpha-develop\rqalpha\examples\rsi.py, line 38 in handle_bar rsi_data = talib.RSI(prices, timeperiod=context.TIME_PERIOD)[-1] --> context = Context({stocks = ['000001.XSHE', '601988.XSHG', '000068.XSHE'], ORDER_PERCENT = 0.3, s2 = '601988.XSHG', LOW_RSI = 30, s3 = '000068.XSHE', TIME_PERIOD = 14, HI ... --> stock = '000001.XSHE' --> prices = array([[ 9.42], [ 9.4 ], [ 9.25], [ 9.25], [ 9.2 ], [ 9.11], [ 9.16], [ 9.14], [ 9.08], [ 9.12], ... --> bar_dict = BarMap()
Exception: real has wrong dimensions Traceback (most recent call last): File "C:\www\rqalpha-develop\rqalpha\core\strategy.py", line 84, in handle_bar self._handle_bar(self._user_context, bar_dict) �� �� �� BarMap() �� �� <rqalpha.core.strategy.Strategy object at 0x140AF8F0> �� <rqalpha.core.strategy.Strategy object at 0x140AF8F0> File "C:\www\rqalpha-develop\rqalpha\examples\rsi.py", line 38, in handle_bar rsi_data = talib.RSI(prices, timeperiod=context.TIME_PERIOD)[-1] �� �� �� Context({stocks = ['000001.XSHE', '601988.XSHG', '000068.XSHE'], ORDER_PERCENT = 0.3, s2 = '601988.XSHG', LOW_RSI = 30, s3 = '00... �� �� array([[ 9.42], [ 9.4 ], [ 9.25], [ 9.25], [ 9.2 ], [ 9.11], [ 9.16], [ 9.14], ... �� <module 'talib' from 'C:\Python35\lib\site-packages\talib\init.py'> File "talib/func.pyx", line 9649, in talib.func.RSI (talib\func.c:101770) Exception: real has wrong dimensions
Process finished with exit code 0
这个问题看起来应该是因为 tushare mod 没有完整还原 bar 对象的字段,或是因为从 tushare 拿到的数据不完整。这个 mod 目前还处在 demo 阶段,这个问题只能等待后续开发。这也是我们没有把这个 mod 发到 pypi 的原因。
参考 https://github.com/ricequant/rqalpha-mod-tushare/pull/5
C:\Python35\python.exe C:/www/rqalpha-develop/rqalpha run -f C:\www\rqalpha-develop\rqalpha\examples\rsi.py -s 2017-01-01 -e 2017-04-01 --stock-starting-cash 100000 -mc tushare1.enable True 2017-01-03 ERROR Traceback (most recent call last): File C:\www\rqalpha-develop\rqalpha\examples\rsi.py, line 38 in handle_bar rsi_data = talib.RSI(prices, timeperiod=context.TIME_PERIOD)[-1] --> context = Context({stocks = ['000001.XSHE', '601988.XSHG', '000068.XSHE'], ORDER_PERCENT = 0.3, s2 = '601988.XSHG', LOW_RSI = 30, s3 = '000068.XSHE', TIME_PERIOD = 14, HI ... --> stock = '000001.XSHE' --> prices = array([[ 9.42], [ 9.4 ], [ 9.25], [ 9.25], [ 9.2 ], [ 9.11], [ 9.16], [ 9.14], [ 9.08], [ 9.12], ... --> bar_dict = BarMap()
Exception: real has wrong dimensions Traceback (most recent call last): File "C:\www\rqalpha-develop\rqalpha\core\strategy.py", line 84, in handle_bar self._handle_bar(self._user_context, bar_dict) �� �� �� BarMap() �� �� <rqalpha.core.strategy.Strategy object at 0x140AF8F0> �� <rqalpha.core.strategy.Strategy object at 0x140AF8F0> File "C:\www\rqalpha-develop\rqalpha\examples\rsi.py", line 38, in handle_bar rsi_data = talib.RSI(prices, timeperiod=context.TIME_PERIOD)[-1] �� �� �� Context({stocks = ['000001.XSHE', '601988.XSHG', '000068.XSHE'], ORDER_PERCENT = 0.3, s2 = '601988.XSHG', LOW_RSI = 30, s3 = '00... �� �� array([[ 9.42], [ 9.4 ], [ 9.25], [ 9.25], [ 9.2 ], [ 9.11], [ 9.16], [ 9.14], ... �� <module 'talib' from 'C:\Python35\lib\site-packages\talib\init.py'> File "talib/func.pyx", line 9649, in talib.func.RSI (talib\func.c:101770) Exception: real has wrong dimensions
Process finished with exit code 0