From 61e526fdd14e893e32548d927d68e23f3f946e23 Mon Sep 17 00:00:00 2001 From: nanoric Date: Wed, 15 May 2019 12:25:07 +0800 Subject: [PATCH 1/8] [Add] requirements.txt add EOF blank line --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8eaa8cf4..329526e3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,4 +17,4 @@ tigeropen rqdatac ta-lib ibapi -deap \ No newline at end of file +deap From 3cf04bcca9d3184fabaa9e4e317d5330da2744be Mon Sep 17 00:00:00 2001 From: 1122455801 Date: Wed, 15 May 2019 13:33:39 +0800 Subject: [PATCH 2/8] Update index.md --- docs/index.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/index.md b/docs/index.md index 408c479f..664538a9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -6,6 +6,7 @@ * [安装指南](install.md) * [Windows](install.md#Windows) * [使用VNConda](install.md#使用VNConda) + * [下载VNConda]() * [手动安装](install.md#手动安装) * [Ubuntu](install.md#Ubuntu) @@ -43,6 +44,17 @@ * [穷举算法](cta_backtester.md#穷举算法) * [遗传算法](cta_backtester.md#遗传算法) +* [行情记录](datarecoder.md) + * [加载启动](datarecoder.md#加载启动) + * [开始收录](datarecoder.md#开始收录) + * [订阅行情](datarecoder.md#订阅行情) + * [将订阅信息保存到json文件](datarecoder.md#将订阅信息保存到json文件) + * [推送行情记录事件](datarecoder.md#推送行情记录事件) + * [注册行情记录事件](datarecoder.md#注册行情记录事件) + * [执行记录行情任务](datarecoder.md#执行记录行情任务) + * [移除记录](datarecoder.md#移除记录) + * [停止记录](datarecoder.md#停止记录) + * [交易接口](gateway.md) * [如何连接](gateway.md#如何连接) From 06a52b734a560749e44031888b9853b459b69ac1 Mon Sep 17 00:00:00 2001 From: 1122455801 Date: Wed, 15 May 2019 13:33:45 +0800 Subject: [PATCH 3/8] Update datarecoder.md --- docs/datarecoder.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/datarecoder.md b/docs/datarecoder.md index f417bd00..8c3bc076 100644 --- a/docs/datarecoder.md +++ b/docs/datarecoder.md @@ -231,6 +231,10 @@ register_event()函数分别注册2种事件:EVENT_CONTRACT、EVENT_TICK ## 移除记录 +移除记录操作:输入需要移除合约品种的本地代码,如rb1905.SHFE。该本地代码必须在“Tick记录列表” 或者“K线记录列表”中。若要移除Tick记录,只需在”Tick记录“那一栏上点击”移除“按钮即可。 + +下面展示代码运作原理: + - 从tick_recordings字典移除vt_symbol - 调用save_setting()函数保存json配置文件 - 推送最新的tick_recordings字典来继续记录行情,原来移除合约品种不再记录。 @@ -252,6 +256,8 @@ register_event()函数分别注册2种事件:EVENT_CONTRACT、EVENT_TICK ## 停止记录 +停止记录操作:只需手动关闭行情记录模块窗口就停止记录行情。 + - 记录行情状态改为False, 停止while循环; - 调用join()函数关掉线程。 From 7f1392ee241a38387fc7df8fb08e4484859454e4 Mon Sep 17 00:00:00 2001 From: 1122455801 Date: Wed, 15 May 2019 13:41:00 +0800 Subject: [PATCH 4/8] Update index.md --- docs/index.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/index.md b/docs/index.md index 664538a9..86f7512f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -6,7 +6,6 @@ * [安装指南](install.md) * [Windows](install.md#Windows) * [使用VNConda](install.md#使用VNConda) - * [下载VNConda]() * [手动安装](install.md#手动安装) * [Ubuntu](install.md#Ubuntu) @@ -47,11 +46,6 @@ * [行情记录](datarecoder.md) * [加载启动](datarecoder.md#加载启动) * [开始收录](datarecoder.md#开始收录) - * [订阅行情](datarecoder.md#订阅行情) - * [将订阅信息保存到json文件](datarecoder.md#将订阅信息保存到json文件) - * [推送行情记录事件](datarecoder.md#推送行情记录事件) - * [注册行情记录事件](datarecoder.md#注册行情记录事件) - * [执行记录行情任务](datarecoder.md#执行记录行情任务) * [移除记录](datarecoder.md#移除记录) * [停止记录](datarecoder.md#停止记录) From 4573424e0cc16424658b8a0909dfb1b0414d6b05 Mon Sep 17 00:00:00 2001 From: nanoric Date: Wed, 15 May 2019 16:36:56 +0800 Subject: [PATCH 5/8] [Mod] use python -m pip instead of pip ibapi & rqdatac is installed from 3rd-party source. old version of pip can't handle this correctly. upgrading pip might make /usr/bin/pip(3) unable to execute. So python -m pip is safer to run pip. --- .travis.yml | 14 +++++++------- appveyor.yml | 8 ++++---- install.bat | 13 ++++++++----- install.sh | 16 ++++++++-------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7ed6924e..62ea3a44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ matrix: include: - name: "code quality analysis: flake8" before_install: - - pip install flake8 + - python -m pip install flake8 install: - "" # prevent running "pip install -r requirements.txt" script: @@ -48,7 +48,7 @@ matrix: # 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 + - 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" @@ -73,11 +73,11 @@ matrix: - make - sudo make install - popd - - pip install numpy - - pip install --pre --extra-index-url https://rquser:ricequant99@py.ricequant.com/simple/ rqdatac - - pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl + - 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 - - pip install dist/`ls dist` + - python -m pip install dist/`ls dist` - name: "pip install under osx" os: osx @@ -85,7 +85,7 @@ matrix: services: [] before_install: [] install: - - pip3 install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl + - python -m pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl - bash ./install_osx.sh before_script: [] script: diff --git a/appveyor.yml b/appveyor.yml index 6edca690..2d29e995 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -53,10 +53,10 @@ for: - configuration: sdist build_script: - python setup.py sdist - - pip install --pre --extra-index-url https://rquser:ricequant99@py.ricequant.com/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" + - 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/TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl + - python -m pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl + - ps: $name=(ls dist).name; python -m pip install "dist/$name" test_script: - cd tests diff --git a/install.bat b/install.bat index bc984aae..75002ef9 100644 --- a/install.bat +++ b/install.bat @@ -1,10 +1,13 @@ +:: Upgrade pip & setuptools +python -m pip install --upgrade pip setuptools + ::Install talib and ibapi -pip install https://pip.vnpy.com/colletion/rqdatac-2.1.0.tar.gz -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 +python -m pip install https://pip.vnpy.com/colletion/rqdatac-2.1.0.tar.gz +python -m pip install https://pip.vnpy.com/colletion/TA_Lib-0.4.17-cp37-cp37m-win_amd64.whl +python -m pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl ::Install Python Modules -pip install -r requirements.txt +python -m pip install -r requirements.txt :: Install vn.py -pip install . \ No newline at end of file +python -m pip install . \ No newline at end of file diff --git a/install.sh b/install.sh index 0ca3b777..25ef59da 100644 --- a/install.sh +++ b/install.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash python=$1 -pip=$2 prefix=$3 [[ -z $python ]] && python=python -[[ -z $pip ]] && pip=pip [[ -z $prefix ]] && prefix=/usr +$python -m pip install --upgrade pip setuptools wheel + # Get and build ta-lib pushd /tmp wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz @@ -19,18 +19,18 @@ sudo make install popd # old versions of ta-lib imports numpy in setup.py -$pip install numpy +$python -m pip install numpy # Install extra packages -$pip install --pre --extra-index-url https://rquser:ricequant99@py.ricequant.com/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 +$python -m pip install --pre --extra-index-url https://rquser:ricequant99@py.ricequant.com/simple/ rqdatac +$python -m pip install ta-lib +$python -m 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 +$python -m pip install -r requirements.txt # Install local Chinese language environment sudo locale-gen zh_CN.GB18030 # Install vn.py -$pip install . \ No newline at end of file +$python -m pip install . \ No newline at end of file From 1f70d34b129ae8984dfd06a6d234acc134823db5 Mon Sep 17 00:00:00 2001 From: nanoric Date: Wed, 15 May 2019 16:43:10 +0800 Subject: [PATCH 6/8] [Fix] fixed osx install --- .travis.yml | 2 +- install.sh | 2 +- install_osx.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 62ea3a44..7e85ab59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,7 @@ matrix: services: [] before_install: [] install: - - python -m pip install https://pip.vnpy.com/colletion/ibapi-9.75.1-001-py3-none-any.whl + - 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: diff --git a/install.sh b/install.sh index 25ef59da..117df7fb 100644 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash python=$1 -prefix=$3 +prefix=$2 [[ -z $python ]] && python=python [[ -z $prefix ]] && prefix=/usr diff --git a/install_osx.sh b/install_osx.sh index eb96cc53..0f65ce38 100644 --- a/install_osx.sh +++ b/install_osx.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -bash ./install.sh python3 pip3 /usr/local \ No newline at end of file +bash ./install.sh python3 /usr/local \ No newline at end of file From 0aed24b403f155a3c015fe9a96dacc8a04c791af Mon Sep 17 00:00:00 2001 From: nanoric Date: Wed, 15 May 2019 17:22:52 +0800 Subject: [PATCH 7/8] [Mod] setup.py: use psycopg2-binary instead of psycopg2, and only install when psycopg2 doesn't exists. --- setup.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5aa35593..682cd0e9 100644 --- a/setup.py +++ b/setup.py @@ -107,6 +107,15 @@ else: pkgs = find_packages() + +def is_psycopg2_exists(): + try: + import psycopg2 + return True + except ImportError: + return False + + install_requires = [ "PyQt5<5.12", "qdarkstyle", @@ -114,7 +123,6 @@ install_requires = [ "websocket-client", "peewee", "pymysql", - "psycopg2", "mongoengine", "numpy", "pandas", @@ -127,6 +135,9 @@ install_requires = [ "ibapi", "deap" ] +if not is_psycopg2_exists(): + install_requires.append("psycopg2-binary") + if sys.version_info.minor < 7: install_requires.append("dataclasses") From 8a898c400215e693cf1d162b540f99aa0e219736 Mon Sep 17 00:00:00 2001 From: nanoric Date: Wed, 15 May 2019 17:27:11 +0800 Subject: [PATCH 8/8] [Mod] make flake8 happy --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 682cd0e9..e73de0ef 100644 --- a/setup.py +++ b/setup.py @@ -110,7 +110,7 @@ pkgs = find_packages() def is_psycopg2_exists(): try: - import psycopg2 + import psycopg2 # noqa return True except ImportError: return False