akshare 1.16.63__py3-none-any.whl → 1.16.65__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. akshare/__init__.py +4 -2
  2. akshare/air/cons.py +1 -0
  3. akshare/air/crypto.js +1 -1
  4. akshare/air/outcrypto.js +1 -1
  5. akshare/article/cons.py +1 -0
  6. akshare/article/epu_index.py +4 -3
  7. akshare/article/ff_factor.py +19 -8
  8. akshare/article/fred_md.py +4 -1
  9. akshare/article/risk_rv.py +3 -8
  10. akshare/bond/bond_cb_sina.py +1 -0
  11. akshare/bond/bond_cbond.py +19 -14
  12. akshare/bond/bond_em.py +34 -15
  13. akshare/bond/bond_summary.py +38 -37
  14. akshare/bond/bond_zh_cov.py +0 -6
  15. akshare/bond/cons.py +14 -11
  16. akshare/crypto/__init__.py +1 -1
  17. akshare/crypto/crypto_bitcoin_cme.py +7 -7
  18. akshare/crypto/crypto_hold.py +4 -1
  19. akshare/currency/currency.py +1 -0
  20. akshare/currency/currency_china_bank_sina.py +6 -3
  21. akshare/data/__init__.py +1 -1
  22. akshare/data/cninfo.js +1 -1
  23. akshare/economic/cons.py +10 -3
  24. akshare/economic/macro_australia.py +0 -7
  25. akshare/economic/macro_canada.py +92 -81
  26. akshare/economic/macro_china.py +0 -34
  27. akshare/economic/macro_china_hk.py +0 -1
  28. akshare/economic/macro_euro.py +103 -56
  29. akshare/economic/macro_germany.py +1 -1
  30. akshare/economic/macro_japan.py +0 -1
  31. akshare/economic/macro_other.py +1 -6
  32. akshare/economic/macro_swiss.py +2 -3
  33. akshare/economic/macro_uk.py +1 -1
  34. akshare/economic/macro_usa.py +0 -2
  35. akshare/energy/energy_carbon.py +0 -1
  36. akshare/energy/energy_oil_em.py +1 -2
  37. akshare/event/cons.py +1 -0
  38. akshare/forex/forex_em.py +0 -1
  39. akshare/fortune/fortune_bloomberg.py +6 -3
  40. akshare/fortune/fortune_forbes_500.py +3 -6
  41. akshare/fortune/fortune_hurun.py +2 -1
  42. akshare/fortune/fortune_xincaifu_500.py +17 -14
  43. akshare/fund/fund_announcement.py +1 -0
  44. akshare/fund/fund_aum_em.py +47 -35
  45. akshare/fund/fund_em.py +0 -7
  46. akshare/fund/fund_etf_em.py +0 -5
  47. akshare/fund/fund_fhsp_em.py +27 -20
  48. akshare/fund/fund_init_em.py +8 -5
  49. akshare/fund/fund_lof_em.py +0 -5
  50. akshare/fund/fund_manager.py +18 -7
  51. akshare/fund/fund_portfolio_em.py +0 -1
  52. akshare/fund/fund_position_lg.py +19 -8
  53. akshare/fund/fund_rank_em.py +0 -3
  54. akshare/fund/fund_rating.py +28 -9
  55. akshare/fund/fund_scale_em.py +24 -13
  56. akshare/futures/futures_comex_em.py +1 -0
  57. akshare/futures/futures_contract_detail.py +11 -8
  58. akshare/futures/futures_inventory_em.py +0 -2
  59. akshare/futures/futures_rule.py +5 -1
  60. akshare/futures/futures_settlement_price_sgx.py +21 -6
  61. akshare/futures/futures_stock_js.py +0 -1
  62. akshare/futures/receipt.py +279 -153
  63. akshare/futures/requests_fun.py +16 -3
  64. akshare/futures_derivative/cons.py +100 -103
  65. akshare/futures_derivative/futures_contract_info_cffex.py +53 -39
  66. akshare/futures_derivative/futures_contract_info_dce.py +16 -9
  67. akshare/futures_derivative/futures_contract_info_gfex.py +43 -31
  68. akshare/futures_derivative/futures_index_sina.py +25 -13
  69. akshare/fx/cons.py +12 -7
  70. akshare/fx/fx_quote.py +1 -0
  71. akshare/fx/fx_quote_baidu.py +2 -1
  72. akshare/hf/__init__.py +1 -1
  73. akshare/hf/hf_sp500.py +8 -7
  74. akshare/index/index_eri.py +1 -0
  75. akshare/index/index_global_em.py +0 -1
  76. akshare/index/index_kq_fz.py +17 -14
  77. akshare/index/index_kq_ss.py +1 -0
  78. akshare/index/index_stock_hk.py +0 -1
  79. akshare/index/index_stock_zh.py +0 -3
  80. akshare/index/index_sugar.py +18 -4
  81. akshare/index/index_zh_em.py +0 -15
  82. akshare/interest_rate/interbank_rate_em.py +0 -1
  83. akshare/movie/jm.js +0 -1
  84. akshare/news/__init__.py +1 -1
  85. akshare/news/news_stock.py +0 -1
  86. akshare/option/option_commodity_sina.py +22 -26
  87. akshare/option/option_daily_stats_sse_szse.py +0 -1
  88. akshare/option/option_em.py +0 -1
  89. akshare/option/option_lhb_em.py +0 -1
  90. akshare/option/option_risk_indicator_sse.py +0 -1
  91. akshare/other/__init__.py +1 -1
  92. akshare/pro/__init__.py +0 -1
  93. akshare/pro/client.py +6 -4
  94. akshare/pro/cons.py +3 -2
  95. akshare/pro/data_pro.py +6 -5
  96. akshare/qhkc/qhkc_api.py +63 -21
  97. akshare/qhkc_web/qhkc_fund.py +1 -0
  98. akshare/qhkc_web/qhkc_index.py +1 -0
  99. akshare/qhkc_web/qhkc_tool.py +55 -54
  100. akshare/rate/__init__.py +1 -1
  101. akshare/rate/repo_rate.py +36 -32
  102. akshare/reits/__init__.py +1 -1
  103. akshare/reits/reits_basic.py +139 -5
  104. akshare/sport/__init__.py +1 -1
  105. akshare/sport/sport_olympic.py +1 -0
  106. akshare/spot/__init__.py +1 -1
  107. akshare/stock/cons.py +19 -12
  108. akshare/stock/stock_board_concept_em.py +0 -6
  109. akshare/stock/stock_board_industry_em.py +0 -6
  110. akshare/stock/stock_dzjy_em.py +1 -1
  111. akshare/stock/stock_fund_em.py +0 -2
  112. akshare/stock/stock_fund_hold.py +1 -2
  113. akshare/stock/stock_gsrl_em.py +1 -0
  114. akshare/stock/stock_hk_famous.py +0 -1
  115. akshare/stock/stock_hk_fhpx_ths.py +2 -1
  116. akshare/stock/stock_hk_hot_rank_em.py +1 -0
  117. akshare/stock/stock_hold_control_em.py +0 -2
  118. akshare/stock/stock_hot_up_em.py +4 -1
  119. akshare/stock/stock_hsgt_em.py +0 -2
  120. akshare/stock/stock_industry.py +1 -0
  121. akshare/stock/stock_info.py +0 -2
  122. akshare/stock/stock_info_em.py +0 -1
  123. akshare/stock/stock_repurchase_em.py +7 -2
  124. akshare/stock/stock_share_hold.py +0 -1
  125. akshare/stock/stock_stop.py +0 -1
  126. akshare/stock/stock_summary.py +0 -2
  127. akshare/stock/stock_us_famous.py +0 -1
  128. akshare/stock/stock_us_js.py +3 -2
  129. akshare/stock/stock_us_pink.py +0 -1
  130. akshare/stock/stock_weibo_nlp.py +18 -20
  131. akshare/stock/stock_zh_a_special.py +0 -3
  132. akshare/stock/stock_zh_a_tick_tx.py +11 -3
  133. akshare/stock_a/stock_board_concept_name_em.py +0 -1
  134. akshare/stock_a/stock_zh_a_spot.py +0 -1
  135. akshare/stock_feature/cons.py +1 -0
  136. akshare/stock_feature/stock_account_em.py +0 -1
  137. akshare/stock_feature/stock_all_pb.py +2 -1
  138. akshare/stock_feature/stock_analyst_em.py +0 -3
  139. akshare/stock_feature/stock_buffett_index_lg.py +7 -6
  140. akshare/stock_feature/stock_classify_sina.py +3 -6
  141. akshare/stock_feature/stock_comment_em.py +0 -2
  142. akshare/stock_feature/stock_congestion_lg.py +2 -1
  143. akshare/stock_feature/stock_dxsyl_em.py +116 -71
  144. akshare/stock_feature/stock_gdzjc_em.py +16 -5
  145. akshare/stock_feature/stock_gxl_lg.py +3 -2
  146. akshare/stock_feature/stock_hist_em.py +0 -20
  147. akshare/stock_feature/stock_hist_tx.py +10 -8
  148. akshare/stock_feature/stock_hot_xq.py +4 -6
  149. akshare/stock_feature/stock_hsgt_em.py +0 -2
  150. akshare/stock_feature/stock_hsgt_exchange_rate.py +0 -2
  151. akshare/stock_feature/stock_hsgt_min_em.py +13 -16
  152. akshare/stock_feature/stock_inner_trade_xq.py +0 -1
  153. akshare/stock_feature/stock_lhb_em.py +0 -1
  154. akshare/stock_feature/stock_margin_em.py +0 -1
  155. akshare/stock_feature/stock_margin_sse.py +0 -2
  156. akshare/stock_feature/stock_pankou_em.py +0 -2
  157. akshare/stock_feature/stock_qsjy_em.py +13 -4
  158. akshare/stock_feature/stock_research_report_em.py +0 -1
  159. akshare/stock_feature/stock_yjyg_cninfo.py +4 -1
  160. akshare/stock_feature/stock_zh_vote_baidu.py +4 -1
  161. akshare/stock_feature/stock_ztb_em.py +0 -6
  162. akshare/stock_fundamental/__init__.py +1 -1
  163. akshare/stock_fundamental/stock_hold.py +26 -17
  164. akshare/stock_fundamental/stock_ipo_declare.py +1 -0
  165. akshare/stock_fundamental/stock_kcb_detail_sse.py +10 -10
  166. akshare/stock_fundamental/stock_kcb_sse.py +26 -25
  167. akshare/stock_fundamental/stock_profit_forecast_hk_etnet.py +64 -41
  168. akshare/stock_fundamental/stock_recommend.py +20 -4
  169. akshare/utils/demjson.py +2005 -1334
  170. akshare/utils/token_process.py +6 -5
  171. {akshare-1.16.63.dist-info → akshare-1.16.65.dist-info}/METADATA +3 -8
  172. {akshare-1.16.63.dist-info → akshare-1.16.65.dist-info}/RECORD +175 -175
  173. {akshare-1.16.63.dist-info → akshare-1.16.65.dist-info}/WHEEL +0 -0
  174. {akshare-1.16.63.dist-info → akshare-1.16.65.dist-info}/licenses/LICENSE +0 -0
  175. {akshare-1.16.63.dist-info → akshare-1.16.65.dist-info}/top_level.txt +0 -0
akshare/fx/cons.py CHANGED
@@ -4,15 +4,20 @@
4
4
  Date: 2019/10/20 10:58
5
5
  Desc: 外汇配置文件
6
6
  """
7
+
7
8
  # headers
8
9
  SHORT_HEADERS = {
9
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36'
10
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36"
10
11
  }
11
12
  # url
12
- FX_SPOT_URL = "http://www.chinamoney.com.cn/r/cms/www/chinamoney/data/fx/rfx-sp-quot.json"
13
- FX_SWAP_URL = "http://www.chinamoney.com.cn/r/cms/www/chinamoney/data/fx/rfx-sw-quot.json"
14
- FX_PAIR_URL = "http://www.chinamoney.com.cn/r/cms/www/chinamoney/data/fx/cpair-quot.json"
13
+ FX_SPOT_URL = (
14
+ "http://www.chinamoney.com.cn/r/cms/www/chinamoney/data/fx/rfx-sp-quot.json"
15
+ )
16
+ FX_SWAP_URL = (
17
+ "http://www.chinamoney.com.cn/r/cms/www/chinamoney/data/fx/rfx-sw-quot.json"
18
+ )
19
+ FX_PAIR_URL = (
20
+ "http://www.chinamoney.com.cn/r/cms/www/chinamoney/data/fx/cpair-quot.json"
21
+ )
15
22
  # payload
16
- SPOT_PAYLOAD = {
17
- "t": {}
18
- }
23
+ SPOT_PAYLOAD = {"t": {}}
akshare/fx/fx_quote.py CHANGED
@@ -7,6 +7,7 @@ Desc: 中国外汇交易中心暨全国银行间同业拆借中心-市场数据-
7
7
  人民币外汇远掉报价: fx_swap_quote
8
8
  外币对即期报价: fx_pair_quote
9
9
  """
10
+
10
11
  import time
11
12
 
12
13
  import pandas as pd
@@ -5,6 +5,7 @@ Date: 2023/3/5 18:12
5
5
  Desc: 百度股市通-外汇-行情榜单
6
6
  https://gushitong.baidu.com/top/foreign-common-%E5%B8%B8%E7%94%A8
7
7
  """
8
+
8
9
  import http.client
9
10
  import json
10
11
  import urllib
@@ -59,7 +60,7 @@ def fx_quote_baidu(symbol: str = "人民币") -> pd.DataFrame:
59
60
  big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"].str.strip("%")) / 100
60
61
  out_df = pd.concat([out_df, big_df], ignore_index=True)
61
62
  num = num + 20
62
- except:
63
+ except: # noqa: E722
63
64
  break
64
65
  return out_df
65
66
 
akshare/hf/__init__.py CHANGED
@@ -2,5 +2,5 @@
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
4
  Date: 2020/4/21 15:33
5
- Desc:
5
+ Desc:
6
6
  """
akshare/hf/hf_sp500.py CHANGED
@@ -7,6 +7,7 @@ https://github.com/FutureSharks/financial-data
7
7
  long history data for S&P 500 index daily
8
8
  http://www.econ.yale.edu/~shiller/data.htm
9
9
  """
10
+
10
11
  import pandas as pd
11
12
 
12
13
 
@@ -21,15 +22,15 @@ def hf_sp_500(year: str = "2017") -> pd.DataFrame:
21
22
  url = f"https://github.com/FutureSharks/financial-data/raw/master/pyfinancialdata/data/stocks/histdata/SPXUSD/DAT_ASCII_SPXUSD_M1_{year}.csv"
22
23
  temp_df = pd.read_table(url, header=None, sep=";")
23
24
  temp_df.columns = ["date", "open", "high", "low", "close", "price"]
24
- temp_df['date'] = pd.to_datetime(temp_df['date']).dt.date
25
- temp_df['open'] = pd.to_numeric(temp_df['open'])
26
- temp_df['high'] = pd.to_numeric(temp_df['high'])
27
- temp_df['low'] = pd.to_numeric(temp_df['low'])
28
- temp_df['close'] = pd.to_numeric(temp_df['close'])
29
- temp_df['price'] = pd.to_numeric(temp_df['price'])
25
+ temp_df["date"] = pd.to_datetime(temp_df["date"]).dt.date
26
+ temp_df["open"] = pd.to_numeric(temp_df["open"])
27
+ temp_df["high"] = pd.to_numeric(temp_df["high"])
28
+ temp_df["low"] = pd.to_numeric(temp_df["low"])
29
+ temp_df["close"] = pd.to_numeric(temp_df["close"])
30
+ temp_df["price"] = pd.to_numeric(temp_df["price"])
30
31
  return temp_df
31
32
 
32
33
 
33
- if __name__ == '__main__':
34
+ if __name__ == "__main__":
34
35
  hf_sp_500_df = hf_sp_500(year="2017")
35
36
  print(hf_sp_500_df)
@@ -5,6 +5,7 @@ Date: 2023/6/19 18:16
5
5
  Desc: 浙江省排污权交易指数
6
6
  https://zs.zjpwq.net/
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
11
 
@@ -39,7 +39,6 @@ def index_global_spot_em() -> pd.DataFrame:
39
39
  "dect": "1",
40
40
  "ut": "fa5fd1943c7b386f172d6893dbfba10b",
41
41
  "wbp2u": "|0|0|0|web",
42
- "_": "1741340608118",
43
42
  }
44
43
  r = requests.get(url=url, params=params)
45
44
  data_json = r.json()
@@ -5,6 +5,7 @@ Date: 2023/5/18 17:10
5
5
  Desc: 中国柯桥纺织指数
6
6
  http://www.kqindex.cn/flzs/jiage
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
11
  from tqdm import tqdm
@@ -31,7 +32,6 @@ def index_kq_fz(symbol: str = "价格指数") -> pd.DataFrame:
31
32
  "end": "",
32
33
  "indexType": f"{symbol_map[symbol]}",
33
34
  "pageindex": "1",
34
- "_": "1619871781413",
35
35
  }
36
36
  r = requests.get(url, params=params)
37
37
  data_json = r.json()
@@ -44,7 +44,6 @@ def index_kq_fz(symbol: str = "价格指数") -> pd.DataFrame:
44
44
  "end": "",
45
45
  "indexType": f"{symbol_map[symbol]}",
46
46
  "pageindex": page,
47
- "_": "1619871781413",
48
47
  }
49
48
  r = requests.get(url, params=params)
50
49
  data_json = r.json()
@@ -56,9 +55,9 @@ def index_kq_fz(symbol: str = "价格指数") -> pd.DataFrame:
56
55
  "指数",
57
56
  "涨跌幅",
58
57
  ]
59
- big_df['期次'] = pd.to_datetime(big_df['期次'])
60
- big_df['指数'] = pd.to_numeric(big_df['指数'], errors='coerce')
61
- big_df['涨跌幅'] = pd.to_numeric(big_df['涨跌幅'], errors='coerce')
58
+ big_df["期次"] = pd.to_datetime(big_df["期次"])
59
+ big_df["指数"] = pd.to_numeric(big_df["指数"], errors="coerce")
60
+ big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"], errors="coerce")
62
61
  elif symbol == "景气指数":
63
62
  big_df.columns = [
64
63
  "期次",
@@ -67,10 +66,10 @@ def index_kq_fz(symbol: str = "价格指数") -> pd.DataFrame:
67
66
  "流通景气指数",
68
67
  "生产景气指数",
69
68
  ]
70
- big_df['总景气指数'] = pd.to_numeric(big_df['总景气指数'], errors='coerce')
71
- big_df['涨跌幅'] = pd.to_numeric(big_df['涨跌幅'], errors='coerce')
72
- big_df['流通景气指数'] = pd.to_numeric(big_df['流通景气指数'], errors='coerce')
73
- big_df['生产景气指数'] = pd.to_numeric(big_df['生产景气指数'], errors='coerce')
69
+ big_df["总景气指数"] = pd.to_numeric(big_df["总景气指数"], errors="coerce")
70
+ big_df["涨跌幅"] = pd.to_numeric(big_df["涨跌幅"], errors="coerce")
71
+ big_df["流通景气指数"] = pd.to_numeric(big_df["流通景气指数"], errors="coerce")
72
+ big_df["生产景气指数"] = pd.to_numeric(big_df["生产景气指数"], errors="coerce")
74
73
  elif symbol == "外贸指数":
75
74
  big_df.columns = [
76
75
  "期次",
@@ -79,11 +78,15 @@ def index_kq_fz(symbol: str = "价格指数") -> pd.DataFrame:
79
78
  "景气指数",
80
79
  "景气指数-涨跌幅",
81
80
  ]
82
- big_df['价格指数'] = pd.to_numeric(big_df['价格指数'], errors='coerce')
83
- big_df['价格指数-涨跌幅'] = pd.to_numeric(big_df['价格指数-涨跌幅'], errors='coerce')
84
- big_df['景气指数'] = pd.to_numeric(big_df['景气指数'], errors='coerce')
85
- big_df['景气指数-涨跌幅'] = pd.to_numeric(big_df['景气指数-涨跌幅'], errors='coerce')
86
- big_df.sort_values(['期次'], inplace=True, ignore_index=True)
81
+ big_df["价格指数"] = pd.to_numeric(big_df["价格指数"], errors="coerce")
82
+ big_df["价格指数-涨跌幅"] = pd.to_numeric(
83
+ big_df["价格指数-涨跌幅"], errors="coerce"
84
+ )
85
+ big_df["景气指数"] = pd.to_numeric(big_df["景气指数"], errors="coerce")
86
+ big_df["景气指数-涨跌幅"] = pd.to_numeric(
87
+ big_df["景气指数-涨跌幅"], errors="coerce"
88
+ )
89
+ big_df.sort_values(["期次"], inplace=True, ignore_index=True)
87
90
  return big_df
88
91
 
89
92
 
@@ -5,6 +5,7 @@ Date: 2023/6/13 22:05
5
5
  Desc: 柯桥时尚指数
6
6
  http://ss.kqindex.cn:9559/rinder_web_kqsszs/index/index_page.do
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
11
 
@@ -166,7 +166,6 @@ def stock_hk_index_spot_em() -> pd.DataFrame:
166
166
  "fs": "m:124,m:125,m:305",
167
167
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,"
168
168
  "f26,f22,f33,f11,f62,f128,f136,f115,f152",
169
- "_": "1683800547682",
170
169
  }
171
170
  temp_df = fetch_paginated_data(url, params)
172
171
  temp_df.rename(
@@ -148,7 +148,6 @@ def __stock_zh_main_spot_em() -> pd.DataFrame:
148
148
  "fs": "b:MK0010",
149
149
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,"
150
150
  "f23,f24,f25,f26,f22,f11,f62,f128,f136,f115,f152",
151
- "_": "1704327268532",
152
151
  }
153
152
  r = requests.get(url, params=params)
154
153
  data_json = r.json()
@@ -238,7 +237,6 @@ def stock_zh_index_spot_em(symbol: str = "上证系列指数") -> pd.DataFrame:
238
237
  "fs": symbol_map[symbol],
239
238
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,"
240
239
  "f26,f22,f33,f11,f62,f128,f136,f115,f152",
241
- "_": "1704327268532",
242
240
  }
243
241
  temp_df = fetch_paginated_data(url, params)
244
242
  temp_df.rename(
@@ -439,7 +437,6 @@ def stock_zh_index_daily_em(
439
437
  "fqt": "0",
440
438
  "beg": start_date,
441
439
  "end": end_date,
442
- "_": "1596700547039",
443
440
  }
444
441
  r = requests.get(url, params=params)
445
442
  data_text = r.text
@@ -5,6 +5,7 @@ Date: 2023/6/19 17:00
5
5
  Desc: 沐甜科技数据中心-中国食糖指数
6
6
  https://www.msweet.com.cn/mtkj/sjzx13/index.html
7
7
  """
8
+
8
9
  import requests
9
10
  import pandas as pd
10
11
 
@@ -93,12 +94,25 @@ def index_outer_quote_sugar_msweet() -> pd.DataFrame:
93
94
  temp_df = pd.concat(
94
95
  [pd.DataFrame(data_json["category"]), pd.DataFrame(data_json["data"])], axis=1
95
96
  )
96
- temp_df.columns = ["日期", "巴西糖进口成本", "泰国糖进口利润空间", "巴西糖进口利润空间", "泰国糖进口成本", "日照现货价"]
97
+ temp_df.columns = [
98
+ "日期",
99
+ "巴西糖进口成本",
100
+ "泰国糖进口利润空间",
101
+ "巴西糖进口利润空间",
102
+ "泰国糖进口成本",
103
+ "日照现货价",
104
+ ]
97
105
  temp_df["日期"] = temp_df["日期"].str.replace("/", "-")
98
106
  temp_df["日期"] = pd.to_datetime(temp_df["日期"], errors="coerce").dt.date
99
- temp_df["巴西糖进口成本"] = pd.to_numeric(temp_df["巴西糖进口成本"], errors="coerce")
100
- temp_df["泰国糖进口利润空间"] = pd.to_numeric(temp_df["泰国糖进口利润空间"], errors="coerce")
101
- temp_df["巴西糖进口利润空间"] = pd.to_numeric(temp_df["巴西糖进口利润空间"], errors="coerce")
107
+ temp_df["巴西糖进口成本"] = pd.to_numeric(
108
+ temp_df["巴西糖进口成本"], errors="coerce"
109
+ )
110
+ temp_df["泰国糖进口利润空间"] = pd.to_numeric(
111
+ temp_df["泰国糖进口利润空间"], errors="coerce"
112
+ )
113
+ temp_df["巴西糖进口利润空间"] = pd.to_numeric(
114
+ temp_df["巴西糖进口利润空间"], errors="coerce"
115
+ )
102
116
  temp_df["泰国糖进口成本"] = pd.to_numeric(temp_df["泰国糖进口成本"])
103
117
  temp_df["日照现货价"] = pd.to_numeric(temp_df["日照现货价"], errors="coerce")
104
118
  return temp_df
@@ -33,7 +33,6 @@ def index_code_id_map_em() -> dict:
33
33
  "fid": "f3",
34
34
  "fs": "b:MK0010,m:1+t:1,m:0 t:5,m:1+s:3,m:0+t:5,m:2",
35
35
  "fields": "f3,f12,f13",
36
- "_": "1623833739532",
37
36
  }
38
37
  temp_df = fetch_paginated_data(url, params)
39
38
  code_id_dict = dict(zip(temp_df["f12"], temp_df["f13"]))
@@ -73,7 +72,6 @@ def index_zh_a_hist(
73
72
  "fqt": "0",
74
73
  "beg": "0",
75
74
  "end": "20500000",
76
- "_": "1623766962675",
77
75
  }
78
76
  except KeyError:
79
77
  params = {
@@ -85,7 +83,6 @@ def index_zh_a_hist(
85
83
  "fqt": "0",
86
84
  "beg": "0",
87
85
  "end": "20500000",
88
- "_": "1623766962675",
89
86
  }
90
87
  r = requests.get(url, params=params)
91
88
  data_json = r.json()
@@ -99,7 +96,6 @@ def index_zh_a_hist(
99
96
  "fqt": "0",
100
97
  "beg": "0",
101
98
  "end": "20500000",
102
- "_": "1623766962675",
103
99
  }
104
100
  r = requests.get(url, params=params)
105
101
  data_json = r.json()
@@ -113,7 +109,6 @@ def index_zh_a_hist(
113
109
  "fqt": "0",
114
110
  "beg": "0",
115
111
  "end": "20500000",
116
- "_": "1623766962675",
117
112
  }
118
113
  r = requests.get(url, params=params)
119
114
  data_json = r.json()
@@ -127,7 +122,6 @@ def index_zh_a_hist(
127
122
  "fqt": "0",
128
123
  "beg": "0",
129
124
  "end": "20500000",
130
- "_": "1623766962675",
131
125
  }
132
126
  r = requests.get(url, params=params)
133
127
  data_json = r.json()
@@ -146,7 +140,6 @@ def index_zh_a_hist(
146
140
  "fqt": "0",
147
141
  "beg": "0",
148
142
  "end": "20500000",
149
- "_": "1623766962675",
150
143
  }
151
144
  r = requests.get(url, params=params)
152
145
  data_json = r.json()
@@ -213,7 +206,6 @@ def index_zh_a_hist_min_em(
213
206
  "iscr": "0",
214
207
  "ndays": "5",
215
208
  "secid": f"{code_id_dict[symbol]}.{symbol}",
216
- "_": "1623766962675",
217
209
  }
218
210
  except KeyError:
219
211
  params = {
@@ -223,7 +215,6 @@ def index_zh_a_hist_min_em(
223
215
  "iscr": "0",
224
216
  "ndays": "5",
225
217
  "secid": f"1.{symbol}",
226
- "_": "1623766962675",
227
218
  }
228
219
  r = requests.get(url, params=params)
229
220
  data_json = r.json()
@@ -235,7 +226,6 @@ def index_zh_a_hist_min_em(
235
226
  "iscr": "0",
236
227
  "ndays": "5",
237
228
  "secid": f"0.{symbol}",
238
- "_": "1623766962675",
239
229
  }
240
230
  r = requests.get(url, params=params)
241
231
  data_json = r.json()
@@ -247,7 +237,6 @@ def index_zh_a_hist_min_em(
247
237
  "iscr": "0",
248
238
  "ndays": "5",
249
239
  "secid": f"47.{symbol}",
250
- "_": "1623766962675",
251
240
  }
252
241
  r = requests.get(url, params=params)
253
242
  data_json = r.json()
@@ -288,7 +277,6 @@ def index_zh_a_hist_min_em(
288
277
  "fqt": "1",
289
278
  "beg": "0",
290
279
  "end": "20500000",
291
- "_": "1630930917857",
292
280
  }
293
281
  except: # noqa: E722
294
282
  params = {
@@ -300,7 +288,6 @@ def index_zh_a_hist_min_em(
300
288
  "fqt": "1",
301
289
  "beg": "0",
302
290
  "end": "20500000",
303
- "_": "1630930917857",
304
291
  }
305
292
  r = requests.get(url, params=params)
306
293
  data_json = r.json()
@@ -314,7 +301,6 @@ def index_zh_a_hist_min_em(
314
301
  "fqt": "1",
315
302
  "beg": "0",
316
303
  "end": "20500000",
317
- "_": "1630930917857",
318
304
  }
319
305
  r = requests.get(url, params=params)
320
306
  data_json = r.json()
@@ -328,7 +314,6 @@ def index_zh_a_hist_min_em(
328
314
  "fqt": "1",
329
315
  "beg": "0",
330
316
  "end": "20500000",
331
- "_": "1630930917857",
332
317
  }
333
318
  r = requests.get(url, params=params)
334
319
  data_json = r.json()
@@ -85,7 +85,6 @@ def rate_interbank(
85
85
  "p": "1",
86
86
  "pageNo": "1",
87
87
  "pageNum": "1",
88
- "_": "1653376974939",
89
88
  }
90
89
  r = requests.get(url, params=params)
91
90
  data_json = r.json()
akshare/movie/jm.js CHANGED
@@ -2254,4 +2254,3 @@ var webDES = function() {
2254
2254
  ;
2255
2255
  }
2256
2256
  , webInstace = new webDES();
2257
-
akshare/news/__init__.py CHANGED
@@ -2,5 +2,5 @@
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
4
  Date: 2020/10/18 12:54
5
- Desc:
5
+ Desc:
6
6
  """
@@ -29,7 +29,6 @@ def stock_news_em(symbol: str = "300059") -> pd.DataFrame:
29
29
  + ',"type":["cmsArticleWebOld"],"client":"web","clientType":"web","clientVersion":"curr",'
30
30
  '"param":{"cmsArticleWebOld":{"searchScope":"default","sort":"default","pageIndex":1,'
31
31
  '"pageSize":100,"preTag":"<em>","postTag":"</em>"}}}',
32
- "_": "1668256937996",
33
32
  }
34
33
  r = requests.get(url, params=params)
35
34
  data_text = r.text
@@ -5,6 +5,7 @@ Date: 2022/1/23 10:21
5
5
  Desc: 新浪财经-商品期权
6
6
  https://stock.finance.sina.com.cn/futures/view/optionsDP.php
7
7
  """
8
+
8
9
  import pandas as pd
9
10
  import requests
10
11
  from bs4 import BeautifulSoup
@@ -21,9 +22,7 @@ def option_commodity_contract_sina(symbol: str = "玉米期权") -> pd.DataFrame
21
22
  :return: e.g., {'黄金期权': ['au2012', 'au2008', 'au2010', 'au2104', 'au2102', 'au2106', 'au2108']}
22
23
  :rtype: dict
23
24
  """
24
- url = (
25
- "https://stock.finance.sina.com.cn/futures/view/optionsDP.php/pg_o/dce"
26
- )
25
+ url = "https://stock.finance.sina.com.cn/futures/view/optionsDP.php/pg_o/dce"
27
26
  r = requests.get(url)
28
27
  soup = BeautifulSoup(r.text, "lxml")
29
28
  url_list = [
@@ -36,20 +35,15 @@ def option_commodity_contract_sina(symbol: str = "玉米期权") -> pd.DataFrame
36
35
  for item in soup.find_all("li", attrs={"class": "active"})
37
36
  if item.find("a") is not None
38
37
  ]
39
- comm_list_dict = {
40
- key: value for key, value in zip(commodity_list, url_list)
41
- }
38
+ comm_list_dict = {key: value for key, value in zip(commodity_list, url_list)}
42
39
  url = "https://stock.finance.sina.com.cn" + comm_list_dict[symbol]
43
40
  r = requests.get(url)
44
41
  soup = BeautifulSoup(r.text, "lxml")
45
42
  symbol = (
46
- soup.find(attrs={"id": "option_symbol"})
47
- .find(attrs={"class": "selected"})
48
- .text
43
+ soup.find(attrs={"id": "option_symbol"}).find(attrs={"class": "selected"}).text
49
44
  )
50
45
  contract = [
51
- item.text
52
- for item in soup.find(attrs={"id": "option_suffix"}).find_all("li")
46
+ item.text for item in soup.find(attrs={"id": "option_suffix"}).find_all("li")
53
47
  ]
54
48
  temp_df = pd.DataFrame({symbol: contract})
55
49
  temp_df.reset_index(inplace=True)
@@ -71,9 +65,7 @@ def option_commodity_contract_table_sina(
71
65
  :return: 合约实时行情
72
66
  :rtype: pandas.DataFrame
73
67
  """
74
- url = (
75
- "https://stock.finance.sina.com.cn/futures/view/optionsDP.php/pg_o/dce"
76
- )
68
+ url = "https://stock.finance.sina.com.cn/futures/view/optionsDP.php/pg_o/dce"
77
69
  r = requests.get(url)
78
70
  soup = BeautifulSoup(r.text, "lxml")
79
71
  url_list = [
@@ -86,9 +78,7 @@ def option_commodity_contract_table_sina(
86
78
  for item in soup.find_all("li", attrs={"class": "active"})
87
79
  if item.find("a") is not None
88
80
  ]
89
- comm_list_dict = {
90
- key: value for key, value in zip(commodity_list, url_list)
91
- }
81
+ comm_list_dict = {key: value for key, value in zip(commodity_list, url_list)}
92
82
  url = "https://stock.finance.sina.com.cn/futures/api/openapi.php/OptionService.getOptionData"
93
83
  params = {
94
84
  "type": "futures",
@@ -122,18 +112,26 @@ def option_commodity_contract_table_sina(
122
112
  ]
123
113
  temp_df["看涨合约-买量"] = pd.to_numeric(temp_df["看涨合约-买量"], errors="coerce")
124
114
  temp_df["看涨合约-买价"] = pd.to_numeric(temp_df["看涨合约-买价"], errors="coerce")
125
- temp_df["看涨合约-最新价"] = pd.to_numeric(temp_df["看涨合约-最新价"], errors="coerce")
115
+ temp_df["看涨合约-最新价"] = pd.to_numeric(
116
+ temp_df["看涨合约-最新价"], errors="coerce"
117
+ )
126
118
  temp_df["看涨合约-卖价"] = pd.to_numeric(temp_df["看涨合约-卖价"], errors="coerce")
127
119
  temp_df["看涨合约-卖量"] = pd.to_numeric(temp_df["看涨合约-卖量"], errors="coerce")
128
- temp_df["看涨合约-持仓量"] = pd.to_numeric(temp_df["看涨合约-持仓量"], errors="coerce")
120
+ temp_df["看涨合约-持仓量"] = pd.to_numeric(
121
+ temp_df["看涨合约-持仓量"], errors="coerce"
122
+ )
129
123
  temp_df["看涨合约-涨跌"] = pd.to_numeric(temp_df["看涨合约-涨跌"], errors="coerce")
130
124
  temp_df["行权价"] = pd.to_numeric(temp_df["行权价"], errors="coerce")
131
125
  temp_df["看跌合约-买量"] = pd.to_numeric(temp_df["看跌合约-买量"], errors="coerce")
132
126
  temp_df["看跌合约-买价"] = pd.to_numeric(temp_df["看跌合约-买价"], errors="coerce")
133
- temp_df["看跌合约-最新价"] = pd.to_numeric(temp_df["看跌合约-最新价"], errors="coerce")
127
+ temp_df["看跌合约-最新价"] = pd.to_numeric(
128
+ temp_df["看跌合约-最新价"], errors="coerce"
129
+ )
134
130
  temp_df["看跌合约-卖价"] = pd.to_numeric(temp_df["看跌合约-卖价"], errors="coerce")
135
131
  temp_df["看跌合约-卖量"] = pd.to_numeric(temp_df["看跌合约-卖量"], errors="coerce")
136
- temp_df["看跌合约-持仓量"] = pd.to_numeric(temp_df["看跌合约-持仓量"], errors="coerce")
132
+ temp_df["看跌合约-持仓量"] = pd.to_numeric(
133
+ temp_df["看跌合约-持仓量"], errors="coerce"
134
+ )
137
135
  temp_df["看跌合约-涨跌"] = pd.to_numeric(temp_df["看跌合约-涨跌"], errors="coerce")
138
136
  return temp_df
139
137
 
@@ -170,12 +168,10 @@ if __name__ == "__main__":
170
168
  )
171
169
  print(option_commodity_contract_sina_df)
172
170
 
173
- option_commodity_contract_table_sina_df = (
174
- option_commodity_contract_table_sina(symbol="棉花期权", contract="cf2301")
171
+ option_commodity_contract_table_sina_df = option_commodity_contract_table_sina(
172
+ symbol="棉花期权", contract="cf2301"
175
173
  )
176
174
  print(option_commodity_contract_table_sina_df)
177
175
 
178
- option_commodity_hist_sina_df = option_commodity_hist_sina(
179
- symbol="cf2301P21600"
180
- )
176
+ option_commodity_hist_sina_df = option_commodity_hist_sina(symbol="cf2301P21600")
181
177
  print(option_commodity_hist_sina_df)
@@ -26,7 +26,6 @@ def option_daily_stats_sse(date: str = "20240626") -> pd.DataFrame:
26
26
  "isPagination": "false",
27
27
  "sqlId": "COMMON_SSE_ZQPZ_YSP_QQ_SJTJ_MRTJ_CX",
28
28
  "tradeDate": date,
29
- "_": "1652877575590",
30
29
  }
31
30
  headers = {
32
31
  "Accept": "*/*",
@@ -31,7 +31,6 @@ def option_current_em() -> pd.DataFrame:
31
31
  "fs": "m:10,m:12,m:140,m:141,m:151,m:163,m:226",
32
32
  "fields": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,"
33
33
  "f23,f24,f25,f22,f28,f11,f62,f128,f136,f115,f152,f133,f108,f163,f161,f162",
34
- "_": "1606225274063",
35
34
  }
36
35
  temp_df = fetch_paginated_data(url=url, base_params=params)
37
36
  temp_df.columns = [
@@ -38,7 +38,6 @@ def option_lhb_em(
38
38
  "source": "IFBILLBOARD",
39
39
  "client": "WEB",
40
40
  "ut": "b2884a393a59ad64002292a3e90d46a5",
41
- "_": "1642904215146",
42
41
  }
43
42
  r = requests.get(url, params=params)
44
43
  data_json = r.json()
@@ -24,7 +24,6 @@ def option_risk_indicator_sse(date: str = "20240626") -> pd.DataFrame:
24
24
  "trade_date": date,
25
25
  "sqlId": "SSE_ZQPZ_YSP_GGQQZSXT_YSHQ_QQFXZB_DATE_L",
26
26
  "contractSymbol": "",
27
- "_": "1652877575590",
28
27
  }
29
28
  headers = {
30
29
  "Accept": "*/*",
akshare/other/__init__.py CHANGED
@@ -2,5 +2,5 @@
2
2
  # -*- coding:utf-8 -*-
3
3
  """
4
4
  Date: 2021/5/14 17:52
5
- Desc:
5
+ Desc:
6
6
  """
akshare/pro/__init__.py CHANGED
@@ -1 +0,0 @@
1
-
akshare/pro/client.py CHANGED
@@ -4,6 +4,7 @@
4
4
  Date: 2019/11/10 22:52
5
5
  Desc: 数据接口源代码
6
6
  """
7
+
7
8
  from functools import partial
8
9
  from urllib import parse
9
10
 
@@ -12,7 +13,6 @@ import requests
12
13
 
13
14
 
14
15
  class DataApi:
15
-
16
16
  __token = ""
17
17
  __http_url = "https://api.qhkch.com"
18
18
 
@@ -49,8 +49,10 @@ class DataApi:
49
49
  if fields == "":
50
50
  try:
51
51
  return pd.DataFrame(data_json)
52
- except ValueError as e:
53
- result_df = pd.DataFrame.from_dict(data_json, orient="index", columns=[api_name])
52
+ except ValueError:
53
+ result_df = pd.DataFrame.from_dict(
54
+ data_json, orient="index", columns=[api_name]
55
+ )
54
56
  return result_df
55
57
  else: # 此处增加处理
56
58
  if api_name == "variety_all_positions":
@@ -68,5 +70,5 @@ class DataApi:
68
70
  return partial(self.query, name)
69
71
 
70
72
 
71
- if __name__ == '__main__':
73
+ if __name__ == "__main__":
72
74
  pass
akshare/pro/cons.py CHANGED
@@ -4,5 +4,6 @@
4
4
  Date: 2020/12/24 16:28
5
5
  Desc: API常量文件
6
6
  """
7
- TOKEN_F_P = 'tk.csv'
8
- TOKEN_ERR_MSG = '请设置 AKShare pro 的 token 凭证码,如果没有权限,请访问 https://qhkch.com/ 注册申请'
7
+
8
+ TOKEN_F_P = "tk.csv"
9
+ TOKEN_ERR_MSG = "请设置 AKShare pro 的 token 凭证码,如果没有权限,请访问 https://qhkch.com/ 注册申请"