python模块通过wed scraping和alpha vantage api获取股票和期权信息
quant-experiment的Python项目详细描述
功能
- 实时股票和期权数据:您可以轻松提取最新的股票和期权信息
- 选项特征:库基于Black-Scholes模型为您提供与选项相关的特征
安装
使用pip安装
$ pip install quant_experiment
快速启动
数据是从Alpha Vantage API免费服务中检索的,请确保首先初始化一个密钥变量
key="YOUR_API_KEY"
- 库存数据操作
fromquant_experimentimportfinproductsstock_demo=finproducts.Stock('AAPL',key)stock_demo.price#return realtime stock pricestock_demo.latestTradingDay#lastest trading daystock_demo.volume#volume
- 操作选项数据
fromquant_experimentimportfinproductsoption_demo=finproducts.VanillaOption('AAPL',21,6,2019,180,'calls')#call option with expiration date 2019-06-21 and strike price 180option_demo.option_info()
输出如下:
- 基于black scholes的返回选项属性
fromquant_experimentimportfinproductsoption_demo=finproducts.VanillaOption('AAPL',21,6,2019,180,'calls')option_demo.BS_Info(key)#return implied volatility by defaultoption_demo.BS_Info(key,'greeks')#return delta, gamma, vega, theta and rho
贡献
欢迎所有捐款