Pandas Zipline数据msgpacks不是';t通过源代码分发-algo交易
我正在尝试运行一个简单的zipline教程来测试GOOG中的一个交易算法,但无法让它工作。这就是问题所在:Pandas Zipline数据msgpacks不是';t通过源代码分发-algo交易,pandas,algorithmic-trading,zipline,Pandas,Algorithmic Trading,Zipline,我正在尝试运行一个简单的zipline教程来测试GOOG中的一个交易算法,但无法让它工作。这就是问题所在: dma = DualMovingAverage() results = dma.run(data) 返回以下文件: data msgpacks aren't distributed with source. Fetching data from Yahoo Finance. data msgpacks aren't distributed with source. Fetching da
dma = DualMovingAverage()
results = dma.run(data)
返回以下文件:
data msgpacks aren't distributed with source.
Fetching data from Yahoo Finance.
data msgpacks aren't distributed with source.
Fetching data from data.treasury.gov
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-11-daf3c4eec6f3> in <module>()
1 dma = DualMovingAverage()
----> 2 results = dma.run(data)
/home/luis/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/zipline/algorithm.pyc in run(self, source, sim_params, benchmark_return_source)
297 trans_descr['class'],
298 *trans_descr['args'],
--> 299 **trans_descr['kwargs']
300 )
301 sf.namestring = namestring
/home/luis/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/zipline/transforms/utils.pyc in __init__(self, tnfm_class, *args, **kwargs)
111 # usually resolves to our super call.
112 self.state = super(TransformMeta, tnfm_class).__call__(
--> 113 *args, **kwargs)
114 # Normal object instantiation.
115 else:
TypeError: __init__() got an unexpected keyword argument 'days'
数据msgpack不随源一起分发。
从雅虎财经获取数据。
数据MSGPack不随源一起分发。
从data.treasury.gov获取数据
---------------------------------------------------------------------------
TypeError回溯(最近一次调用上次)
在()
1 dma=双移动平均值()
---->2结果=dma.run(数据)
/home/luis/enthught/Canopy_64bit/User/lib/python2.7/site-packages/zipline/algorithm.pyc正在运行(self、source、sim参数、benchmark返回源)
297 trans_descr[“类”],
298*trans_descr['args'],
-->299**trans_descr['kwargs']
300 )
301 sf.namestring=namestring
/home/luis/enthught/Canopy_64bit/User/lib/python2.7/site-packages/zipline/transforms/utils.pyc in_uuuuuuuinit_uuuuuuuuuu(self,tnfm_class,*args,**kwargs)
111#通常决定我们的超级电话。
112 self.state=super(TransformMeta,tnfm\u类)。\u调用__(
-->113*args,**kwargs)
114#普通对象实例化。
115其他:
TypeError:\uuuu init\uuuuuuuuuu()获得了意外的关键字参数“days”
我对我的开发人员使用的库很“频繁”(pandas、scikit learn、numpy、seaborn、mcerp等,加上我自己的库有很多依赖项),所以我不知道这是否与此有关
除此之外,我还在Ubuntu(虚拟机)虚拟机中运行Enthough的Python 2.7中的所有内容
有没有关于如何解决这个问题的帮助
干杯路易斯
我刚开始检查包裹。我的理解是,根据这次谈话,熊猫、Scikit了解到,Numpy不应该引起问题。事实上,它正在使用Panadas获取prince数据
此外,这里还有一个到Dan Dunn YouTube网站的链接,该网站有一个快速启动视频
Douglas“数据MSGPack不随源一起分发。”
只是一个免责声明,告诉您数据不是源代码附带的
这不是你错误的根源
错误似乎出现在DualMovingAverage()TradingAlgorithm的声明中。
也许你需要使用开始时间和结束时间而不是“天”。。。我不使用zipline的内置数据获取程序,相反,我更喜欢自己获取pandas中的数据,然后以正确的格式将其传递到zipline中。(股票符号作为列,时间戳作为行,价格数据作为值)
从run方法的zipline源代码(实际对algo进行操作的方法):
def run(self, source, sim_params=None, benchmark_return_source=None):
"""Run the algorithm.
:Arguments:
source : can be either:
- pandas.DataFrame
- zipline source
- list of zipline sources
If pandas.DataFrame is provided, it must have the
following structure:
* column names must consist of ints representing the
different sids
* index must be DatetimeIndex
* array contents should be price info.
:Returns:
daily_stats : pandas.DataFrame
Daily performance metrics such as returns, alpha etc.
"""