vn.py官网
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 1
声望: 1

安装流程:

  1. 下载 anaconda,并安装
  2. 下载pycharm,并安装
  3. 下载vnpy源码vn.py
    下载源码
  4. 打开 pycharm, file->open,选择下载的vnpy 文件夹
    pycharm打开vnpy文件夹
  5. 配置 python 开发环境, file- settings
    pycharm项目设置
    添加新的anaconda环境
    description
    选择python3.7
    description
    这里我使用的环境名称是 py37_vnpy

打开terminal-注意环境切换成 py37_vnpy,执行以下命令,安装需要的插件

pip install -r requirements.txt -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

description
遇到安装失败的可以单独安装:

pip install PyQt5 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

description

  1. 创建run.py文件,复制以下代码,来源 README.md

description

  1. 运行 python run.py,注意环境名称是 py37_vnpy

description

备注:
如果需要在cmd 下使用 py37_vnpy 环境。

打开 CMD
运行: conda activate py37_vnpy
会切换到py37_vnpy环境下

description

Administrator
avatar
加入于:
帖子: 4467
声望: 302

很详细的PyCharm配置教程,给你加个精华

Member
avatar
加入于:
帖子: 1
声望: 0

请问一下,MAC 上命令行也能启动vn trader 的界面?

Member
avatar
加入于:
帖子: 2747
声望: 190

mac请用run.py打开

Member
avatar
加入于:
帖子: 1
声望: 0

description
啥意思~,执行run.py报错,mac本

Member
avatar
加入于:
帖子: 2747
声望: 190

没找到vnpy,请问你安装成功了吗?

Member
avatar
加入于:
帖子: 12
声望: 0

请问下,
1、通过run.py方式启动程序,怎么样能够启动vn trader配置窗口,实现选择ctp或者ctp test这些模块的功能呢?

2、另外,因为自己还要通过python开发别的项目,每次通过主页下载的VNstudio安装包自动安装后,都会修改我的系统全局环境(base),从而使得我的其他项目受到影响,想请教下,如何在虚拟环境py37_vnpy中自动安装呢?是不是只有通过run.py 启动才能解决上述问题

description

Member
avatar
加入于:
帖子: 2747
声望: 190

去掉需要使用的接口和模块前面的注释即可;
run.py只是一个启动脚本。你不想冲突的话,可以把vn.py手动安装在你想要的python环境里。https://github.com/vnpy/vnpy/blob/dev-docs/docs/windows_install.md

Member
avatar
加入于:
帖子: 28
声望: 1

安装 tigeropen 包时报错,请问如何解决? 谢谢。

============== 错误内容 ==========================
(py38_vnpy) E:\vnpy-master_20210811>pip install tigeropen -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
Looking in indexes: http://pypi.douban.com/simple
Collecting tigeropen
Downloading http://pypi.doubanio.com/packages/0e/b5/a8720f9efc3b2272776c67dc65b8ffd08a78cf0505db29997b00bc25a0ff/tigeropen-1.4.1.tar.gz (79 kB)
|████████████████████████████████| 79 kB 2.6 MB/s
Collecting six==1.13.0
Downloading http://pypi.doubanio.com/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl (10 kB)
Collecting simplejson==3.17.0
Downloading http://pypi.doubanio.com/packages/98/87/a7b98aa9256c8843f92878966dc3d8d914c14aad97e2c5ce4798d5743e07/simplejson-3.17.0.tar.gz (83 kB)
|████████████████████████████████| 83 kB 674 kB/s
Collecting delorean==1.0.0
Downloading http://pypi.doubanio.com/packages/76/40/5e8d179a0311236b2e83aa1c80b0b363700035ad6639858c75ef5be975e6/Delorean-1.0.0.tar.gz (18 kB)
Collecting pandas==0.25.3
Downloading http://pypi.doubanio.com/packages/5f/35/ef57828dc80c979592a9bf61831d4de5ee2918eb285f56bb2956236eecdf/pandas-0.25.3-cp38-cp38-win_amd64.whl (9.4 MB)

 |████████████████████████████████| 9.4 MB 6.4 MB/s

Collecting python-dateutil==2.8.1
Downloading http://pypi.doubanio.com/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (22
7 kB)
|████████████████████████████████| 227 kB 6.4 MB/s
Collecting pytz==2019.3
Downloading http://pypi.doubanio.com/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl (509 kB)
|████████████████████████████████| 509 kB 6.8 MB/s
Collecting tigeropen
Downloading http://pypi.doubanio.com/packages/fb/41/3d294e0d1d7de2ce80398d71ca7e98d76bfed71d83cc2a5ef83e49afbb4e/tigeropen-1.4.0.tar.gz (78 kB)
|████████████████████████████████| 78 kB 3.5 MB/s
Downloading http://pypi.doubanio.com/packages/a2/7f/a94cae1ae77c5e3bdc25262bee4cc134a215117eeef3323e8d4506430f9b/tigeropen-1.2.1.tar.gz (73 kB)
|████████████████████████████████| 73 kB 2.6 MB/s
Downloading http://pypi.doubanio.com/packages/2b/54/655861854d1289284e7c44c7215e7c4dc8efe5ed1cd2f39a874a88e60a28/tigeropen-1.2.0.tar.gz (63 kB)
|████████████████████████████████| 63 kB 4.8 MB/s
Collecting pandas==0.24.2
Downloading http://pypi.doubanio.com/packages/b2/4c/b6f966ac91c5670ba4ef0b0b5613b5379e3c7abdfad4e7b89a87d73bae13/pandas-0.24.2.tar.gz (11.8 MB)
|████████████████████████████████| 11.8 MB 6.8 MB/s
Collecting tigeropen
Downloading http://pypi.doubanio.com/packages/6d/c1/a9b6f$c0b984b2fdc7644f63464bab300e213d7176211284c67b977e9d/tigeropen-1.1.10.tar.gz (61 kB)
|████████████████████████████████| 61 kB ...
Downloading http://pypi.doubanio.com/packages/d7/16/b5712dd22f12a6ae3736b7d90bfe8def06a609942b3a0403d0ec14cea383/tigeropen-1.1.9.tar.gz (55 kB)
|████████████████████████████████| 55 kB 4.1 MB/s
Requirement already satisfied: six in e:\anaconda3\envs\py38_vnpy\lib\site-packages (from tigeropen) (1.16.0)
Requirement already satisfied: simplejson in e:\anaconda3\envs\py38_vnpy\lib\site-packages (from tigeropen) (3.17.3)
Requirement already satisfied: python-dateutil in e:\anaconda3\envs\py38_vnpy\lib\site-packages (from tigeropen) (2.8.2)
Requirement already satisfied: pytz in e:\anaconda3\envs\py38_vnpy\lib\site-packages (from tigeropen) (2021.1)
Downloading http://pypi.doubanio.com/packages/2f/66/aba938bf6e2e71bc09186584d3a4b4278346a338c13d9e763cad6d7b8131/tigeropen-1.1.7.tar.gz (53 kB)
|████████████████████████████████| 53 kB ...
Requirement already satisfied: pandas in e:\anaconda3\envs\py38_vnpy\lib\site-packages (from tigeropen) (1.3.1)
Downloading http://pypi.doubanio.com/packages/84/40/7289dc4efa35dd6d957dce03338ebce4ce516b04895cc81002501dc5e681/tigeropen-1.1.6.tar.gz (51 kB)
|████████████████████████████████| 51 kB ...
Downloading http://pypi.doubanio.com/packages/1c/29/640c025506c9076c3d152f65ab97228c4c57b9b34cd65c4e40b2c924cdb4/tigeropen-1.1.5.tar.gz (51 kB)
|████████████████████████████████| 51 kB 2.0 MB/s
Downloading http://pypi.doubanio.com/packages/d2/24/6ca4002e9e896f69ff6bdbd5159b49bf494b24677cda5af3153678ebbb24/tigeropen-1.1.4.tar.gz (44 kB)
|████████████████████████████████| 44 kB ...
Downloading http://pypi.doubanio.com/packages/87/bd/4025bbb1628f4247d96afe893786bcc995e25e5e7a85d4e9adf256542b45/tigeropen-1.1.3.tar.gz (35 kB)
Downloading http://pypi.doubanio.com/packages/61/cd/478f54a6e1c98021b4435761c2acb66f73943bd0d2150b0aed067f6a026e/tigeropen-1.1.2.tar.gz (34 kB)
Downloading http://pypi.doubanio.com/packages/34/73/bfc7992e5da2478688cc7e597940e6b1ad1e318d50074d688a2770cb10d0/tigeropen-1.1.1.tar.gz (34 kB)
Downloading http://pypi.doubanio.com/packages/d8/18/530d3f943d925fd59b0390765ec164916f8d8f306fc284f0ebb394ec3e45/tigeropen-1.1.0.tar.gz (34 kB)
Downloading http://pypi.doubanio.com/packages/b2/5b/91d5dd6bc428ce0b750d65d96b64b4c7e1db6f8d3db2284edd9469a79afb/tigeropen-1.0.6.tar.gz (26 kB)
Downloading http://pypi.doubanio.com/packages/f4/0d/3f9de62029c615d02d3e15add46c3373e675c771aa529f1a45ca8c621e53/tigeropen-1.0.5.tar.gz (26 kB)
Downloading http://pypi.doubanio.com/packages/fa/af/42f268b5d9606f450adf0edb9a50df82b7ba89a4e07c3d2bc98656bdb2e0/tigeropen-1.0.4.tar.gz (26 kB)
Downloading http://pypi.doubanio.com/packages/78/27/531f5a48fbfdaf32233de4f0b0fe8f9dce3c65acb5abfd06c858d3dd0915/tigeropen-1.0.3.tar.gz (26 kB)
Downloading http://pypi.doubanio.com/packages/62/10/bd81c426c5f845a9a9b129fecd248965e7e07ff76d2f375949f18dc47c68/tigeropen-1.0.2.tar.gz (27 kB)
ERROR: Cannot install tigeropen==1.0.2, tigeropen==1.0.3, tigeropen==1.0.4, tigeropen==1.0.5, tigeropen==1.0.6, tigeropen==1.1.0, tigeropen==1.1.1, tigeropen==1.
1.10, tigeropen==1.1.2, tigeropen==1.1.3, tigeropen==1.1.4, tigeropen==1.1.5, tigeropen==1.1.6, tigeropen==1.1.7, tigeropen==1.1.9, tigeropen==1.2.0, tigeropen==
1.2.1, tigeropen==1.4.0 and tigeropen==1.4.1 because these package versions have conflicting dependencies.

The conflict is caused by:
tigeropen 1.4.1 depends on pyasn1==0.4.2
tigeropen 1.4.0 depends on pyasn1==0.4.2
tigeropen 1.2.1 depends on pyasn1==0.4.2
tigeropen 1.2.0 depends on pyasn1==0.4.2
tigeropen 1.1.10 depends on pyasn1==0.4.2
tigeropen 1.1.9 depends on pyasn1==0.4.2
tigeropen 1.1.7 depends on pyasn1==0.4.4
tigeropen 1.1.6 depends on pyasn1==0.4.4
tigeropen 1.1.5 depends on pyasn1==0.4.4
tigeropen 1.1.4 depends on pyasn1==0.4.4
tigeropen 1.1.3 depends on pyasn1==0.4.4
tigeropen 1.1.2 depends on pyasn1==0.4.4
tigeropen 1.1.1 depends on pyasn1==0.4.4
tigeropen 1.1.0 depends on pyasn1==0.4.4
tigeropen 1.0.6 depends on pyasn1==0.4.4
tigeropen 1.0.5 depends on pyasn1==0.4.4
tigeropen 1.0.4 depends on pyasn1==0.4.4
tigeropen 1.0.3 depends on pyasn1==0.4.4
tigeropen 1.0.2 depends on pyasn1==0.4.2

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

(py38_vnpy) E:\vnpy-master_20210811>

Member
avatar
加入于:
帖子: 2747
声望: 190

如果不需要用到老虎证券就注释掉相关的代码即可,如果需要用可以参考一下https://www.vnpy.com/forum/topic/3536?page=1

Member
avatar
加入于:
帖子: 28
声望: 1

xiaohe wrote:

如果不需要用到老虎证券就注释掉相关的代码即可,如果需要用可以参考一下https://www.vnpy.com/forum/topic/3536?page=1
谢谢何总的回复! 但我还是有问题:

  1. 如果我想继续使用老虎证券, 针对我的安装错误,我应该安装哪个版本号的 tigeropen ?
  2. 如果 “不需要用到老虎证券就注释掉相关的代码”, 请问这个注释掉代码具体在哪个文件里面?
Member
avatar
加入于:
帖子: 2747
声望: 190
  1. 想使用可参考帖子里的方法,对pyasn1版本进行调整;
  2. 不想使用注释掉启动脚本run.py里TigerGateway相关代码即可。
Member
avatar
加入于:
帖子: 1
声望: 0

xiaohe wrote:

没找到vnpy,请问你安装成功了吗?
同问,按照说明一步一步走的,但是不知道为啥vnpy没有安装成功。

Member
加入于:
帖子: 2
声望: 0

pip install PyQt5 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
需要用pip来安装PyQt5

Member
avatar
加入于:
帖子: 1
声望: 0

Traceback (most recent call last):
File "run.py", line 6, in <module>
from vnpy.app.cta_backtester import CtaBacktesterApp
File "D:\pydevelop\vnpy\vnpy\app\cta_backtester__init.py", line 3, in <module>
import vnpy_ctabacktester
File "C:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\vnpy_ctabacktester\
init__.py", line 29, in <module>
from .engine import BacktesterEngine, APP_NAME
File "C:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\vnpy_ctabacktester\engine.py", line 18, in <module>
from vnpy_ctastrategy.backtesting import (
File "C:\ProgramData\Anaconda3\envs\vnpy\lib\site-packages\vnpy_ctastrategy\backtesting.py", line 9, in <module>
import plotly.graph_objects as go
ModuleNotFoundError: No module named 'plotly.graph_objects'

解决了talib版本问题,然后又碰到这个,求助,怎么解决plotly应该用哪个版本?

Member
avatar
加入于:
帖子: 2747
声望: 190

可以试试看5.1.0

© 2015-2019 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号-3

沪公网安备 31011502017034号