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. DVWA-XSS学习笔记

    DVWA-XSS XSS概念:由于web应用程序对用户的输入过滤不严,通过html注入篡改网页,插入恶意脚本,从而在用户浏览网页时,控制用户浏览器的一种攻击. XSS类型: 反射型XSS:只是简单地把 ...

  2. 标识符and数据类型

    一,标识符 1.标识符用来给类,变量,包,方法等起名字的. 2.只能由字符,下滑线,美元符组成:这里的字符有大小写字母,中文字符,数字字符,但是符号只能有两个下划线和美元符. 3.不能由数字开头. 4 ...

  3. C# -- FTP上传下载

    C# -- FTP上传下载 1. C#实现FTP下载 private static void TestFtpDownloadFile(string strFtpPath, string strFile ...

  4. 使用fiddler模拟控制网速,实现网速慢。(丢包如何模拟)

    参考连接 https://blog.csdn.net/baidu_zhongce/article/details/46683323 参考连接2 https://www.jianshu.com/p/b9 ...

  5. 安装maven,并配置eclipse

    平台 ubuntu 18.04 + Java 8 下载并安装Maven 下载页面:http://maven.apache.org/download.cgi 我这里使用写博客是最新的版本3.6.1,选择 ...

  6. asp.net core 2.2 中的过滤器/筛选器(上)

    ASP.NET Core中的过滤器/筛选器 通过使用 ASP.NET Core MVC 中的筛选器,可在请求处理管道中的特定阶段之前或之后运行代码. 注意:本主题不适用于 Razor 页面. ASP. ...

  7. android AVD 启动时报错

    AVD启动报错 1.提示:ANDROID_SDK_ROOT is undefined / ERROR: This AVD’s configuration is missing a kernel fil ...

  8. dict、defaultdict 和 OrderedDict 比较

    一.dict.defaultdict 和 OrderedDict 常见的方法比较 dict.defaultdict 和 OrderedDict 常见的方法比较   dict defaultdict O ...

  9. Base 64 & decodeURIComponent

    Base 64 & decodeURIComponent js btoa() & atob() let obj = [{"key":"q",&q ...

  10. 使用excel整理脚本

    的时候需要通过excel数据初始化脚本,当数据过多的时候,脚本也就很多.这里记录一个平时用excel初始化脚本的小技巧. excel中在空单元格中写如下值: ="INSERT INTO db ...