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. 查看Eclipse版本号及各个版本区别

    1. 找到eclipse安装目录 2. 进入readme文件夹,打开readme_eclipse.html 3. readme_eclipse.html呈现的第二行即数字版本号,如: Eclipse ...

  2. Nginx作为HTTP服务器--Nginx配置图片服务器

      首先安装nginx安装环境 nginx是C语言开发,建议在linux上运行,本教程使用Centos6.5作为安装环境. --> gcc 安装nginx需要先将官网下载的源码进行编译,编译依赖 ...

  3. 基本MVVM 和 ICommand用法举例(转)

    引言 在本贴中,我们将学习WPF Commands. Commands 可以很好地与 MVVM 模式 (Model- View-ViewModel)结合在一起.我们也将看到,视图(view)实际上是怎 ...

  4. Vue组件之全局组件与局部组件

    1全局注册实例 <div id="app"> <com-btn></com-btn> <com-btn></com-btn&g ...

  5. Spring第一天——入门与IOC

    大致内容 spring基本概念 IOC入门 [17.6.9更新],如何学习spring? 掌握用法 深入理解 不断实践 反复总结 再次深入理解与实践 一.Spring相关概念  1.概述: Sprin ...

  6. echarts 配置

    堆叠柱状图, 只要保证 stack 属性相同,就强制画成一列 这就是切割线

  7. Python并发式编程

    目录 进程 线程 GIL(Global Interpreter Lock) 线程的调用方式 直接调用 继承调用 join&Daemon方法 Daemon(True) 同步锁 死锁 递归锁 同步 ...

  8. python3.6新特性

    print(f'{6:^30}') print('\n'.join([' '.join([f'{i}*{j}={i*j:2d}' for j in range(1,i+1)]) for i in ra ...

  9. springboot 配置文件

    – Spring Boot使用一个全局的配置文件 • application.properties • application.yml – 配置文件放在src/main/resources目录或者类路 ...

  10. Idea中最最常见的快捷键

    掌握如下快捷键,基本就够用了.没必要记那么多. Ø  命令:Ctrl+Shift+A可以查找所有Intellij的命令,并且每个命令后面还有其快捷键.所以它不仅是一大神键,也是查找学习快捷键的工具. ...