掘金社区

帮我看看这是什么错误?Pinned highlighted

wolf 发表在策略研究 2021-01-18 17:39:38

策略研究
442
2
0

S C:\Users\zhengjianzhong.goldminer3\projects\2656fa6a-5961-11eb-a469-405bd8a8909d> & d:/tools/anaconda3/python.exe c:/Users/zhengjianzhong/.goldminer3/projects/2656fa6a-5961-11eb-a469-405bd8a8909d/main.py

python sdk version: 3.0.131
c_sdk version: b'3.2.9'

2021-01-18 17:37:25,385 ERROR [callback.py:593] ^^--------------遇到exception--------------^^
Traceback (most recent call last):
File "D:\tools\anaconda3\lib\site-packages\gm\callback.py", line 520, in callback_controller
return bar_callback_new(data)
File "D:\tools\anaconda3\lib\site-packages\gm\callback.py", line 125, in bar_callback_new
bar_callback(barnn)
File "D:\tools\anaconda3\lib\site-packages\gm\callback.py", line 146, in bar_callback
context.on_bar_fun(context, [bar, ])
File "c:\Users\zhengjianzhong.goldminer3\projects\2656fa6a-5961-11eb-a469-405bd8a8909d\main.py", line 25, in on_bar
short_avg = talib.SMA(prices.values.reshape(context.period), context.short)
ValueError: cannot reshape array of size 1 into shape (61,)
PS C:\Users\zhengjianzhong.goldminer3\projects\2656fa6a-5961-11eb-a469-405bd8a8909d>

评论: 2
  • talib函数运用的问题。prices这个数据只有1个元素,不能变成61*1。print一下prices看一下结构,是不是缺数据了。

    2021-01-18 18:02:46
  • 非常感谢支持,继续研究!

    2021-01-19 08:27:40

Looks like your connection to 掘金量化社区 - 量化交易者的交流社区 was lost, please wait while we try to reconnect.