commit
222475fdf9
142
.gitlab-ci.yml
142
.gitlab-ci.yml
@ -1,142 +0,0 @@
|
||||
# This file is a template, and might need editing before it works on your project.
|
||||
# Official language image. Look for the different tagged releases at:
|
||||
# https://hub.docker.com/r/library/python/tags/
|
||||
image: registry.cn-shanghai.aliyuncs.com/vnpy-ci/gcc-7-python-3.7:latest
|
||||
|
||||
.services:
|
||||
services: &services
|
||||
- postgres:latest
|
||||
- mysql:latest
|
||||
- mongo:latest
|
||||
|
||||
# Change pip's cache directory to be inside the project directory since we can
|
||||
# only cache local items.
|
||||
variables: &variables
|
||||
GIT_DEPTH: "1"
|
||||
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
||||
POSTGRES_DB: &db_name "vnpy"
|
||||
POSTGRES_USER: "postgres"
|
||||
POSTGRES_PASSWORD: &db_password "1234"
|
||||
VNPY_TEST_POSTGRESQL_PASSWORD: *db_password
|
||||
MYSQL_DATABASE: *db_name
|
||||
MYSQL_ROOT_PASSWORD: *db_password
|
||||
VNPY_TEST_MYSQL_PASSWORD: *db_password
|
||||
VNPY_BUILD_PARALLEL: "auto"
|
||||
|
||||
# Pip's cache doesn't store the python packages
|
||||
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
|
||||
#
|
||||
# If you want to also cache the installed packages, you have to install
|
||||
# them in a virtualenv and cache it as well.
|
||||
.default_cache:
|
||||
cache:
|
||||
<<: &cache
|
||||
key: "pip_and_venv"
|
||||
untracked: false
|
||||
policy: pull
|
||||
paths:
|
||||
- .cache/pip
|
||||
- venv/
|
||||
|
||||
|
||||
|
||||
before_script:
|
||||
- echo $PWD
|
||||
- python -V
|
||||
- gcc --version
|
||||
- free
|
||||
- date
|
||||
|
||||
# venv
|
||||
- pip install virtualenv
|
||||
- virtualenv venv
|
||||
- source venv/bin/activate
|
||||
|
||||
# some envs
|
||||
- source ci/env.sh
|
||||
|
||||
.scripts:
|
||||
script:
|
||||
- &install_scripts |
|
||||
date
|
||||
python -m pip --version
|
||||
python -m pip install --upgrade pip wheel setuptools
|
||||
python -m pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl
|
||||
bash ci/gitlab_pre_install.sh
|
||||
|
||||
date
|
||||
bash ./install.sh
|
||||
date
|
||||
|
||||
- &test_scripts |
|
||||
date
|
||||
cd tests
|
||||
python test_all.py
|
||||
date
|
||||
##################################
|
||||
# stages
|
||||
|
||||
stages: # I use anchors for IDE hints only
|
||||
- &single_module single_module
|
||||
- &build_all build_all
|
||||
|
||||
|
||||
###########################################
|
||||
## jobs:
|
||||
flake8:
|
||||
stage: *single_module
|
||||
image: python:3.7
|
||||
cache:
|
||||
key: 'flake8'
|
||||
paths:
|
||||
- .cache/pip
|
||||
- venv/
|
||||
script:
|
||||
- pip install flake8
|
||||
- flake8
|
||||
|
||||
ctp:
|
||||
<<: &test_single_module
|
||||
stage: *single_module
|
||||
image: registry.cn-shanghai.aliyuncs.com/vnpy-ci/gcc-8-python-3.7:latest
|
||||
services: *services
|
||||
cache:
|
||||
<<: *cache
|
||||
script:
|
||||
- *install_scripts
|
||||
- *test_scripts
|
||||
variables:
|
||||
<<: *variables
|
||||
VNPY_BUILD_CTP: 1
|
||||
|
||||
oes:
|
||||
<<: *test_single_module
|
||||
variables:
|
||||
<<: *variables
|
||||
VNPY_BUILD_OES: 1
|
||||
|
||||
no_building:
|
||||
<<: *test_single_module
|
||||
cache:
|
||||
<<: *cache
|
||||
policy: pull-push
|
||||
variables:
|
||||
<<: *variables
|
||||
VNPY_BUILD_OES: 0
|
||||
VNPY_BUILD_CTP: 0
|
||||
|
||||
build-all-gcc8:
|
||||
stage: *build_all
|
||||
variables:
|
||||
<<: *variables
|
||||
image: registry.cn-shanghai.aliyuncs.com/vnpy-ci/gcc-8-python-3.7:latest
|
||||
services: *services
|
||||
cache:
|
||||
key: "build-all"
|
||||
paths: []
|
||||
script:
|
||||
- unset VNPY_BUILD_CTP
|
||||
- unset VNPY_BUILD_OES
|
||||
- *install_scripts
|
||||
- *test_scripts
|
||||
|
101
.travis.yml
101
.travis.yml
@ -1,101 +0,0 @@
|
||||
language: python
|
||||
|
||||
dist: xenial # required for Python >= 3.7 (travis-ci/travis-ci#9069)
|
||||
|
||||
cache: pip
|
||||
|
||||
git:
|
||||
depth: 1
|
||||
|
||||
env:
|
||||
- >
|
||||
VNPY_BUILD_PARALLEL=1
|
||||
VNPY_BUILD_CTP=1
|
||||
VNPY_BUILD_OES=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;'
|
||||
- source ci/env.sh;
|
||||
|
||||
script:
|
||||
- cd tests;
|
||||
- python test_all.py
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- name: "code quality analysis: flake8"
|
||||
before_install:
|
||||
- python -m pip install flake8
|
||||
install:
|
||||
- "" # prevent running "pip install -r requirements.txt"
|
||||
script:
|
||||
- flake8
|
||||
|
||||
- name: "pip install under Ubuntu: gcc-8"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-8
|
||||
before_install:
|
||||
- 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
|
||||
- python -m pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl
|
||||
- bash ./install.sh
|
||||
|
||||
- name: "sdist install under Ubuntu: gcc-7"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-7
|
||||
before_install:
|
||||
- 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
|
||||
install:
|
||||
# Linux install script
|
||||
- python -m pip install --upgrade pip wheel setuptools
|
||||
- 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 # -j under gcc-7 failed!!?
|
||||
- sudo make install
|
||||
- popd
|
||||
- python -m pip install numpy
|
||||
- python -m pip install --pre --extra-index-url https://rquser:ricequant99@py.ricequant.com/simple/ rqdatac
|
||||
- python -m pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl
|
||||
- python setup.py sdist
|
||||
- python -m pip install dist/`ls dist`
|
||||
|
||||
- name: "pip install under osx"
|
||||
os: osx
|
||||
language: shell # osx supports only shell
|
||||
services: []
|
||||
before_install: []
|
||||
install:
|
||||
- python3 -m pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl
|
||||
- bash ./install_osx.sh
|
||||
before_script: []
|
||||
script:
|
||||
- source ci/env.sh;
|
||||
- cd tests;
|
||||
- VNPY_TEST_ONLY_SQLITE=1 python3 test_all.py
|
@ -122,7 +122,7 @@ vn.py是一套基于Python的开源量化交易系统开发框架,于2015年1
|
||||
|
||||
## 环境准备
|
||||
|
||||
* 推荐使用vn.py团队为量化交易专门打造的Python发行版[VNStudio-2.0.6](https://download.vnpy.com/vnstudio-2.0.6.exe),内置了最新版的vn.py框架以及VN Station量化管理平台,无需手动安装
|
||||
* 推荐使用vn.py团队为量化交易专门打造的Python发行版[VNStudio-2.0.7](https://download.vnpy.com/vnstudio-2.0.7.exe),内置了最新版的vn.py框架以及VN Station量化管理平台,无需手动安装
|
||||
* 支持的系统版本:Windows 7以上/Windows Server 2008以上/Ubuntu 18.04 LTS
|
||||
* 支持的Python版本:Python 3.7 64位(**注意必须是Python 3.7 64位版本**)
|
||||
|
||||
|
@ -19,3 +19,4 @@ ta-lib
|
||||
ibapi
|
||||
deap
|
||||
pyzmq
|
||||
wmi
|
@ -221,11 +221,12 @@ class SpreadDataEngine:
|
||||
|
||||
# Subscribe market data
|
||||
contract = self.main_engine.get_contract(vt_symbol)
|
||||
req = SubscribeRequest(
|
||||
contract.symbol,
|
||||
contract.exchange
|
||||
)
|
||||
self.main_engine.subscribe(req, contract.gateway_name)
|
||||
if contract:
|
||||
req = SubscribeRequest(
|
||||
contract.symbol,
|
||||
contract.exchange
|
||||
)
|
||||
self.main_engine.subscribe(req, contract.gateway_name)
|
||||
|
||||
return leg
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
from zmq.backend.cython.constants import NOBLOCK
|
||||
import signal
|
||||
import threading
|
||||
import traceback
|
||||
@ -7,10 +8,11 @@ from typing import Any, Callable
|
||||
|
||||
import zmq
|
||||
|
||||
_ = lambda x: x
|
||||
|
||||
def _(x): return x
|
||||
|
||||
# Achieve Ctrl-c interrupt recv
|
||||
from zmq.backend.cython.constants import NOBLOCK
|
||||
|
||||
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
|
||||
@ -100,7 +102,7 @@ class RpcServer:
|
||||
|
||||
def join(self):
|
||||
# Wait for RpcServer thread to exit
|
||||
if self.__thread.isAlive():
|
||||
if self.__thread and self.__thread.is_alive():
|
||||
self.__thread.join()
|
||||
self.__thread = None
|
||||
|
||||
@ -237,7 +239,7 @@ class RpcClient:
|
||||
|
||||
def join(self):
|
||||
# Wait for RpcClient thread to exit
|
||||
if self.__thread.isAlive():
|
||||
if self.__thread and self.__thread.is_alive():
|
||||
self.__thread.join()
|
||||
self.__thread = None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user