Zipline is a Pythonic algorithmic trading library. It is an event-driven system for backtesting. Zipline is currently used in production as the backtesting and live-trading engine powering Quantopian -- a free, community-centered, hosted platform for building and executing trading strategies.

zipline是一个Pythonic算法交易库。它是一个事件驱动的回测系统。Zipline目前为Quantopian在生产中被用作回测和实时交易引擎,Quantopian是一个用于建立和执行交易策略的免费的社区中心和托管平台。

Features

特征

Ease of Use: Zipline tries to get out of your way so that you can focus on algorithm development. See below for a code example.

使用方便:Zipline试图解放的双手,以便你可以专注于算法开发。请参见下面的代码示例。

"Batteries Included": many common statistics like moving average and linear regression can be readily accessed from within a user-written algorithm.

“内置电池”:许多常见的统计功能,如移动平均和线性回归,可以很容易地从用户编写的算法中调用。

PyData Integration: Input of historical data and output of performance statistics are based on Pandas DataFrames to integrate nicely into the existing PyData ecosystem.

PyDATA集成:历史数据的输入和性能统计的输出是基于Pandas DataFrames格式,以很好地集成到现有的PyDATA生态系统中。

Statistics and Machine Learning Libraries: You can use libraries like matplotlib, scipy, statsmodels, and sklearn to support development, analysis, and visualization of state-of-the-art trading systems.

统计和机器学习库:您可以使用像matplotlib, scipy, statsmodels, 和 sklearn这样的库来支持最先进的交易系统的开发、分析和可视化。

Quickstart

快速启动

See our getting started tutorial.

看我们入门教程。

The following code implements a simple dual moving average algorithm.

下面的代码实现了一个简单的双移动平均算法。

from zipline.api import order_target, record, symbol

def initialize(context):
context.i = 0
context.asset = symbol('AAPL') def handle_data(context, data):
# Skip first 300 days to get full windows
context.i += 1
if context.i < 300:
return # Compute averages
# data.history() has to be called with the same params
# from above and returns a pandas dataframe.
short_mavg = data.history(context.asset, 'price', bar_count=100, frequency="1d").mean()
long_mavg = data.history(context.asset, 'price', bar_count=300, frequency="1d").mean() # Trading logic
if short_mavg > long_mavg:
# order_target orders as many shares as needed to
# achieve the desired number of shares.
order_target(context.asset, 100)
elif short_mavg < long_mavg:
order_target(context.asset, 0) # Save values for later inspection
record(AAPL=data.current(context.asset, 'price'),
short_mavg=short_mavg,
long_mavg=long_mavg)

You can then run this algorithm using the Zipline CLI; you'll need a Quandl API key to ingest the default data bundle. Once you have your key, run the following from the command line:
然后可以使用 Zipline CLI运行此算法;您需要一个QUANDL API密钥来获取默认数据包。一旦拥有了密钥,就从命令行运行以下命令:

$ QUANDL_API_KEY=<yourkey> zipline ingest -b quandl
$ zipline run -f dual_moving_average.py --start 2014-1-1 --end 2018-1-1 -o dma.pickle

This will download asset pricing data data from quandl, and stream it through the algorithm over the specified time range. Then, the resulting performance DataFrame is saved in dma.pickle, which you can load an analyze from within Python.
这将从QuANDL下载证券价格数据,并在指定的时间范围内将其数据流通过算法。然后,将得到的DataFrame性能数据保存在dma.pickle中,可以从Python中加载分析。
You can find other examples in the zipline/examples directory.
您可以在Zipline /examples目录中找到其他示例。

Questions?
问题?
If you find a bug, feel free to open an issue and fill out the issue template.
如果发现bug,请自由打开问题并填写问题模板。

Contributing
贡献
All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome. Details on how to set up a development environment can be found in our development guidelines.
所有的贡献、bug报告、bug修复、文档改进、增强和想法都是受欢迎的。关于如何建立开发环境的细节可以在我们的开发指南中找到。
If you are looking to start working with the Zipline codebase, navigate to the GitHub issues tab and start looking through interesting issues. Sometimes there are issues labeled as Beginner Friendly or Help Wanted.
如果你想开始使用Zipline代码库,导航到GITHUB问题选项卡,开始浏览有趣的问题。有时有些问题被标示为初学友好或乐于助人。
Feel free to ask questions on the mailing list or on Gitter.
在邮件列表或GITER上自由提问。

zipline框架--简介的更多相关文章

  1. Spring 系列: Spring 框架简介 -7个部分

    Spring 系列: Spring 框架简介 Spring AOP 和 IOC 容器入门 在这由三部分组成的介绍 Spring 框架的系列文章的第一期中,将开始学习如何用 Spring 技术构建轻量级 ...

  2. 《HiWind企业快速开发框架实战》(0)目录及框架简介

    <HiWind企业快速开发框架实战>(0)目录及框架简介 本系列主要介绍一款企业管理系统快速开发框架,该框架旨在快速完成企业管理系统,并实现易维护可移植的目标. 使用逐个系统模块进行编码的 ...

  3. Yaf零基础学习总结1-Yaf框架简介

    从今天开始,给大家讲解下yaf框架,讲解之前肯定要了解下yaf是个什么东西,当然,从标题我们已经知道yaf是个PHP框架了,也许大家对于PHP框架并不陌生,一般PHP程序员用过的框架至少有一两个吧,国 ...

  4. hdwiki 框架简介

    虽然HDwiki是一个开源的wiki系统,并且代码简洁易懂,但如果想在系统上做做进一步开发还需要对框架有一个整体的认识.熟悉了HDwiki的框架以后完全可以独立出来做其他功能的开发,当做一个开源的PH ...

  5. Apache—DBUtils框架简介

    转载自:http://blog.csdn.net/fengdongkun/article/details/8236216 Apache—DBUtils框架简介.DbUtils类.QueryRunner ...

  6. Jersey框架一:Jersey RESTful WebService框架简介

    Jersey系列文章: Jersey框架一:Jersey RESTful WebService框架简介 Jersey框架二:Jersey对JSON的支持 Jersey框架三:Jersey对HTTPS的 ...

  7. Web自动化框架LazyUI使用手册(1)--框架简介

    作者:cryanimal QQ:164166060 web端自动化简介 web端自动化,即通过自动化的方式,对Web页面施行一系列的仿鼠标键盘操作,以达到对Web页面的功能进行自动化测试的目的. 其一 ...

  8. python运维开发(二十二)---JSONP、瀑布流、组合搜索、多级评论、tornado框架简介

    内容目录: JSONP应用 瀑布流布局 组合搜索 多级评论 tornado框架简介 JSONP应用 由于浏览器存在同源策略机制,同源策略阻止从一个源加载的文档或脚本获取或设置另一个源加载的文档的属性. ...

  9. Spring 系列: Spring 框架简介(转载)

    Spring 系列: Spring 框架简介 http://www.ibm.com/developerworks/cn/java/wa-spring1/ Spring AOP 和 IOC 容器入门 在 ...

随机推荐

  1. WebApi 身份认证解决方案:Basic基础认证

    前言:最近,讨论到数据库安全的问题,于是就引出了WebApi服务没有加任何验证的问题.也就是说,任何人只要知道了接口的url,都能够模拟http请求去访问我们的服务接口,从而去增删改查数据库,这后果想 ...

  2. DES加密算法应用:分组加密模式

    通常,大多数的分组加密算法都是把数据按照64位分组的方式进行加密和解密.但是几乎所有的加密工作所涉及的数据量都远远大于64位,因此就需要不断地重复加密过程,直到处理完所有的分组.这种分组加密中所涉及的 ...

  3. Linux环境下将Oracle11g数据库模式由非归档模式(Noarchivelog)修改为自动归档模式(archivelog)

    1.查看Oracle当前版本 select * from v$version 如图所示: 2.切换到Oracle用户 su - oracle 如图所示: 3.进入sqlplus(此时尚未登录oracl ...

  4. EXCEL记录

    ー.重要快捷键 Ctrl + F → 查找 Ctrl + H → 替换 Ctrl + G → 定位 Ctrl + 1 → 设置单元格格式 Ctrl + Enter → 一并输入多个单元格 Ctrl + ...

  5. 安装sql server2017出现错误:Visual Studio 运行时"Microsoft visual c++2017 X64 Minimum Runtime - 14.10.25008"需要修复

    安装sql server 2017 Developer Edition时,安装选择“基本”,发生如下错误: 解决方法: 1.进入控制面板→程序中,找到“Microsoft visual c++2017 ...

  6. 菜鸟学IT之python网页爬取初体验

    作业来源:https://edu.cnblogs.com/campus/gzcc/GZCC-16SE1/homework/2881 1. 简单说明爬虫原理 爬虫简单来说就是通过程序模拟浏览器放松请求站 ...

  7. 安装Cnario Player 3.8.1.156或其他版本时提示"Warning 4154. Adobe Flash Player 13 ...not correctly installed"

    错误提示 安装Cnario Player 3.8.1.156或其他版本时, 有时会出现如下提示: Warning 4154. Adobe Flash Player 13 ...not correctl ...

  8. 【学习总结】GirlsInAI ML-diary day-19-面向对象编程

    [学习总结]GirlsInAI ML-diary 总 原博github链接-day19 认识面向对象 Python使用类(class)和对象(object),进行面向对象(object-oriente ...

  9. XXXX is not in the sudoers file. This incident will be reported解决方法

    假设你用的是Red Hat系列(包括Fedora和CentOS)的Linux系统.当你执行sudo命令时可能会提示“某某用户 is not in the sudoers file.  This inc ...

  10. react-redux的基本用法

    注意:读懂本文需要具备redux基础知识, 注明:本文旨在说明如何在实际项目中快速使用react-redux,限于篇幅,本文对具体的原理并未做分析,请参考redux官网 我一直以为我写了一篇关于rea ...