Zipline Development Guidelines
Development Guidelines
This page is intended for developers of Zipline, people who want to contribute to the Zipline codebase or documentation, or people who want to install from source and make local changes to their copy of Zipline.
本页面适用于Zipline的开发人员,希望为Zipline代码库或文档作出贡献的人员,或希望从源代码进行安装并对其Zipline副本进行本地更改的人员。
All contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome. We track issues on GitHub and also have a mailing list where you can ask questions.
所有贡献,错误报告,错误修复,文档改进,增强功能和创意都受到欢迎。 我们在GitHub上跟踪问题,并且还有一个邮件列表,您可以在其中提问。
Creating a Development Environment 创建开发环境
First, you’ll need to clone Zipline by running: 首先,您需要运行以下命令克隆Zipline:
$ git clone git@github.com:your-github-username/zipline.git
Then check out to a new branch where you can make your changes: 然后签出一个新的分支,您可以在其中进行更改:
$ git checkout -b some-short-descriptive-name
If you don’t already have them, you’ll need some C library dependencies. You can follow the install guide to get the appropriate dependencies.
如果你还没有他们,你需要一些C库依赖。 您可以按照安装指南获取适当的依赖关系。
The following section assumes you already have virtualenvwrapper and pip installed on your system. Suggested installation of Python library dependencies used for development:
以下部分假定您已经在系统上安装了virtualenvwrapper和pip。 建议安装用于开发的Python库依赖项:
$ mkvirtualenv zipline $ ./etc/ordered_pip.sh ./etc/requirements.txt $ pip install -r ./etc/requirements_dev.txt $ pip install -r ./etc/requirements_blaze.txt
Finally, you can build the C extensions by running: 最后,您可以运行以下命令来构建C扩展:
$ python setup.py build_ext --inplace
To finish, make sure tests pass. 要完成,请确保测试通过。
If you get an error running nosetests after setting up a fresh virtualenv, please try running 如果您在设置新的virtualenv后出现运行nosetests的错误,请尝试运行
# where zipline is the name of your virtualenv $ deactivate zipline $ workon zipline
Development with Docker 使用Docker进行开发
If you want to work with zipline using a Docker container, you’ll need to build the Dockerfile
in the Zipline root directory, and then build Dockerfile-dev
. Instructions for building both containers can be found in Dockerfile
and Dockerfile-dev
, respectively.
如果您想使用Docker容器来处理zipline,则需要在Zipline根目录中构建Dockerfile,然后构建Dockerfile-dev。 构建两个容器的指令可分别在Dockerfile和Dockerfile-dev中找到。
Style Guide & Running Tests 风格指南和运行测试
We use flake8 for checking style requirements and nosetests to run Zipline tests. Our continuous integration tools will run these commands.
我们使用flake8来检查样式要求和nosetests来运行Zipline测试。 我们的持续集成工具将运行这些命令。
Before submitting patches or pull requests, please ensure that your changes pass when running:
在提交补丁或拉取请求之前,请确保您的更改在运行时通过:
$ flake8 zipline tests
In order to run tests locally, you’ll need TA-lib, which you can install on Linux by running:
为了在本地运行测试,您需要TA-lib,您可以通过运行以下命令在Linux上进行安装:
$ wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz $ -src.tar.gz $ cd ta-lib/ $ ./configure --prefix=/usr $ make $ sudo make install
And for TA-lib
on OS X you can just run:
而对于OS X上的TA-lib,你可以运行:
$ brew install ta-lib
Then run pip install
TA-lib:
然后运行pip install TA-lib:
$ pip install -r ./etc/requirements_talib.txt
You should now be free to run tests:
您现在应该可以自由运行测试:
$ nosetests
Continuous Integration 持续集成
We use Travis CI for Linux-64 bit builds and AppVeyor for Windows-64 bit builds.
我们使用Travis CI进行Linux-64位构建,使用AppVeyor进行Windows-64位构建。
Note
We do not currently have CI for OSX-64 bit builds. 32-bit builds may work but are not included in our integration tests.
我们目前没有用于OSX-64位构建的CI。 32位构建可能可行,但不包括在我们的集成测试中。
Packaging 打包
To learn about how we build Zipline conda packages, you can read this section in our release process notes.
要了解我们如何构建Zipline conda软件包,可以在我们的发布流程说明中阅读本节。
Contributing to the Docs 为文档做出贡献
If you’d like to contribute to the documentation on zipline.io, you can navigate to docs/source/
where each reStructuredText (.rst
) file is a separate section there. To add a section, create a new file called some-descriptive-name.rst
and add some-descriptive-name
to appendix.rst
. To edit a section, simply open up one of the existing files, make your changes, and save them.
如果您想对zipline.io文档作出贡献,您可以导航到docs/source/,其中每个reStructuredText(.rst)文件都是一个单独的部分。 要添加节,请创建一个名为some-descriptive-name.rst的新文件,并向appendix.rst中添加一些描述性名称。 要编辑节,只需打开一个现有文件,进行更改并保存。
We use Sphinx to generate documentation for Zipline, which you will need to install by running:
我们使用Sphinx为Zipline生成文档,您需要通过运行来安装它:
$ pip install -r ./etc/requirements_docs.txt
To build and view the docs locally, run: 要在本地构建和查看文档,请运行:
# assuming you're in the Zipline root directory $ cd docs $ make html $ {BROWSER} build/html/index.html
Commit messages 提交消息
Standard prefixes to start a commit message: 用于启动提交消息的标准前缀:
BLD: change related to building Zipline BUG: bug fix DEP: deprecate something, or remove a deprecated object DEV: development tool or utility DOC: documentation ENH: enhancement MAINT: maintenance commit (refactoring, typos, etc) REV: revert an earlier commit STY: style fix (whitespace, PEP8, flake8, etc) TST: addition or modification of tests REL: related to releasing Zipline PERF: performance enhancements
Some commit style guidelines: 一些提交样式准则:
Commit lines should be no longer than 72 characters. The first line of the commit should include one of the above prefixes. There should be an empty line between the commit subject and the body of the commit. In general, the message should be in the imperative tense. Best practice is to include not only what the change is, but why the change was made.
提交行不应超过72个字符。 提交的第一行应包含上述前缀之一。 提交主题和提交主体之间应该有一条空行。 一般来说,信息应该是必要时。 最佳做法不仅包括变化是什么,而且包括变更的原因。
Example:
MAINT: Remove unused calculations of max_leverage, et al. In the performance period the max_leverage, max_capital_used, cumulative_capital_used were calculated but not used. At least one of those calculations, max_leverage, was causing a divide by zero error. Instead of papering over that error, the entire calculation was a bit suspect so removing, with possibility of adding it back in later with handling the case (or raising appropriate errors) when the algorithm has little cash on hand.
Formatting Docstrings 格式化Docstrings
When adding or editing docstrings for classes, functions, etc, we use numpy as the canonical reference. 当为类,函数等添加或编辑文档字符串时,我们使用numpy作为规范引用。
Updating the Whatsnew
We have a set of whatsnew files that are used for documenting changes that have occurred between different versions of Zipline. Once you’ve made a change to Zipline, in your Pull Request, please update the most recent whatsnew
file with a comment about what you changed. You can find examples in previous whatsnew
files.
我们有一组whatsnew文件,用于记录不同版本的Zipline之间发生的变化。 一旦您对Zipline进行了更改,请在您的合并请求中更新最新的whatsnew文件,并附带有关您更改内容的评论。 您可以在以前的whatsnew文件中找到示例。
Zipline Development Guidelines的更多相关文章
- zipline框架--简介
Zipline is a Pythonic algorithmic trading library. It is an event-driven system for backtesting. Zip ...
- zipline-- 开发指南
Development Guidelines开发指南This page is intended for developers of Zipline, people who want to contri ...
- ROS语音交互——科大讯飞语音合成TTS(二)
之前我用过科大讯飞的语音包,为了记录一下我重新使用一下 首先注册科大讯飞账号及应用,以后每个下载的在线使用SDK都是以此账户ID登录讯飞语音服务器. 下载科大讯飞在线合成包. $ unzip Linu ...
- Cheatsheet: 2013 08.14 ~ 08.19
.NET Lucene.Net ultra fast search for MVC or WebForms site => made easy! C# State Machines HttpCl ...
- WordPress 主题开发 - (三) 开发工具 待翻译
Before we get started building any WordPress Theme, we’re going to need to get our development tools ...
- Nagios+InfluxDB+Grafana
1. 概述 Nagios负责收集数据,是一款开源的免费网络监视工具. influxDB负责存储数据,是一个开源的时间序列数据库.比较适合存储监控或者部署记录这些时序数据. Grafana负责数据的图形 ...
- In-App Purchase Configuration Guide for iTunes Connect---(一)----Introduction
Introduction In-App Purchase is an Apple technology that allows your users to purchase content and s ...
- 转 oracle healthcheck
##sample 0 https://carlos-sierra.net/2013/11/01/a-healthy-way-to-do-an-oracle-database-health-check/ ...
- Test Design Guidelines for Reusability
Last Updated: JAN.10.2008 From: http://safsdev.sourceforge.net/sqabasic2000/TestDesignGuidelines.htm ...
随机推荐
- FreeRTOS 临界段和开关中断
以下转载自安富莱电子: http://forum.armfly.com/forum.php 临界段代码的临界段也称为临界区,一旦这部分代码开始执行,则不允许任何中断打断.为确保临界段代码的执行不被中断 ...
- GPIO输出—使用固件库点亮LED
为了使工程更加有条理,我们把 LED 灯控制相关的代码独立分开存储,方便以后移植.在“工程模板”之上新建“ bsp_led.c”及“ bsp_led.h”文件,其中的“ bsp”即 BoardSupp ...
- Python操作Word【批量生成文章】
http://www.cnblogs.com/codex/p/4668396.html 需要做一些会议记录.总共有多少呢?五个地点x7个月份x每月4篇=140篇.虽然不很重要,但是140篇记录完全雷同 ...
- 使用submit异步提交,阻止表单默认提交
<form id="addForm" onSubmit="return false;"> <input type="submit&q ...
- 关于Unity中的几何体,材质和FBX模型
一.创建几何体的类型 1: 创建平面 Plane;2: 创建立方体 Cube;3: 创建球体 Sphere;4: 创建胶囊体 Capsule;5: 创建圆柱体 Cylinder;6: 3D文字 3D ...
- CSS3文字立体效果
<!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8& ...
- IPL和SPL的区别
IPL是英文Initial Program Loader的简称,意为初始程序的装入程序,其主要功能为负责主板.电源.硬件初始化程序.并把SPL装入RAM空间中,当IPL损坏则只能更换字库解决否则只能换 ...
- iOS自动化测试需求实现(iOS按键精灵类似)
需求分析: 作为以需求为驱动的IT公司,有再奇怪的需求都不奇怪,所以“24小时循测第三方应用”这样的需求也可以接受.业务需求重点为: 1.24小时循测 2.无人值守,自动完成 3.自动界面操作(点击. ...
- 我的Android进阶之旅------>MIME类型大全
今天在实现一个安装apk的代码中看到一段代码为:application/vnd.android.package-archive.不知其意.所以百度了一下,了解到这是一种MIME的类型,代表apk类型. ...
- UVA 548(二叉树重建与遍历)
J - Tree Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Ap ...