AKShare-指數(shù)數(shù)據(jù)-全球指數(shù)

作者寄語
本次更新主要是修復了之前全球指數(shù)接口的部分bug,另外新增了一個通過 URL 地址來獲取指數(shù)數(shù)據(jù)的接口,該接口的實用性相對于之前的接口更強,用下就知道了!
更新接口
"index_investing_global" # 全球指數(shù)數(shù)據(jù) "index_investing_global_from_url" # 全球指數(shù)數(shù)據(jù)-URL版
全球指數(shù)數(shù)據(jù)
接口: index_investing_global
目標地址: https://cn.investing.com/indices/
描述: 獲取世界主要國家的各種指數(shù), 該接口需要通過代理訪問; 由于涉及國家和指數(shù)(1000 + 個指數(shù))具體參見國家-指數(shù)目錄具體的調(diào)用方式可以參照:
先查詢指數(shù)所在的國家名稱; 復制網(wǎng)頁上國家名稱(推薦復制), 如 美國; 復制所顯示的具體指數(shù)名稱(推薦復制, 如果英文中間有空格, 也需要保留空格), 如 美元指數(shù); 也可以調(diào)用 ak.index_investing_global_country_name_url("美國") 獲取需要國家的具體指數(shù)名稱 在安裝 AKShare 后輸入, 如 ak.index_investing_global(country="美國", index_name="VIX恐慌指數(shù)", period="每月", start_date="2005-01-01", end_date="2020-06-05"); 稍后就可以獲得所需數(shù)據(jù).
限量: 單次返回某一個國家的具體某一個指數(shù), 建議用 for 循環(huán)獲取多個國家的多個指數(shù), 注意不要大量獲取, 以免給對方服務器造成壓力!
輸入?yún)?shù)
| 名稱 | 類型 | 描述 |
|---|---|---|
| country | str | country="美國" |
| index_name | str | index_name="美元指數(shù)"; 可以通過 ak.index_investing_global_country_name_url("美國") 獲取 |
| period | str | period="每月"; choice of {"每日", "每周", "每月"} |
| start_date | str | start_date='20000101' |
| end_date | str | end_date='20191017' |
輸出參數(shù)
| 名稱 | 類型 | 描述 |
|---|---|---|
| 日期 | object | 日期 |
| 收盤 | float64 | 收盤價 |
| 開盤 | float64 | 開盤價 |
| 高 | float64 | 最高價 |
| 低 | float64 | 最低價 |
| 交易量 | float64 | 交易量 |
接口示例
import akshare as ak
index_investing_global_df = ak.index_investing_global(country="中國", index_name="富時中國A50指數(shù)", period="每日", start_date="20000101", end_date="20210909")
print(index_investing_global_df)
數(shù)據(jù)示例
日期 收盤 開盤 高 低 交易量
0 2010-05-19 9047.81 9106.26 9191.26 8929.31 0.0
1 2010-05-20 8924.33 9047.81 9143.00 8905.52 0.0
2 2010-05-21 9026.51 8924.33 9030.58 8686.36 0.0
3 2010-05-24 9317.78 9026.51 9375.71 9026.51 0.0
4 2010-05-25 9077.53 9317.78 9317.78 9050.91 0.0
... ... ... ... ... ...
2783 2021-09-03 15136.65 15093.72 15247.63 14902.02 0.0
2784 2021-09-06 15388.35 15136.65 15462.80 15087.18 0.0
2785 2021-09-07 15544.89 15388.35 15600.47 15283.45 0.0
2786 2021-09-08 15397.64 15544.89 15589.33 15347.35 0.0
2787 2021-09-09 15366.34 15397.64 15402.02 15256.98 0.0
全球指數(shù)數(shù)據(jù)-URL版
接口: index_investing_global_from_url
目標地址: https://www.investing.com/indices/ftse-epra-nareit-eurozone
描述: 世界主要國家的各種指數(shù), 該接口需要通過代理訪問; 該接口只需要輸入相應指數(shù)的 URL 地址
限量: 單次返回某一個國家的具體某一個指數(shù), 建議用 for 循環(huán)獲取多個國家的多個指數(shù), 注意不要大量獲取, 以免給對方服務器造成壓力!
輸入?yún)?shù)
| 名稱 | 類型 | 描述 |
|---|---|---|
| url | str | url="https://www.investing.com/indices/ftse-epra-nareit-eurozone"; 具體指數(shù)的頁面 URL 地址 |
| period | str | period="每月"; choice of {"每日", "每周", "每月"} |
| start_date | str | start_date='20000101' |
| end_date | str | end_date='20191017' |
輸出參數(shù)
| 名稱 | 類型 | 描述 |
|---|---|---|
| 日期 | object | 日期 |
| 收盤 | float64 | 收盤價 |
| 開盤 | float64 | 開盤價 |
| 高 | float64 | 最高價 |
| 低 | float64 | 最低價 |
| 交易量 | float64 | 交易量 |
接口示例
import akshare as ak
index_investing_global_df = ak.index_investing_global_from_url(url="https://www.investing.com/indices/ftse-epra-nareit-hong-kong", period="每日", start_date="19900101", end_date="20210909")
print(index_investing_global_df)
數(shù)據(jù)示例
日期 收盤 開盤 高 低 交易量
0 2010-05-18 1601.97 1582.11 1605.89 1571.07 0.0
1 2010-05-19 1577.06 1583.19 1594.69 1569.45 0.0
2 2010-05-20 1568.02 1585.58 1585.65 1541.22 0.0
3 2010-05-21 1565.46 1564.88 1565.74 1562.59 0.0
4 2010-05-24 1611.90 1555.62 1615.30 1555.62 0.0
... ... ... ... ... ...
2959 2021-09-03 1803.02 1813.51 1819.92 1767.47 0.0
2960 2021-09-06 1792.55 1797.30 1799.81 1790.49 0.0
2961 2021-09-07 1798.50 1797.41 1802.65 1790.11 0.0
2962 2021-09-08 1799.42 1793.50 1806.87 1793.24 0.0
2963 2021-09-09 1803.44 1794.91 1819.65 1794.91 0.0
評論
圖片
表情
