Skip to content

Commit

Permalink
fix: fix stock_zh_a_hist_min_em
Browse files Browse the repository at this point in the history
  • Loading branch information
albertandking committed Mar 20, 2024
1 parent c2f3ac1 commit 1b3566c
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 32 deletions.
12 changes: 8 additions & 4 deletions akshare/stock_feature/stock_hist_em.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ def stock_zh_a_hist_min_em(
"最低",
"成交量",
"成交额",
"最新价",
"均价",
]
temp_df.index = pd.to_datetime(temp_df["时间"])
temp_df = temp_df[start_date:end_date]
Expand All @@ -1141,7 +1141,7 @@ def stock_zh_a_hist_min_em(
temp_df["最低"] = pd.to_numeric(temp_df["最低"], errors="coerce")
temp_df["成交量"] = pd.to_numeric(temp_df["成交量"], errors="coerce")
temp_df["成交额"] = pd.to_numeric(temp_df["成交额"], errors="coerce")
temp_df["最新价"] = pd.to_numeric(temp_df["最新价"], errors="coerce")
temp_df["均价"] = pd.to_numeric(temp_df["均价"], errors="coerce")
temp_df["时间"] = pd.to_datetime(temp_df["时间"]).astype(str)
return temp_df
else:
Expand Down Expand Up @@ -1915,7 +1915,7 @@ def stock_us_hist_min_em(
)
print(stock_zh_a_hist_df)

stock_zh_a_hist_min_em_df = stock_zh_a_hist_min_em(symbol="833454", period="1")
stock_zh_a_hist_min_em_df = stock_zh_a_hist_min_em(symbol="603777", period="1")
print(stock_zh_a_hist_min_em_df)

stock_zh_a_hist_pre_min_em_df = stock_zh_a_hist_pre_min_em(symbol="000001")
Expand Down Expand Up @@ -1973,7 +1973,11 @@ def stock_us_hist_min_em(
print(stock_us_hist_min_em_df)

stock_zh_a_hist_min_em_df = stock_zh_a_hist_min_em(
symbol="000001", period="5", adjust="qfq"
symbol="000001",
start_date="2024-03-20 09:30:00",
end_date="2024-03-20 15:00:00",
period="5",
adjust="hfq",
)
print(stock_zh_a_hist_min_em_df)

Expand Down
95 changes: 67 additions & 28 deletions docs/data/stock/stock.md
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,7 @@ print(stock_zh_a_minute_df)

接口: stock_zh_a_hist_min_em

目标地址: http://quote.eastmoney.com/concept/sh603777.html?from=classic
目标地址: http://quote.eastmoney.com/concept/sh603777.html

描述: 东方财富网-行情首页-沪深京 A 股-每日分时行情; 该接口只能获取近期的分时数据,注意时间周期的设置

Expand All @@ -1668,33 +1668,34 @@ print(stock_zh_a_minute_df)
| 最低 | float64 | - |
| 成交量 | float64 | 注意单位: 手 |
| 成交额 | float64 | - |
| 最新价 | float64 | - |
| 均价 | float64 | - |

接口示例-1分钟数据

```python
import akshare as ak

# 注意:该接口返回的数据只有最近一个交易日的有开盘价,其他日期开盘价为 0
stock_zh_a_hist_min_em_df = ak.stock_zh_a_hist_min_em(symbol="000001", start_date="2021-09-01 09:32:00", end_date="2021-09-06 09:32:00", period='1', adjust='')
stock_zh_a_hist_min_em_df = ak.stock_zh_a_hist_min_em(symbol="000001", start_date="2024-03-20 09:30:00", end_date="2024-03-20 15:00:00", period="1", adjust="")
print(stock_zh_a_hist_min_em_df)
```

数据示例-1分钟数据

```
时间 开盘 收盘 ... 成交量 成交额 最新价
0 2021-08-31 09:30:00 0.00 17.72 ... 5905 10463660.0 17.720
1 2021-08-31 09:31:00 0.00 17.65 ... 18454 32576004.0 17.669
2 2021-08-31 09:32:00 0.00 17.70 ... 14085 24864945.0 17.663
3 2021-08-31 09:33:00 0.00 17.68 ... 11138 19719604.0 17.673
4 2021-08-31 09:34:00 0.00 17.77 ... 14392 25513573.0 17.685
... ... ... ... ... ... ...
1200 2021-09-06 14:56:00 18.46 18.46 ... 4564 8424252.0 18.348
1201 2021-09-06 14:57:00 18.45 18.45 ... 7414 13681401.0 18.348
1202 2021-09-06 14:58:00 18.45 18.45 ... 69 127274.0 18.348
1203 2021-09-06 14:59:00 18.45 18.45 ... 0 0.0 18.348
1204 2021-09-06 15:00:00 18.45 18.45 ... 11541 21293052.0 18.349
时间 开盘 收盘 最高 最低 成交量 成交额 均价
0 2024-03-20 09:30:00 10.38 10.38 10.38 10.38 7174 7446612.0 10.380
1 2024-03-20 09:31:00 10.38 10.40 10.40 10.38 12967 13471486.0 10.386
2 2024-03-20 09:32:00 10.40 10.41 10.41 10.39 10409 10824353.0 10.390
3 2024-03-20 09:33:00 10.41 10.41 10.41 10.40 4896 5095656.0 10.393
4 2024-03-20 09:34:00 10.40 10.39 10.41 10.39 7060 7341787.0 10.394
.. ... ... ... ... ... ... ... ...
236 2024-03-20 14:56:00 10.44 10.44 10.45 10.44 2646 2762914.0 10.431
237 2024-03-20 14:57:00 10.44 10.44 10.45 10.44 7613 7951367.0 10.431
238 2024-03-20 14:58:00 10.45 10.45 10.45 10.45 110 114850.0 10.431
239 2024-03-20 14:59:00 10.45 10.45 10.45 10.45 0 0.0 10.431
240 2024-03-20 15:00:00 10.45 10.45 10.45 10.45 13079 13667555.0 10.431
[241 rows x 8 columns]
```

输出参数-其他
Expand All @@ -1718,25 +1719,63 @@ print(stock_zh_a_hist_min_em_df)
```python
import akshare as ak

stock_zh_a_hist_min_em_df = ak.stock_zh_a_hist_min_em(symbol="000001", start_date="2021-09-01 09:32:00", end_date="2021-09-06 09:32:00", period='5', adjust='hfq')
stock_zh_a_hist_min_em_df = ak.stock_zh_a_hist_min_em(symbol="000001", start_date="2024-03-20 09:30:00", end_date="2024-03-20 15:00:00", period="5", adjust="hfq")
print(stock_zh_a_hist_min_em_df)
```

数据示例-其他

```
时间 开盘 收盘 ... 成交额 振幅 换手率
0 2021-09-01 09:35:00 3009.83 2977.32 ... 248855522.0 2.97 0.07
1 2021-09-01 09:40:00 2980.57 2959.45 ... 242051722.0 0.87 0.07
2 2021-09-01 09:45:00 2957.82 2972.45 ... 140232924.0 0.99 0.04
3 2021-09-01 09:50:00 2974.07 3013.08 ... 174011168.0 1.59 0.05
4 2021-09-01 09:55:00 3013.08 2969.20 ... 110244839.0 1.56 0.03
.. ... ... ... ... ... ... ...
139 2021-09-03 14:40:00 3107.35 3104.09 ... 34871309.0 0.16 0.01
140 2021-09-03 14:45:00 3104.09 3107.35 ... 41341513.0 0.21 0.01
141 2021-09-03 14:50:00 3107.35 3112.22 ... 35413634.0 0.21 0.01
142 2021-09-03 14:55:00 3112.22 3104.09 ... 55853775.0 0.37 0.02
143 2021-09-03 15:00:00 3104.09 3100.84 ... 45082686.0 0.16 0.01
时间 开盘 收盘 ... 成交额 振幅 换手率
0 2024-03-20 09:35:00 1939.26 1940.89 ... 53652034.0 0.25 0.03
1 2024-03-20 09:40:00 1939.26 1940.89 ... 27557310.0 0.17 0.01
2 2024-03-20 09:45:00 1939.26 1939.26 ... 11556035.0 0.08 0.01
3 2024-03-20 09:50:00 1940.89 1945.76 ... 27377765.0 0.42 0.01
4 2024-03-20 09:55:00 1947.39 1944.14 ... 37867949.0 0.17 0.02
5 2024-03-20 10:00:00 1945.76 1947.39 ... 27334901.0 0.25 0.01
6 2024-03-20 10:05:00 1945.76 1945.76 ... 14407157.0 0.17 0.01
7 2024-03-20 10:10:00 1944.14 1950.64 ... 46100711.0 0.33 0.02
8 2024-03-20 10:15:00 1950.64 1949.01 ... 35531670.0 0.25 0.02
9 2024-03-20 10:20:00 1949.01 1945.76 ... 20072949.0 0.17 0.01
10 2024-03-20 10:25:00 1947.39 1945.76 ... 11039368.0 0.17 0.01
11 2024-03-20 10:30:00 1945.76 1942.51 ... 29766381.0 0.17 0.01
12 2024-03-20 10:35:00 1942.51 1942.51 ... 9093103.0 0.08 0.00
13 2024-03-20 10:40:00 1944.14 1944.14 ... 9585217.0 0.17 0.00
14 2024-03-20 10:45:00 1944.14 1944.14 ... 9546537.0 0.17 0.00
15 2024-03-20 10:50:00 1944.14 1945.76 ... 9917328.0 0.08 0.00
16 2024-03-20 10:55:00 1945.76 1942.51 ... 10891142.0 0.17 0.01
17 2024-03-20 11:00:00 1944.14 1944.14 ... 7600144.0 0.08 0.00
18 2024-03-20 11:05:00 1944.14 1944.14 ... 7900327.0 0.17 0.00
19 2024-03-20 11:10:00 1942.51 1944.14 ... 7612710.0 0.08 0.00
20 2024-03-20 11:15:00 1942.51 1949.01 ... 47061728.0 0.42 0.02
21 2024-03-20 11:20:00 1950.64 1947.39 ... 19120650.0 0.25 0.01
22 2024-03-20 11:25:00 1947.39 1952.26 ... 58101226.0 0.33 0.03
23 2024-03-20 11:30:00 1953.89 1952.26 ... 36299314.0 0.17 0.02
24 2024-03-20 13:05:00 1952.26 1950.64 ... 49781778.0 0.33 0.02
25 2024-03-20 13:10:00 1950.64 1949.01 ... 25451905.0 0.25 0.01
26 2024-03-20 13:15:00 1949.01 1949.01 ... 17763129.0 0.17 0.01
27 2024-03-20 13:20:00 1949.01 1950.64 ... 17839258.0 0.17 0.01
28 2024-03-20 13:25:00 1949.01 1950.64 ... 13335325.0 0.17 0.01
29 2024-03-20 13:30:00 1950.64 1949.01 ... 5756958.0 0.08 0.00
30 2024-03-20 13:35:00 1949.01 1950.64 ... 4852792.0 0.08 0.00
31 2024-03-20 13:40:00 1950.64 1950.64 ... 16137370.0 0.17 0.01
32 2024-03-20 13:45:00 1949.01 1949.01 ... 4450010.0 0.08 0.00
33 2024-03-20 13:50:00 1949.01 1950.64 ... 4778321.0 0.08 0.00
34 2024-03-20 13:55:00 1949.01 1949.01 ... 12025904.0 0.17 0.01
35 2024-03-20 14:00:00 1947.39 1949.01 ... 3459610.0 0.08 0.00
36 2024-03-20 14:05:00 1947.39 1949.01 ... 7610675.0 0.17 0.00
37 2024-03-20 14:10:00 1950.64 1950.64 ... 13966439.0 0.17 0.01
38 2024-03-20 14:15:00 1950.64 1952.26 ... 5955098.0 0.08 0.00
39 2024-03-20 14:20:00 1950.64 1950.64 ... 17385018.0 0.17 0.01
40 2024-03-20 14:25:00 1949.01 1950.64 ... 4410047.0 0.08 0.00
41 2024-03-20 14:30:00 1950.64 1947.39 ... 14639483.0 0.17 0.01
42 2024-03-20 14:35:00 1949.01 1947.39 ... 13156283.0 0.08 0.01
43 2024-03-20 14:40:00 1949.01 1949.01 ... 12261331.0 0.08 0.01
44 2024-03-20 14:45:00 1949.01 1950.64 ... 10861743.0 0.08 0.01
45 2024-03-20 14:50:00 1949.01 1950.64 ... 22807259.0 0.17 0.01
46 2024-03-20 14:55:00 1950.64 1949.01 ... 12102477.0 0.08 0.01
47 2024-03-20 15:00:00 1949.01 1950.64 ... 24496686.0 0.08 0.01
[48 rows x 11 columns]
```

##### 日内分时数据-东财
Expand Down

0 comments on commit 1b3566c

Please sign in to comment.