Python中文
首页
教程
问答
标签
搜索
登录
注册
Pyalgotrade教程属性E
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我已经在google上搜索了一段时间,但是仍然无法找到解决方案,甚至无法确定问题所在。在</p> <p>我对Python和Pyalgotrade的安装是正确的,通过成功的导入验证了这一点。在</p> <p>尽管如此,我还是无法运行教程中的示例代码,它总是抛出:</p> <pre><code>AttributeError: MyStrategy instance has no attribute 'info' </code></pre> <p>下面是示例代码:</p> ^{pr2}$ <p>以及iPython笔记本电脑的输出:</p> <pre><code>--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-1-f786d1b471f7> in <module>() 18 # Evaluate the strategy with the feed's bars. 19 myStrategy = MyStrategy(feed, "orcl") ---> 20 myStrategy.run() /usr/local/lib/python2.7/site-packages/pyalgotrade/strategy/__init__.pyc in run(self) 398 self.onStart() 399 --> 400 self.__dispatcher.run() 401 402 if self.__feed.getCurrentBars() != None: /usr/local/lib/python2.7/site-packages/pyalgotrade/observer.pyc in run(self) 139 subject.start() 140 --> 141 while not self.__stopped and self.__dispatch(): 142 pass 143 finally: /usr/local/lib/python2.7/site-packages/pyalgotrade/observer.pyc in __dispatch(self) 131 nextDateTime = subject.peekDateTime() 132 if nextDateTime == None or nextDateTime == smallestDateTime: --> 133 subject.dispatch() 134 return ret 135 /usr/local/lib/python2.7/site-packages/pyalgotrade/feed/__init__.pyc in dispatch(self) 95 dateTime, values = self.getNextValuesAndUpdateDS() 96 if dateTime != None: ---> 97 self.__event.emit(dateTime, values) 98 99 def getKeys(self): /usr/local/lib/python2.7/site-packages/pyalgotrade/observer.pyc in emit(self, *parameters) 51 self.__emitting = True 52 for handler in self.__handlers: ---> 53 handler(*parameters) 54 self.__emitting = False 55 self.__applyChanges() /usr/local/lib/python2.7/site-packages/pyalgotrade/strategy/__init__.pyc in __onBars(self, dateTime, bars) 386 387 # 1: Let the strategy process current bars and place orders. --> 388 self.onBars(bars) 389 390 # 2: Place the necessary orders for positions marked to exit on session close. <ipython-input-1-f786d1b471f7> in onBars(self, bars) 10 def onBars(self, bars): 11 bar = bars[self.__instrument] ---> 12 self.info(bar.getClose()) 13 14 # Load the yahoo feed from the CSV file AttributeError: MyStrategy instance has no attribute 'info' </code></pre> <p>有没有人至少知道问题出在哪里?在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p><em>摘自问题:</em></p> <p>所以,我把PyAlgoTrade更新到0.15,现在示例代码可以工作了。我还没有调查错误的原因,但可以肯定地说0.15是按预期工作的。在</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何在python中从数据帧列中删除分类值?
10 回答
如何在python中从数据帧列表中删除引号
2 回答
如何在python中从数据帧创建列表
3 回答
如何在Python中从数据帧创建嵌套的JSON
10 回答
如何在Python中从数据帧显示wordcloud
9 回答
如何在Python中从数据帧的时间戳中删除字符
5 回答
如何在Python中从数据帧绘制简单绘图?
1 回答
如何在python中从数据帧行提取具有特定长度的范围?
5 回答
如何在python中从数据帧设置dict中的值
9 回答
如何在Python中从数据库中获得一个结果
10 回答
如何在python中从数据框中绘制分类条形图
2 回答
如何在Python中从数据框中选择特定细节?
9 回答
如何在python中从数据集中删除unicode
2 回答
如何在python中从数据集中删除某些数值?
8 回答
如何在python中从数据集中选择行
10 回答
如何在Python中从数组中删除元素
5 回答
如何在python中从数组中删除单个倒逗号?
10 回答
如何在python中从数组中删除对象?
9 回答
如何在python中从数组中删除引号
6 回答
如何在python中从数组中删除所有最小值
3 回答