日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Zipline Development Guidelines

發(fā)布時間:2025/5/22 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Zipline Development Guidelines 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

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的開發(fā)人員,希望為Zipline代碼庫或文檔作出貢獻(xiàn)的人員,或希望從源代碼進(jìn)行安裝并對其Zipline副本進(jìn)行本地更改的人員。

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.

所有貢獻(xiàn),錯誤報告,錯誤修復(fù),文檔改進(jìn),增強功能和創(chuàng)意都受到歡迎。 我們在GitHub上跟蹤問題,并且還有一個郵件列表,您可以在其中提問。

Creating a Development Environment 創(chuàng)建開發(fā)環(huán)境

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: 然后簽出一個新的分支,您可以在其中進(jìn)行更改:

$ 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庫依賴。 您可以按照安裝指南獲取適當(dāng)?shù)囊蕾囮P(guān)系。

The following section assumes you already have virtualenvwrapper and pip installed on your system. Suggested installation of Python library dependencies used for development:

以下部分假定您已經(jīng)在系統(tǒng)上安裝了virtualenvwrapper和pip。 建議安裝用于開發(fā)的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: 最后,您可以運行以下命令來構(gòu)建C擴(kuò)展:

$ 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 如果您在設(shè)置新的virtualenv后出現(xiàn)運行nosetests的錯誤,請嘗試運行

# where zipline is the name of your virtualenv $ deactivate zipline $ workon zipline

?

Development with Docker 使用Docker進(jìn)行開發(fā)

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根目錄中構(gòu)建Dockerfile,然后構(gòu)建Dockerfile-dev。 構(gòu)建兩個容器的指令可分別在Dockerfile和Dockerfile-dev中找到。

Style Guide & Running Tests 風(fēng)格指南和運行測試

We use flake8 for checking style requirements and nosetests to run Zipline tests. Our continuous integration tools will run these commands.

我們使用flake8來檢查樣式要求和nosetests來運行Zipline測試。 我們的持續(xù)集成工具將運行這些命令。

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上進(jìn)行安裝:

$ wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz $ tar -xvzf ta-lib-0.4.0-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:

您現(xiàn)在應(yīng)該可以自由運行測試:

$ nosetests

?

Continuous Integration 持續(xù)集成

We use Travis CI for Linux-64 bit builds and AppVeyor for Windows-64 bit builds.

我們使用Travis CI進(jìn)行Linux-64位構(gòu)建,使用AppVeyor進(jìn)行Windows-64位構(gòu)建。

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位構(gòu)建的CI。 32位構(gòu)建可能可行,但不包括在我們的集成測試中。

Packaging 打包

To learn about how we build Zipline conda packages, you can read this section in our release process notes.

要了解我們?nèi)绾螛?gòu)建Zipline conda軟件包,可以在我們的發(fā)布流程說明中閱讀本節(jié)。

Contributing to the Docs 為文檔做出貢獻(xiàn)

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文檔作出貢獻(xiàn),您可以導(dǎo)航到docs/source/,其中每個reStructuredText(.rst)文件都是一個單獨的部分。 要添加節(jié),請創(chuàng)建一個名為some-descriptive-name.rst的新文件,并向appendix.rst中添加一些描述性名稱。 要編輯節(jié),只需打開一個現(xiàn)有文件,進(jìn)行更改并保存。

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: 要在本地構(gòu)建和查看文檔,請運行:

# 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: 用于啟動提交消息的標(biāo)準(zhǔn)前綴:

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: 一些提交樣式準(zhǔn)則:

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.

提交行不應(yīng)超過72個字符。 提交的第一行應(yīng)包含上述前綴之一。 提交主題和提交主體之間應(yīng)該有一條空行。 一般來說,信息應(yīng)該是必要時。 最佳做法不僅包括變化是什么,而且包括變更的原因。

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. 當(dāng)為類,函數(shù)等添加或編輯文檔字符串時,我們使用numpy作為規(guī)范引用。

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之間發(fā)生的變化。 一旦您對Zipline進(jìn)行了更改,請在您的合并請求中更新最新的whatsnew文件,并附帶有關(guān)您更改內(nèi)容的評論。 您可以在以前的whatsnew文件中找到示例。

轉(zhuǎn)載于:https://www.cnblogs.com/fangbei/p/9077987.html

總結(jié)

以上是生活随笔為你收集整理的Zipline Development Guidelines的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。