Skip to content

Commit

Permalink
Dev (#4045)
Browse files Browse the repository at this point in the history
* Add timeout param to stock_individual_info_em function (#4042)

* Add timeout param to stock_individual_info_em function

* change update date

* add version

* fix stock_bid_ask_em

---------

Co-authored-by: Peter Lei <[email protected]>
  • Loading branch information
albertandking and hy-lei authored Aug 11, 2023
1 parent 9179d06 commit 527fed8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
3 changes: 2 additions & 1 deletion akshare/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2495,9 +2495,10 @@
1.10.78 fix: fix get_cffex_rank_table interface
1.10.79 add: add stock_hold_management_detail_em interface
1.10.80 fix: fix macro_china_gyzjz interface
1.10.81 fix: fix stock_bid_ask_em interface
"""

__version__ = "1.10.80"
__version__ = "1.10.81"
__author__ = "AKFamily"

import sys
Expand Down
10 changes: 6 additions & 4 deletions akshare/stock/stock_info_em.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding:utf-8 -*-
# !/usr/bin/env python
"""
Date: 2022/4/19 20:21
Date: 2023/8/11 11:44
Desc: 东方财富网-个股-股票信息
https://quote.eastmoney.com/concept/sh603777.html?from=classic
"""
Expand All @@ -11,12 +11,14 @@
from akshare.stock_feature.stock_hist_em import code_id_map_em


def stock_individual_info_em(symbol: str = "603777") -> pd.DataFrame:
def stock_individual_info_em(symbol: str = "603777", timeout: float = None) -> pd.DataFrame:
"""
东方财富-个股-股票信息
https://quote.eastmoney.com/concept/sh603777.html?from=classic
:param symbol: 股票代码
:type symbol: str
:param timeout: choice of None or a positive float number
:type timeout: float
:return: 股票信息
:rtype: pandas.DataFrame
"""
Expand All @@ -30,7 +32,7 @@ def stock_individual_info_em(symbol: str = "603777") -> pd.DataFrame:
"secid": f"{code_id_dict[symbol]}.{symbol}",
"_": "1640157544804",
}
r = requests.get(url, params=params)
r = requests.get(url, params=params, timeout=timeout)
data_json = r.json()
temp_df = pd.DataFrame(data_json)
temp_df.reset_index(inplace=True)
Expand Down Expand Up @@ -62,5 +64,5 @@ def stock_individual_info_em(symbol: str = "603777") -> pd.DataFrame:


if __name__ == "__main__":
stock_individual_info_em_df = stock_individual_info_em(symbol="000001")
stock_individual_info_em_df = stock_individual_info_em(symbol="000001", timeout=None)
print(stock_individual_info_em_df)
7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@

## 更新说明详情

1.10.81 fix: fix stock_bid_ask_em interface

1. 修复 stock_bid_ask_em 接口
2. 移除 stock_us_zh_spot 接口

1.10.80 fix: fix macro_china_gyzjz interface

1. 修复 macro_china_gyzjz 接口
Expand Down Expand Up @@ -2745,6 +2750,8 @@

## 版本更新说明

1.10.81 fix: fix stock_bid_ask_em interface

1.10.80 fix: fix macro_china_gyzjz interface

1.10.79 add: add stock_hold_management_detail_em interface
Expand Down
9 changes: 5 additions & 4 deletions docs/data/stock/stock.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,12 @@ print(stock_sse_deal_daily_df)

输入参数

| 名称 | 类型 | 描述 |
|--------|-----|-----------------------|
| symbol | str | symbol="603777"; 股票代码 |
| 名称 | 类型 | 描述 |
|---------|-------|-------------------------|
| symbol | str | symbol="603777"; 股票代码 |
| timeout | float | timeout=None; 默认不设置超时参数 |

输出参数-实时行情数据
输出参数

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

0 comments on commit 527fed8

Please sign in to comment.