-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
399 changed files
with
79,323 additions
and
747 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,10 @@ dist | |
*.local | ||
|
||
# vn.py | ||
.vntrader | ||
.vntrader | ||
|
||
# Visual Studio intermediate files | ||
*.exp | ||
*.iobj | ||
*.ipdb | ||
*.pdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,26 @@ language: python | |
|
||
dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069) | ||
|
||
cache: pip | ||
|
||
git: | ||
depth: 1 | ||
|
||
python: | ||
- "3.7" | ||
|
||
services: | ||
- mongodb | ||
- mysql | ||
- postgresql | ||
|
||
before_script: | ||
- psql -d postgresql://postgres:${VNPY_TEST_POSTGRESQL_PASSWORD}@localhost -c "create database vnpy;" | ||
- mysql -u root --password=${VNPY_TEST_MYSQL_PASSWORD} -e 'CREATE DATABASE vnpy;' | ||
|
||
script: | ||
# todo: use python unittest | ||
- mkdir run; cd run; python ../tests/load_all.py | ||
- cd tests; source travis_env.sh; | ||
- python test_all.py | ||
|
||
matrix: | ||
include: | ||
|
@@ -19,81 +33,36 @@ matrix: | |
script: | ||
- flake8 | ||
|
||
- name: "pip install under Windows" | ||
os: "windows" | ||
# language : cpp is necessary for windows | ||
language: "cpp" | ||
env: | ||
- PATH=/c/Python37:/c/Python37/Scripts:$PATH | ||
before_install: | ||
- choco install python3 --version 3.7.2 | ||
install: | ||
- python -m pip install --upgrade pip wheel setuptools | ||
- pip install https://pip.vnpy.com/colletion/TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl | ||
- pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl | ||
- pip install -r requirements.txt | ||
- pip install . | ||
|
||
- name: "pip install under Ubuntu: gcc-8" | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- g++-8 | ||
before_install: | ||
# C++17 | ||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test | ||
- sudo apt-get update -y | ||
install: | ||
# C++17 | ||
- sudo apt-get install -y gcc-8 g++-8 | ||
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90 | ||
- sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-8 90 | ||
- sudo update-alternatives --install /usr/bin/gcc cc /usr/bin/gcc-8 90 | ||
install: | ||
# update pip & setuptools | ||
- python -m pip install --upgrade pip wheel setuptools | ||
# Linux install script | ||
- pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl | ||
- bash ./install.sh | ||
|
||
- name: "pip install under Ubuntu: gcc-7" | ||
- name: "sdist install under Ubuntu: gcc-7" | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- g++-7 | ||
before_install: | ||
# C++17 | ||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test | ||
- sudo apt-get update -y | ||
install: | ||
# C++17 | ||
- sudo apt-get install -y gcc-7 g++-7 | ||
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 90 | ||
- sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-7 90 | ||
- sudo update-alternatives --install /usr/bin/gcc cc /usr/bin/gcc-7 90 | ||
# update pip & setuptools | ||
- python -m pip install --upgrade pip wheel setuptools | ||
# Linux install script | ||
- pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl | ||
- bash ./install.sh | ||
|
||
- name: "sdist install under Windows" | ||
os: "windows" | ||
# language : cpp is necessary for windows | ||
language: "cpp" | ||
env: | ||
- PATH=/c/Python37:/c/Python37/Scripts:$PATH | ||
before_install: | ||
- choco install python3 --version 3.7.2 | ||
install: | ||
- python -m pip install --upgrade pip wheel setuptools | ||
- python setup.py sdist | ||
- pip install https://pip.vnpy.com/colletion/TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl | ||
- pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl | ||
- pip install dist/`ls dist` | ||
|
||
- name: "sdist install under Ubuntu: gcc-8" | ||
before_install: | ||
# C++17 | ||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test | ||
- sudo apt-get update -y | ||
install: | ||
# C++17 | ||
- sudo apt-get install -y gcc-8 g++-8 | ||
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90 | ||
- sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-8 90 | ||
- sudo update-alternatives --install /usr/bin/gcc cc /usr/bin/gcc-8 90 | ||
# Linux install script | ||
- python -m pip install --upgrade pip wheel setuptools | ||
- pushd /tmp | ||
|
@@ -105,6 +74,20 @@ matrix: | |
- sudo make install | ||
- popd | ||
- pip install numpy | ||
- pip install --pre --extra-index-url https://rquser:[email protected]/simple/ rqdatac | ||
- pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl | ||
- python setup.py sdist | ||
- pip install dist/`ls dist` | ||
|
||
- name: "pip install under osx" | ||
os: osx | ||
language: shell # osx supports only shell | ||
services: [] | ||
before_install: [] | ||
install: | ||
- pip3 install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl | ||
- bash ./install_osx.sh | ||
before_script: [] | ||
script: | ||
- cd tests; source travis_env.sh; | ||
- VNPY_TEST_ONLY_SQLITE=1 python3 test_all.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
clone_depth: 1 | ||
|
||
cache: | ||
- '%LOCALAPPDATA%\pip\Cache' | ||
|
||
configuration: | ||
- pip | ||
- sdist | ||
|
||
image: | ||
- Visual Studio 2017 | ||
|
||
services: | ||
- mysql | ||
- mongodb | ||
- postgresql | ||
|
||
environment: | ||
PATH: C:\Python37-x64;C:\Python37-x64\Scripts;C:\Program Files\PostgreSQL\9.6\bin\;%PATH% | ||
VNPY_TEST_MYSQL_DATABASE: vnpy | ||
VNPY_TEST_MYSQL_HOST: localhost | ||
VNPY_TEST_MYSQL_PORT: 3306 | ||
VNPY_TEST_MYSQL_USER: root | ||
VNPY_TEST_MYSQL_PASSWORD: Password12! | ||
|
||
VNPY_TEST_POSTGRESQL_DATABASE: vnpy | ||
VNPY_TEST_POSTGRESQL_HOST: localhost | ||
VNPY_TEST_POSTGRESQL_PORT: 5432 | ||
VNPY_TEST_POSTGRESQL_USER: postgres | ||
VNPY_TEST_POSTGRESQL_PASSWORD: Password12! | ||
|
||
VNPY_TEST_MONGODB_DATABASE: vnpy | ||
VNPY_TEST_MONGODB_HOST: localhost | ||
VNPY_TEST_MONGODB_PORT: 27017 | ||
|
||
MYSQL_PWD: Password12! | ||
|
||
install: | ||
- python -m pip install --upgrade pip wheel setuptools | ||
before_build: | ||
- ps: psql -d "postgresql://${ENV:VNPY_TEST_POSTGRESQL_USER}:${ENV:VNPY_TEST_POSTGRESQL_PASSWORD}@localhost" -c "create database vnpy;" | ||
- ps: . "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql" -u $ENV:VNPY_TEST_MYSQL_USER -e 'CREATE DATABASE vnpy;' | ||
|
||
for: | ||
- matrix: | ||
only: | ||
- configuration: pip | ||
build_script: | ||
- call install.bat | ||
|
||
- matrix: | ||
only: | ||
- configuration: sdist | ||
build_script: | ||
- python setup.py sdist | ||
- pip install --pre --extra-index-url https://rquser:[email protected]/simple/ rqdatac | ||
- pip install https://pip.vnpy.com/colletion/TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl | ||
- pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl | ||
- ps: $name=(ls dist).name; pip install "dist/$name" | ||
|
||
test_script: | ||
- cd tests | ||
- python test_all.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,74 @@ | ||
# 代码贡献说明 | ||
# 贡献代码 | ||
|
||
## Linter智能提示 | ||
--- | ||
## 创建PR | ||
我们欢迎任何人贡献代码到vn.py。 | ||
如果希望贡献代码请使用github的PR(Pull Request)的流程。 | ||
|
||
PR流程大致如下: | ||
|
||
## 代码检查 | ||
--- | ||
1. [创建 Issue][CreateIssue] - 对于较大的改动(如新功能,大型重构等)最好先开issue讨论一下, 较小的improvement(如文档改进,bugfix等)直接发PR即可 | ||
|
||
2. Fork [vn.py][#GithubVnpy] - 点击右上角**Fork**按钮 | ||
|
||
## 持续集成 | ||
3. Clone你自己的fork: ```git clone https://github.com/$userid/vnpy.git``` | ||
> 如果你的fork已经过时,需要手动[sync][GithubDocForSync] | ||
|
||
4. 从**dev**创建你自己的branch: ```git checkout -b $my_feature_branch dev``` | ||
|
||
5. 在$my_feature_branch上修改并将修改push到你Fork之后的仓库上 | ||
|
||
6. 创建从你的fork的$my_feature_branch分支到主项目的**dev**分支的[Pull Request]: | ||
[点开这里][CreatePR] ,再点击**compare across forks**,选择需要的fork和branch创建PR | ||
|
||
--- | ||
|
||
创建完PR之后请耐心等待:我们一旦有空就会检查PR,一旦你的代码有用且[符合要求](#代码风格),就会被合并! | ||
|
||
|
||
--- | ||
## 代码风格 | ||
在为vn.py写代码的时候,需要遵循一些基本的规则,否则你的代码可能无法被merge。 | ||
这些规则包括: | ||
1. [命名规则](#命名规则) | ||
2. [代码格式](#代码格式) | ||
3. [代码质量检查](#代码质量检查) | ||
|
||
|
||
### 命名规则 | ||
我们的代码的命名规则如下: | ||
|
||
* 类属性、类方法、参数和变量使用小写加下划线的形式 | ||
* 类名使用驼峰式命名 | ||
* 常量使用大写加下划线的形式 | ||
|
||
例如: | ||
```python | ||
DEFAULT_PATH = "/tmp/vn.py/" | ||
class ClassA: | ||
def __init__(self, arg_one: int, arg_two: str): | ||
if arg_two is None: | ||
arg_two = DEFAULT_PATH | ||
self.property_one = arg_one | ||
variable_one = "some string" | ||
``` | ||
|
||
|
||
### 代码格式 | ||
我们对代码格式没有特别严格的要求,但是至少要符合pep8标准,并且额外要在类和所有函数下面带上docstring(就是一段"""""")。 | ||
|
||
要让代码符合pep8标准,写完代码之后使用[autopep8](https://github.com/hhatto/autopep8)格式化你的代码就可以了: | ||
```bash | ||
autopep8 --in-place --recursive . | ||
``` | ||
|
||
### 代码质量检查 | ||
使用[flake8](https://pypi.org/project/flake8/)检查你的代码,确保没有error和warning。 | ||
在项目根目录下运行```flake8```就可以检查出代码中书写不严谨的地方了。如果检查出error或者warning,说明你的代码需要进行一些修改以提升质量。 | ||
|
||
[GithubVnpy]:https://github.com/vnpy/vnpy | ||
[GithubDocForSync]:https://help.github.com/articles/syncing-a-fork/ | ||
[CreateIssue]:https://github.com/vnpy/vnpy/issues/new | ||
[CreatePR]:https://github.com/vnpy/vnpy/compare?expand=1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
python=$1 | ||
pip=$2 | ||
prefix=$3 | ||
|
||
[[ -z $python ]] && python=python | ||
[[ -z $pip ]] && pip=pip | ||
[[ -z $prefix ]] && prefix=/usr | ||
|
||
# Get and build ta-lib | ||
pushd /tmp | ||
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz | ||
tar -xf ta-lib-0.4.0-src.tar.gz | ||
cd ta-lib | ||
./configure --prefix=/usr | ||
make | ||
./configure --prefix=$prefix | ||
make -j | ||
sudo make install | ||
popd | ||
|
||
# old versions of ta-lib imports numpy in setup.py | ||
pip install numpy | ||
$pip install numpy | ||
|
||
# Install extra packages | ||
pip install ta-lib | ||
pip install https://vnpy-pip.oss-cn-shanghai.aliyuncs.com/colletion/ibapi-9.75.1-py3-none-any.whl | ||
$pip install --pre --extra-index-url https://rquser:[email protected]/simple/ rqdatac | ||
$pip install ta-lib | ||
$pip install https://vnpy-pip.oss-cn-shanghai.aliyuncs.com/colletion/ibapi-9.75.1-py3-none-any.whl | ||
|
||
# Install Python Modules | ||
pip install -r requirements.txt | ||
$pip install -r requirements.txt | ||
|
||
# Install local Chinese language environment | ||
sudo locale-gen zh_CN.GB18030 | ||
|
||
# Install vn.py | ||
pip install . | ||
$pip install . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
bash ./install.sh python3 pip3 /usr/local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.