Skip to content

Commit

Permalink
Date (#4203)
Browse files Browse the repository at this point in the history
* add version

* fix index_option_50etf_qvix

* remove option_50etf_qvix

* update date
  • Loading branch information
albertandking authored Oct 19, 2023
1 parent ca0aa3b commit 96245a4
Show file tree
Hide file tree
Showing 7 changed files with 259 additions and 232 deletions.
13 changes: 7 additions & 6 deletions akshare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2552,9 +2552,10 @@
1.11.36 add: add stock_fear_greed_funddb interface
1.11.37 fix: fix index_fear_greed_funddb interface
1.11.38 fix: fix setup.py interface
1.11.39 fix: fix index_option_50etf_qvix interface
"""

__version__ = "1.11.38"
__version__ = "1.11.39"
__author__ = "AKFamily"

import sys
Expand Down Expand Up @@ -2791,11 +2792,11 @@
"""
50ETF 期权波动率指数
"""
from akshare.option.option_qvix import (
option_50etf_qvix,
option_300etf_min_qvix,
option_300etf_qvix,
option_50etf_min_qvix,
from akshare.index.index_option_qvix import (
index_option_50etf_qvix,
index_option_300etf_min_qvix,
index_option_300etf_qvix,
index_option_50etf_min_qvix,
)

"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding:utf-8 -*-
# !/usr/bin/env python
"""
Date: 2022/10/26 20:20
Date: 2023/10/19 16:00
Desc: 50 ETF 期权波动率指数 QVIX
300 ETF 期权波动率指数 QVIX
http://1.optbbs.com/s/vix.shtml?50ETF
Expand All @@ -10,7 +10,7 @@
import pandas as pd


def option_50etf_qvix() -> pd.DataFrame:
def index_option_50etf_qvix() -> pd.DataFrame:
"""
50ETF 期权波动率指数 QVIX
http://1.optbbs.com/s/vix.shtml?50ETF
Expand All @@ -26,11 +26,15 @@ def option_50etf_qvix() -> pd.DataFrame:
"low",
"close",
]
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.date
temp_df['open'] = pd.to_numeric(temp_df['open'], errors="coerce")
temp_df['high'] = pd.to_numeric(temp_df['high'], errors="coerce")
temp_df['low'] = pd.to_numeric(temp_df['low'], errors="coerce")
temp_df['close'] = pd.to_numeric(temp_df['close'], errors="coerce")
return temp_df


def option_50etf_min_qvix() -> pd.DataFrame:
def index_option_50etf_min_qvix() -> pd.DataFrame:
"""
50 ETF 期权波动率指数 QVIX
http://1.optbbs.com/s/vix.shtml?50ETF
Expand All @@ -43,10 +47,11 @@ def option_50etf_min_qvix() -> pd.DataFrame:
"time",
"qvix",
]
temp_df['qvix'] = pd.to_numeric(temp_df['qvix'], errors="coerce")
return temp_df


def option_300etf_qvix() -> pd.DataFrame:
def index_option_300etf_qvix() -> pd.DataFrame:
"""
300 ETF 期权波动率指数 QVIX
http://1.optbbs.com/s/vix.shtml?300ETF
Expand All @@ -62,11 +67,15 @@ def option_300etf_qvix() -> pd.DataFrame:
"low",
"close",
]
temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
temp_df["date"] = pd.to_datetime(temp_df["date"], errors="coerce").dt.date
temp_df['open'] = pd.to_numeric(temp_df['open'], errors="coerce")
temp_df['high'] = pd.to_numeric(temp_df['high'], errors="coerce")
temp_df['low'] = pd.to_numeric(temp_df['low'], errors="coerce")
temp_df['close'] = pd.to_numeric(temp_df['close'], errors="coerce")
return temp_df


def option_300etf_min_qvix() -> pd.DataFrame:
def index_option_300etf_min_qvix() -> pd.DataFrame:
"""
300 ETF 期权波动率指数 QVIX-分时
http://1.optbbs.com/s/vix.shtml?300ETF
Expand All @@ -79,18 +88,19 @@ def option_300etf_min_qvix() -> pd.DataFrame:
"time",
"qvix",
]
temp_df['qvix'] = pd.to_numeric(temp_df['qvix'], errors="coerce")
return temp_df


if __name__ == "__main__":
option_50etf_qvix_df = option_50etf_qvix()
print(option_50etf_qvix_df)
index_option_50etf_qvix_df = index_option_50etf_qvix()
print(index_option_50etf_qvix_df)

option_50etf_min_qvix_df = option_50etf_min_qvix()
print(option_50etf_min_qvix_df)
index_option_50etf_min_qvix_df = index_option_50etf_min_qvix()
print(index_option_50etf_min_qvix_df)

option_300etf_qvix_df = option_300etf_qvix()
print(option_300etf_qvix_df)
index_option_300etf_qvix_df = index_option_300etf_qvix()
print(index_option_300etf_qvix_df)

option_300etf_min_qvix_df = option_300etf_min_qvix()
print(option_300etf_min_qvix_df)
index_option_300etf_min_qvix_df = index_option_300etf_min_qvix()
print(index_option_300etf_min_qvix_df)
13 changes: 13 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

| AKShare 版本 | 旧接口名称 | 新接口名称 | 修改日期 |
|------------|---------------------------------------------|---------------------------------------------|----------|
| 1.11.39 | option_300etf_min_qvix | index_option_300etf_min_qvix | 20231019 |
| 1.11.39 | option_300etf_qvix | index_option_300etf_qvix | 20231019 |
| 1.11.39 | option_50etf_min_qvix | index_option_50etf_min_qvix | 20231019 |
| 1.11.39 | option_50etf_qvix | index_option_50etf_qvix | 20231019 |
| 1.10.50 | car_cpca_energy_sale | car_energy_sale_cpca | 20230710 |
| 1.10.36 | stock_em_sy_hy_list | stock_sy_hy_em | 20230624 |
| 1.10.36 | stock_em_sy_list | stock_sy_em | 20230624 |
Expand Down Expand Up @@ -63,6 +67,13 @@

## 更新说明详情

1.11.39 fix: fix index_option_50etf_qvix interface

1. 重命名 option_50etf_qvix 为 index_option_50etf_qvix 接口
2. 重命名 option_50etf_min_qvix 为 index_option_50etf_min_qvix 接口
3. 重命名 option_300etf_qvix 为 index_option_300etf_qvix 接口
4. 重命名 option_300etf_min_qvix 为 index_option_300etf_min_qvix 接口

1.11.38 fix: fix setup.py interface

1. 新增 python 3.12 支持
Expand Down Expand Up @@ -2984,6 +2995,8 @@

## 版本更新说明

1.11.39 fix: fix index_option_50etf_qvix interface

1.11.38 fix: fix setup.py interface

1.11.37 fix: fix index_fear_greed_funddb interface
Expand Down
208 changes: 208 additions & 0 deletions docs/data/index/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,214 @@ print(index_investing_global_df)
2963 2021-09-09 1803.44 1794.91 1819.65 1794.91 0.0
```

### 期权波动率指数

#### 50ETF 期权波动率指数

接口: index_option_50etf_qvix

目标地址: http://1.optbbs.com/s/vix.shtml?50ETF

描述: 50ETF 期权波动率指数 QVIX; 又称中国版的恐慌指数

限量: 单次返回所有数据

输入参数

| 名称 | 类型 | 描述 |
|-----|-----|-----|
| - | - | - |

输出参数

| 名称 | 类型 | 描述 |
|-------|---------|-----|
| date | object | - |
| open | float64 | - |
| high | float64 | - |
| low | float64 | - |
| close | float64 | - |

接口示例

```python
import akshare as ak

index_option_50etf_qvix_df = ak.index_option_50etf_qvix()
print(index_option_50etf_qvix_df)
```

数据示例

```
date open high low close
0 2015-02-09 28.800000 28.756878 27.829555 28.63
1 2015-02-10 28.630000 29.435024 28.499700 28.75
2 2015-02-11 26.470710 26.470710 26.176691 26.44
3 2015-02-12 26.389094 26.389094 25.773367 25.80
4 2015-02-13 24.286958 24.286958 22.810473 23.41
... ... ... ... ...
2108 2023-10-13 15.290000 15.780000 15.180000 15.61
2109 2023-10-16 16.270000 16.720000 16.060000 16.41
2110 2023-10-17 16.470000 16.580000 15.800000 15.80
2111 2023-10-18 15.810000 16.110000 15.450000 15.70
2112 2023-10-19 16.060000 18.280000 16.060000 17.95
[2113 rows x 5 columns]
```

#### 50ETF 期权波动率指数-分时

接口: index_option_50etf_min_qvix

目标地址: http://1.optbbs.com/s/vix.shtml?50ETF

描述: 50ETF 期权波动率指数-分时

限量: 单次返回最近交易日的分时数据

输入参数

| 名称 | 类型 | 描述 |
|-----|-----|-----|
| - | - | - |

输出参数

| 名称 | 类型 | 描述 |
|-------|---------|-----|
| time | object | - |
| qvix | float64 | - |

接口示例

```python
import akshare as ak

index_option_50etf_min_qvix_df = ak.index_option_50etf_min_qvix()
print(index_option_50etf_min_qvix_df)
```

数据示例

```
time qvix
0 9:30:00 16.06
1 9:31:11 16.52
2 9:32:11 16.52
3 9:33:11 16.70
4 9:34:11 16.64
.. ... ...
234 14:53:19 18.14
235 14:54:19 18.06
236 14:55:19 17.99
237 14:56:19 17.95
238 15:00:00 NaN
[239 rows x 2 columns]
```

#### 300ETF 期权波动率指数

接口: index_option_300etf_qvix

目标地址: http://1.optbbs.com/s/vix.shtml?300ETF

描述: 300ETF 期权波动率指数 QVIX

限量: 单次返回所有数据

输入参数

| 名称 | 类型 | 描述 |
|-----|-----|-----|
| - | - | - |

输出参数

| 名称 | 类型 | 描述 |
|-------|---------|-----|
| date | object | - |
| open | float64 | - |
| high | float64 | - |
| low | float64 | - |
| close | float64 | - |

接口示例

```python
import akshare as ak

index_option_300etf_qvix_df = ak.index_option_300etf_qvix()
print(index_option_300etf_qvix_df)
```

数据示例

```
date open high low close
0 2015-02-09 NaN NaN NaN NaN
1 2015-02-10 NaN NaN NaN NaN
2 2015-02-11 NaN NaN NaN NaN
3 2015-02-12 NaN NaN NaN NaN
4 2015-02-13 NaN NaN NaN NaN
... ... ... ... ...
2108 2023-10-13 15.18 15.70 15.00 15.46
2109 2023-10-16 16.06 17.04 15.89 16.67
2110 2023-10-17 16.73 16.96 16.18 16.19
2111 2023-10-18 16.42 16.42 15.92 16.25
2112 2023-10-19 16.59 18.46 16.59 18.06
[2113 rows x 5 columns]
```

#### 300ETF 期权波动率指数-分时

接口: index_option_300etf_min_qvix

目标地址: http://1.optbbs.com/s/vix.shtml?300ETF

描述: 300ETF 期权波动率指数-分时

限量: 单次返回最近交易日的分时数据

输入参数

| 名称 | 类型 | 描述 |
|-----|-----|-----|
| - | - | - |

输出参数

| 名称 | 类型 | 描述 |
|-------|---------|-----|
| time | object | - |
| qvix | float64 | - |

接口示例

```python
import akshare as ak

index_option_300etf_min_qvix_df = ak.index_option_300etf_min_qvix()
print(index_option_300etf_min_qvix_df)
```

数据示例

```
time qvix
0 9:30:00 16.59
1 9:31:11 16.96
2 9:32:11 17.13
3 9:33:11 17.44
4 9:34:11 17.39
.. ... ...
234 14:53:19 18.30
235 14:54:19 18.25
236 14:55:19 18.17
237 14:56:19 18.06
238 15:00:00 NaN
[239 rows x 2 columns]
```

### 微博指数数据

接口: weibo_index
Expand Down
Loading

0 comments on commit 96245a4

Please sign in to comment.