python中的订单流风险度量

flowrisk的Python项目详细描述


#订单流风险度量

目前,这些包只有vpin。

##安装 默认方法是打开控制台并执行

pip install flowrisk

也可以从此处下载并手动安装

git clone https://github.com/hanxixuana/flowrisk cd flowrisk python setup.py install

##vpin蛋白 为了实现vpin,我们制作了

  1. an EWMA estimator of volatility (RecursiveEWMAVol)
  2. a numpy.ndarray based buckets with bulk classification of volumes in the MA style (RecursiveBulkClassMABuckets)
  3. a numpy.ndarray based buckets with bulk classification of volumes in the EWMA style (RecursiveBulkClassEWMABuckets)
  4. a recursive VPIN estimator (RecursiveVPIN)
  5. a recursive VPIN estimator with VPIN confidence intervals (RecursiveConfVPIN)
  6. a recursive model using an EWMA estimator of means and RecursiveEWMAVol, for modeling and log innovations of VPINs and for calculating VPINs’ confidence intervals (RecursiveEWMABand)
  7. a one-shoot VPIN estimator for a series of prices (BulkVPIN)
  8. a one-shoot VPIN estimator for a series of prices with VPIN confidence intervals (BulkConfVPIN)
  9. various configuration classes (RecursiveVPINConfig, RecursiveConfVPINConfig, BulkVPINConfig, BulkConfVPINConfig)

为了说明这一点,我们还将五个小型大写字母(cbio、fbnc、gnc ndls、qes)和五个大型大写字母的1分钟数据 (v,aapl,nvda,gs,intc)来自美国股市。数据涵盖2018年11月12日至11月21日。数据可以被, 例如,

import flowrisk as fr

class Config(fr.BulkConfVPINConfig):
N_TIME_BAR_FOR_INITIALIZATION = 50

config = Config()

example = fr.examples.USStocks(config) symbols = example.list_symbols(‘small’) result = example.estimate_vpin_and_conf_interval(symbols[0])

example.draw_price_vpins_and_conf_intervals()

这段代码将自动计算vpin和gnc的相关置信区间。我们还把 价格和数量加在一起形成一张漂亮的图片,默认保存到./pics/gnc.png。请注意 vpins的计算速度很快,但是制作好的图片却很慢。也可以在test.py中找到更多信息。

请注意,此实现与原始文件有几个不同之处:

Easley, D., López de Prado, M. M., & O’Hara, M. (2012). Flow toxicity and liquidity in a high-frequency world. The Review of Financial Studies, 25(5), 1457-1493.

例如,

  1. we use an EWMA estimator for the volatility of PnLs, instead of using all samples for estimating the PnL volatility; and
  2. VPINs are calculated from the very beginning, instead of after a certain number of buckets have been filled.

我们之所以有所不同,是因为我们包的核心是vpin的递归估计。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
iOS MDM注册配置文件请求/Profile使用java对证书进行签名   java如何调试GWT项目中的PHP文件   Mac和Windows之间的Java文件getFreeSpace差异   java从ArrayList进入JComboBox   ApacheKafka如何执行zookeeperserverstart。我的java程序中的bat文件?   JAXRS应用程序的java初始化   java如何为double覆盖compareTo方法?   使用进程动态运行java代码   sockets java。网SocketException:权限被拒绝openshift   java PorterduffXfermode:清除位图的一部分   其他线程中变量的java更改侦听器   java如何初始化接口实例以与父片段中的子片段通信   java Cordova插件在构建时出错,源代码1.6中不支持菱形运算符使用源代码7   java是学习编程的教育游戏吗?   在不同机器上使用JasperReports API运行代码时出现java问题   java Spring引导延迟Flyway序列化循环依赖   未为加密/解密初始化java密码