Python3量化技术常用插件

1. 确定自己的系统为64位版本

2. 下载安装Python3 64位版本

如果要使用zipline,建议使用python3.5。另外发现很多东西要求的也是3.5。

主页地址: https://www.python.org/downloads/release/python-362/

下载地址: https://www.python.org/ftp/python/3.6.2/python-3.6.2-amd64.exe

安装过程,略。

安装成功

3. 下载安装numpy

作用:矩阵运算

主页地址: https://pypi.python.org/pypi/numpy

安装方法:可以直接使用命令pip install numpy进行安装

或者下载后安装

下载地址:https://pypi.python.org/packages/0d/8a/2de59f0154fe9cab6e12c404482714b8b8e8f9b0b561138f1eaf03b8d61f/numpy-1.13.1-cp36-none-win_amd64.whl

然后使用如下命令进行安装:

4. 下载安装TA-Lib

作用:技术分析

主页地址:http://ta-lib.org/

加利福尼亚大学欧文分校 荧光动力学实验室 的 克里斯托夫·戈尔克( Christoph Gohlke)提供了一个非官方的Python扩展库,地址为

下载地址:

https://download.lfd.uci.edu/pythonlibs/o4uhg4xd/TA_Lib-0.4.17-cp35-cp35m-win_amd64.whl
https://download.lfd.uci.edu/pythonlibs/o4uhg4xd/TatSu-4.2.6-cp36-cp36m-win_amd64.whl
https://download.lfd.uci.edu/pythonlibs/o4uhg4xd/TatSu-4.2.6-cp37-cp37m-win_amd64.whl

安装方法:

5. 安装MySQL插件

作用:数据库

Python3下推荐使用PyMySQL,直接使用命令 pip install PyMySQL

安装方法:

6. 安装Tushare

作用:股票财经数据

Tushare是一个免费、开源的python财经数据接口包。主要实现对股票等金融数据从数据采集、清洗加工 到 数据存储的过程,能够为金融分析人员提供快速、整洁、和多样的便于分析的数据,为他们在数据获取方面极大地减轻工作量,使他们更加专注于策略和模型的研究与实现上。考虑到Python pandas包在金融量化分析中体现出的优势,Tushare返回的绝大部分的数据格式都是pandas DataFrame类型,非常便于用pandas/NumPy/Matplotlib进行数据分析和可视化。

安装方法:

7. 安装openpyxl读写Excel

Python3下使用openpyxl读写Excel 2007以上版本,直接使用命令 pip install openpyxl

安装方法:

C:PythonLib>pip install openpyxl
Collecting openpyxl
  Downloading https://files.pythonhosted.org/packages/f6/13/3c1263b852377738eaa60f99602fb58cc8ad2fd1badb0b724b0d5b532727/openpyxl-2.5.4.tar.gz (170kB)
    100% |████████████████████████████████| 174kB 6.6MB/s
Requirement already satisfied: jdcal in c:pythonlibsite-packages (from openpyxl) (1.4)
Requirement already satisfied: et_xmlfile in c:pythonlibsite-packages (from openpyxl) (1.0.1)
Installing collected packages: openpyxl
  Running setup.py install for openpyxl ... done
Successfully installed openpyxl-2.5.4

8. 安装requests用于http请求

使用命令 pip install requests

安装方法:

C:Python>pip install requests
Collecting requests
  Downloading https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl (91kB)
    100% |████████████████████████████████| 92kB 5.9MB/s
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:pythonlibsite-packages (from requests) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in c:pythonlibsite-packages (from requests) (2018.4.16)
Requirement already satisfied: idna<2.8,>=2.5 in c:pythonlibsite-packages (from requests) (2.6)
Requirement already satisfied: urllib3<1.24,>=1.21.1 in c:pythonlibsite-packages (from requests) (1.22)
Installing collected packages: requests
Successfully installed requests-2.19.1

C:Python>

9. 安装websocket

交易所的高速实时行情一般使用websocket协议提供

使用命令 pip install websocket-client,注意不是 “pip install websocket”,可能被占用了

安装方法:

C:Python>pip install websocket-client
Collecting websocket-client
  Downloading https://files.pythonhosted.org/packages/09/12/d21872b618befc489cabde794c7af281d12fa2e194e279132ef1f04a3b07/websocket_client-0.52.0-py2.py3-none-any.whl (198kB)
    100% |████████████████████████████████| 204kB 6.6MB/s
Requirement already satisfied: six in c:pythonlibsite-packages (from websocket-client) (1.11.0)
Installing collected packages: websocket-client
Successfully installed websocket-client-0.52.0

10. 安装Numba

Numba高性能Python编译器,可以大幅提高python运行速度

安装方法:

C:PythonLib>pip install numba
Collecting numba
  Downloading https://files.pythonhosted.org/packages/45/3d/ffda63434abb2b7d989e709f06cf9eb65c05d284eb7210b4ef3b33bee6f3/numba-0.40.1-cp36-cp36m-win32.whl (1.6MB)
    100% |████████████████████████████████| 1.6MB 3.3MB/s
Requirement already satisfied: numpy in c:pythonlibsite-packages (from numba) (1.14.2)
Collecting llvmlite>=0.25.0dev0 (from numba)
  Downloading https://files.pythonhosted.org/packages/30/dc/eac7d7f113e8cb2e8d36ce9a77a39ac24b46b4d0d523737b72837f3152e1/llvmlite-0.25.0-cp36-cp36m-win32.whl (8.3MB)
    100% |████████████████████████████████| 8.3MB 936kB/s
Installing collected packages: llvmlite, numba
Successfully installed llvmlite-0.25.0 numba-0.40.1


C:PythonLib>
原文地址:https://www.cnblogs.com/bitquant/p/python3-plugin.html