Python 量化金融都需要用到哪些库?最全汇总!

AirPython

共 13434字,需浏览 27分钟

 · 2021-12-10


大家好,我是安果!
今天分享一篇 Python 量化金融最全汇总,推荐大家收藏!

本文汇总了定量金融的大量三方库,按功能进行分类,覆盖数值运算,衍生品定价,回溯检验,风险管理,数据爬取,可视化等多个子领域,供每个Python程序员参考。

不要重复造轮子,明确要解决的问题,然后寻找相应的工具。很多著名的包如 Numpy,Pandas,Seaborn,backtrader 等已经被证明高度有效,即便没有找到符合应用场景的包,类似的工具也能够为创建自己的解决方案提供参考。

内容来源于Github项目《Awesome Quant》,由Wilson Freitas创作 

项目链接:Awesome Quant[1]

科学运算和数据结构

  • numpy[2] - 进行数值运算的基础包,scipy和numpy令Python进行有效的矩阵运算成为可能
  • scipy[3] - 科学计算生态系统,广泛应用于数学,物理学和工程学等自然科学领域
  • pandas[4] - 提供了高性能的数据结构和数据分析工具
  • quantdsl[5] - 金融/交易领域进行定量分析的领域特定语言
  • statistics[6] - 进行基础统计运算
  • sympy[7] - 专门用于符号数学
  • pymc3[8] - 用Python实现概率编程,贝叶斯建模,用Theano实现概率机器学习

金融工具和定价

  • PyQL[9] - Quantlib的Python接口
  • pyfin[10] - 期权定价
  • vollib[11] - 计算期权价格,隐含波动率和希腊值
  • QuantPy[12] - 定量金融分析
  • Finance-Python[13] - 定量金融分析
  • ffn[14] - 拓展Pandas,提供一系列函数进行基础的量化分析
  • pynance[15] - 获取股票和衍生品市场的数据,分析和可视化
  • hasura/base-python-dash[16] - 快速入门部署Dash应用,Dash基于Flask,Plotly.js和React.js,允许用户用纯Python快速搭建强大的数据科学网页App
  • hasura/base-python-bokeh[17] - 如何用Bokeh实现数据可视化
  • pysabr[18] - 用Python实现SABR模型

技术指标

  • pandas_talib[19] - 整合Pandas和Talib,用pandas计算技术指标
  • finta[20] - 用Pandas计算常见的技术指标
  • Tulipy[21] - 技术指标库(tulipindicators的Python绑定)

量化交易/回溯检验

  • TA-Lib[22] - 计算技术指标,跟Numpy深度整合
  • trade[23] - 用于开发金融应用的基础包
  • zipline[24] - 强大的回溯检验框架,被很多量化交易平台作为底层技术,包括Qauntopian, 聚宽等
  • QuantSoftware Toolkit[25] - 创建和管理投资组合
  • quantitative[26] - 定量金融的基础工具,回溯检验
  • analyzer[27] - 接收实时报价并回溯检验
  • bt[28] - 回溯检验框架,比Zipline更灵活
  • backtrader[29] - 回溯检验框架,支持实盘交易,过去几年快速崛起,已成为最流行的量化工具之一
  • pythalesians[30] - 回溯检验框架
  • pybacktest[31] - 向量化回溯检验框架,向量化允许进行快速的回溯,但检验精度不高
  • pyalgotrade[32] - 回溯检验框架
  • tradingWithPython[33] - 提供一系列函数和自定义类来管理量化交易
  • Pandas TA[34] - 拓展Pandas,包含115种技术指标,快速创建交易策略
  • ta[35] - 用Pandas计算技术指标
  • algobroker[36] - 算法交易的部署引擎
  • pysentosa[37] - sentosa交易系统的Python接口
  • finmarketpy[38] - 分析市场数据,支持简单回溯检验
  • binary-martingale[39] - 自动化交易程序,用马丁格尔策略交易二元期权
  • fooltrader[40] - 利用大数据技术进行量化分析,包含回溯检验
  • zvt[41] - 提供统一和灵活的方式来获取数据,计算因子,选股,回溯检验和实盘交易
  • pylivetrader[42] - 兼容zipline的实时交易库
  • pipeline-live[43] - zipline扩展库,用于实盘交易
  • zipline-extensions[44] - Zipline扩展,适配QuantRocket
  • moonshot[45] - 向量化回溯检验和交易引擎
  • PyPortfolioOpt[46] - 金融投资组合优化,包括创建有效边界和其它高级算法
  • riskparity.py[47] - 用TensorFlow设计风险平价投资组合
  • mlfinlab[48] - 《金融机器学习应用》一书的实现
  • pyqstrat[49] - 快速地回测交易策略
  • pinkfish[50] - 证券分析
  • aat[51] - 异步算法交易引擎
  • Backtesting.py[52] - 回溯检验框架
  • catalyst[53] - 回溯检验框架,专门用于数字货币市场
  • quantstats[54] - 投资组合分析
  • qtpylib[55] - 回溯检验框架,支持实盘交易
  • freqtrade[56] - 开源数字货币交易机器人
  • algorithmic-trading-with-python[57] - 《Python算法交易》一书的源码和数据
  • DeepDow[58] - 用深度学习优化投资组合

风险分析

  • pyfolio[59] - 计算投资组合和交易策略的业绩指标
  • empyrical[60] - 计算常用的风险和业绩指标
  • fecon235[61] - 金融计量经济工具包,包括leptokurtotic风险高斯混合模型,自适应Boltzmann投资组合
  • finance[62] - 计算金融风险
  • qfrm[63] - 定量金融风险管理
  • visualize-wealth[64] - 构建投资组合和定量分析
  • VisualPortfolio[65] - 可视化投资组合表现

因子分析

  • alphalens[66] - 分析预测性因子的表现

时间序列

  • ARCH[67] - Python实现ARCH模型
  • statsmodels[68] - 计量经济模型库,用于创建回归模型,统计检验,时序模型
  • dynts[69] - 操纵和分析时间序列
  • PyFlux[70] - 时间序列模型和因果推断
  • tsfresh[71] - 从时间序列中提取有意义的特征
  • hasura/quandl-metabase[72] - 可视化Quandl的时间序列数据集

日历

  • trading_calendars[73] - 股票交易所财经日历
  • bizdays[74] - 工作日计算和效用工具
  • pandas_market_calendars[75] - 拓展Pandas,股票交易所财经日历

数据源

  • findatapy[76] - 获取彭博终端,Quandl和雅虎财经的数据
  • googlefinance[77] - 从谷歌财经获取实时股票价格
  • yahoo-finance[78] - 从雅虎财经下载股票报价,历史价格,产品信息和财务报表
  • pandas-datareader[79] - 从多个数据源获取经济/金融时间序列,包括谷歌财经,雅虎财经,圣路易斯联储(FRED),OECD, Fama/French,世界银行,欧元区统计局等,是Pandas生态系统的重要组成
  • pandas-finance[80] - 提供高级接口下载和分析金融时间序列
  • pyhoofinance[81] - 从雅虎财经批量获取股票数据
  • yfinanceapi[82] - 从雅虎财经获取数据
  • yql-finance[83] - 从雅虎财经获取数据
  • ystockquote[84] - 从雅虎财经获取实时报价
  • wallstreet[85] - 实时股票和期权报价
  • stock_extractor[86] - 从网络上爬取股票信息
  • Stockex[87] - 从雅虎财经获取数据
  • finsymbols[88] - 获取全美证券交易所,纽约证券交易所和纳斯达克上市公司的详细数据
  • inquisitor[89] - 从Econdb获取经济数据,Econdb是全球经济指标聚合器
  • chinesestockapi[90] - 获取A股数据
  • exchange[91] - 获取最新的汇率报价
  • ticks[92] - 命令行程序,获取股票报价
  • pybbg[93] - 彭博终端COM的Python接口
  • ccy[94] - 获取外汇数据
  • tushare[95] - 获取中国股票,基金,债券和期货市场的历史数据
  • jsm[96] - 获取日本股票市场的历史数据
  • cn_stock_src[97] - 从不同数据源获取中国的股票数据
  • coinmarketcap[98] - 从coinmarketcap获取数字货币数据
  • after-hours[99] - 获取美股盘前和盘后的市场价格
  • bronto-python[100] - 整合Bronto API接
  • pytdx[101] - 获取中国国内股票的实时报价
  • pdblp[102] - 整合Pandas和彭博终端的公共接口
  • tiingo[103] - 从Tiingo平台获取股票日K线和实时报价/新闻流
  • IEX[104] - 从IEX交易所获取股票的实时报价和历史数据
  • alpaca-trade-api[105] - 从Alpaca平台获取股票实时报价和历史数据,并提供交易接口交易美股
  • metatrader5[106] - 集成Python和MQL5交易平台,适合外汇交易
  • akshare[107] - 获取中国股票,基金,债券和宏观经济数据
  • yahooquery[108] - 从雅虎财经获取数据
  • investpy[109] - 从英为财经(Investing.com)获取数据
  • yliveticker[110] - 从雅虎财经通过Websocket获取实时报价

Excel集成

  • xlwings[111] - 深度整合Python和Excel
  • openpyxl[112] - 读取/写入Excel 2007 xlsx/xlsm文件
  • xlrd[113] - 从Excel电子表格提取数据
  • xlsxwriter[114] - 将数据写入Excel电子表格
  • xlwt[115] - 创建跨平台和向后兼容的电子表格
  • DataNitro[116] - 深度整合Python和Excel,可免费试用,商业付费软件
  • xlloop[117] - 创建Excel用户自定义函数
  • expy[118] - Excel插件,允许用户从电子表格中执行Python代码和定义自定义函数
  • pyxll[119] - Excel插件,从Excel中执行Python代码

可视化

  • Matplotlib[120] - Python数据可视化的基础包,从二维图表到三维图表
  • Seaborn[121] - 基于Matplotlib,快速创建美观的统计图表
  • Plotly[122] - 创建动态和交互式的图表
  • Altair[123] - 统计可视化工具,同时支持静态和交互式图表
  • D-Tale[124] - 可视化Pandas数据结构

地址链接

[1] 

Awesome Quant: https//github.com/wilsonfreitas/awesome-quant

[2] 

numpy: https//www.numpy.org/

[3] 

scipy: https//www.scipy.org/

[4] 

pandas: https//pandas.pydata.org/

[5] 

quantdsl: https//github.com/johnbywater/quantdsl

[6] 

statistics: https//docs.python.org/3/library/statistics.html

[7] 

sympy: https//www.sympy.org/

[8] 

pymc3: https//docs.pymc.io/

[9] 

PyQL: https//github.com/enthought/pyql

[10] 

pyfin: https//github.com/opendoor-labs/pyfin

[11] 

vollib: https//github.com/vollib/vollib

[12] 

QuantPy: https//github.com/jsmidt/QuantPy

[13] 

Finance-Python: https//github.com/alpha-miner/Finance-Python

[14] 

ffn: https//github.com/pmorissette/ffn

[15] 

pynance: https//pynance.net/

[16] 

hasura/base-python-dash: https//platform.hasura.io/hub/projects/hasura/base-python-dash

[17] 

hasura/base-python-bokeh: https//platform.hasura.io/hub/projects/hasura/base-python-bokeh

[18] 

pysabr: https//github.com/ynouri/pysabr

[19] 

pandas_talib: https//github.com/femtotrader/pandas_talib

[20] 

finta: https//github.com/peerchemist/finta

[21] 

Tulipy: https//github.com/cirla/tulipy

[22] 

TA-Lib: https//ta-lib.org/

[23] 

trade: https//github.com/rochars/trade

[24] 

zipline: https//www.zipline.io/

[25] 

QuantSoftware Toolkit: https//github.com/QuantSoftware/QuantSoftwareToolkit

[26] 

quantitative: https//github.com/jeffrey-liang/quantitative

[27] 

analyzer: https//github.com/llazzaro/analyzer

[28] 

bt: https//github.com/pmorissette/bt

[29] 

backtrader: https//github.com/backtrader/backtrader

[30] 

pythalesians: https//github.com/thalesians/pythalesians

[31] 

pybacktest: https//github.com/ematvey/pybacktest

[32] 

pyalgotrade: https//github.com/gbeced/pyalgotrade

[33] 

tradingWithPython: https//pypi.org/project/tradingWithPython/

[34] 

Pandas TA: https//github.com/twopirllc/pandas-ta

[35] 

ta: https//github.com/bukosabino/ta

[36] 

algobroker: https//github.com/joequant/algobroker

[37] 

pysentosa: https//pypi.org/project/pysentosa/

[38] 

finmarketpy: https//github.com/cuemacro/finmarketpy

[39] 

binary-martingale: https//github.com/metaperl/binary-martingale

[40] 

fooltrader: https//github.com/foolcage/fooltrader

[41] 

zvt: https//github.com/zvtvz/zvt

[42] 

pylivetrader: https//github.com/alpacahq/pylivetrader

[43] 

pipeline-live: https//github.com/alpacahq/pipeline-live

[44] 

zipline-extensions: https//github.com/quantrocket-llc/zipline-extensions

[45] 

moonshot: https//github.com/quantrocket-llc/moonshot

[46] 

PyPortfolioOpt: https//github.com/robertmartin8/PyPortfolioOpt

[47] 

riskparity.py: https//github.com/dppalomar/riskparity.py

[48] 

mlfinlab: https//github.com/hudson-and-thames/mlfinlab

[49] 

pyqstrat: https//github.com/abbass2/pyqstrat

[50] 

pinkfish: https//github.com/fja05680/pinkfish

[51] 

aat: https//github.com/timkpaine/aat

[52] 

Backtesting.py: https//kernc.github.io/backtesting.py/

[53] 

catalyst: https//github.com/enigmampc/catalyst

[54] 

quantstats: https//github.com/ranaroussi/quantstats

[55] 

qtpylib: https//github.com/ranaroussi/qtpylib

[56] 

freqtrade: https//github.com/freqtrade/freqtrade

[57] 

algorithmic-trading-with-python: https//github.com/chrisconlan/algorithmic-trading-with-python

[58] 

DeepDow: https//github.com/jankrepl/deepdow

[59] 

pyfolio: https//github.com/quantopian/pyfolio

[60] 

empyrical: https//github.com/quantopian/empyrical

[61] 

fecon235: https//github.com/rsvp/fecon235

[62] 

finance: https//pypi.org/project/finance/

[63] 

qfrm: https//pypi.org/project/qfrm/

[64] 

visualize-wealth: https//github.com/benjaminmgross/visualize-wealth

[65] 

VisualPortfolio: https//github.com/wegamekinglc/VisualPortfolio

[66] 

alphalens: https//github.com/quantopian/alphalens

[67] 

ARCH: https//github.com/bashtage/arch

[68] 

statsmodels: https://link.zhihu.com/?target=http%3A//statsmodels.sourceforge.net/

[69] 

dynts: https//github.com/quantmind/dynts

[70] 

PyFlux: https//github.com/RJT1990/pyflux

[71] 

tsfresh: https//github.com/blue-yonder/tsfresh

[72] 

hasura/quandl-metabase: https//platform.hasura.io/hub/projects/anirudhm/quandl-metabase-time-series

[73] 

trading_calendars: https//github.com/quantopian/trading_calendars

[74] 

bizdays: https//github.com/wilsonfreitas/python-bizdays

[75] 

pandas_market_calendars: https//github.com/rsheftel/pandas_market_calendars

[76] 

findatapy: https//github.com/cuemacro/findatapy

[77] 

googlefinance: https//github.com/hongtaocai/googlefinance

[78] 

yahoo-finance: https//github.com/lukaszbanasiak/yahoo-finance

[79] 

pandas-datareader: https//github.com/pydata/pandas-datareader

[80] 

pandas-finance: https//github.com/davidastephens/pandas-finance

[81] 

pyhoofinance: https//github.com/innes213/pyhoofinance

[82] 

yfinanceapi: https//github.com/Karthik005/yfinanceapi

[83] 

yql-finance: https//github.com/slawek87/yql-finance

[84] 

ystockquote: https//github.com/cgoldberg/ystockquote

[85] 

wallstreet: https//github.com/mcdallas/wallstreet

[86] 

stock_extractor: https//github.com/ZachLiuGIS/stock_extractor

[87] 

Stockex: https//github.com/cttn/Stockex

[88] 

finsymbols: https//github.com/skillachie/finsymbols

[89] 

inquisitor: https//github.com/econdb/inquisitor

[90] 

chinesestockapi: https//pypi.org/project/chinesestockapi/

[91] 

exchange: https//github.com/akarat/exchange

[92] 

ticks: https//github.com/jamescnowell/ticks

[93] 

pybbg: https//github.com/bpsmith/pybbg

[94] 

ccy: https//github.com/lsbardel/ccy

[95] 

tushare: https//pypi.org/project/tushare/

[96] 

jsm: https//pypi.org/project/jsm/

[97] 

cn_stock_src: https//github.com/jealous/cn_stock_src

[98] 

coinmarketcap: https//github.com/barnumbirr/coinmarketcap

[99] 

after-hours: https//github.com/datawrestler/after-hours

[100] 

bronto-python: https//pypi.org/project/bronto-python/

[101] 

pytdx: https//github.com/rainx/pytdx

[102] 

pdblp: https//github.com/matthewgilbert/pdblp

[103] 

tiingo: https//github.com/hydrosquall/tiingo-python

[104] 

IEX: https//github.com/addisonlynch/iexfinance

[105] 

alpaca-trade-api: https//github.com/alpacahq/alpaca-trade-api-python

[106] 

metatrader5: https//pypi.org/project/MetaTrader5/

[107] 

akshare: https//github.com/jindaxiang/akshare

[108] 

yahooquery: https//github.com/dpguthrie/yahooquery

[109] 

investpy: https//github.com/alvarobartt/investpy

[110] 

yliveticker: https//github.com/yahoofinancelive/yliveticker

[111] 

xlwings: https//www.xlwings.org/

[112] 

openpyxl: https//openpyxl.readthedocs.io/en/latest/

[113] 

xlrd: https//github.com/python-excel/xlrd

[114] 

xlsxwriter: https//xlsxwriter.readthedocs.io/

[115] 

xlwt: https//github.com/python-excel/xlwt

[116] 

DataNitro: https//datanitro.com/

[117] 

xlloop: https://link.zhihu.com/?target=http%3A//xlloop.sourceforge.net/

[118] 

expy: https://link.zhihu.com/?target=http%3A//www.bnikolic.co.uk/expy/expy.html

[119] 

pyxll: https//www.pyxll.com/

[120] 

Matplotlib: https//matplotlib.org/tutorials/index.html

[121] 

Seaborn: https//seaborn.pydata.org/

[122] 

Plotly: https//plotly.com/python/

[123] 

Altair: https//altair-viz.github.io/index.html

[124] 

D-Tale: https//github.com/man-group/dtale

来源:网络
编辑:【数据STUDIO】云朵君
仅做学术分享,若有侵权,清联系删除!



另外,大家如果对某些量化策略感兴趣,希望能够被尽快复现写成笔记的!

浏览 38
点赞
评论
收藏
分享

手机扫一扫分享

举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

举报