Skip to content

Commit

Permalink
为 get_quote_history 添加更多选项
Browse files Browse the repository at this point in the history
  • Loading branch information
Micro-sheep committed Jul 29, 2022
1 parent 17123f2 commit b88696f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v0.4.9(2022-07-29)

### Added

-`get_quote_history` 添加更多选项

## v0.4.8(2022-06-30)

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion efinance/__version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = 'efinance'
__version__ = '0.4.8'
__version__ = '0.4.9'
__author__ = 'micro sheep'
__url__ = 'https://github.com/Micro-sheep/efinance'
__author_email__ = '[email protected]'
Expand Down
6 changes: 2 additions & 4 deletions efinance/bond/getter.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ def get_quote_history(bond_codes: Union[str, List[str]],
beg=beg,
end=end,
klt=klt,
fqt=fqt
fqt=fqt,
**kwargs
)

if isinstance(df, pd.DataFrame):
Expand All @@ -307,9 +308,6 @@ def get_quote_history(bond_codes: Union[str, List[str]],
'名称': '债券名称'
},
inplace=True)
# NOTE 扩展接口 设定此关键词即返回 DataFrame 而不是 dict
if kwargs.get('return_df'):
df: pd.DataFrame = pd.concat(df, axis=0, ignore_index=True)
return df


Expand Down
1 change: 1 addition & 0 deletions efinance/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class MagicConfig:
EXTRA_FIELDS = 'extra_fields'
QUOTE_ID_MODE = 'quote_id_mode'
RETURN_DF = 'return_df'


# 各个市场编号
Expand Down
2 changes: 2 additions & 0 deletions efinance/common/getter.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ def start(code: str):
start(code)
multitasking.wait_for_tasks()
pbar.close()
if kwargs.get(MagicConfig.RETURN_DF):
return pd.concat(dfs, axis=0, ignore_index=True)
return dfs


Expand Down
6 changes: 2 additions & 4 deletions efinance/stock/getter.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ def get_quote_history(stock_codes: Union[str, List[str]],
beg=beg,
end=end,
klt=klt,
fqt=fqt
fqt=fqt,
**kwargs

)
if isinstance(df, pd.DataFrame):
Expand All @@ -250,9 +251,6 @@ def get_quote_history(stock_codes: Union[str, List[str]],
'名称': '股票名称'
},
inplace=True)
# NOTE 扩展接口 设定此关键词即返回 DataFrame 而不是 dict
if kwargs.get('return_df'):
df: pd.DataFrame = pd.concat(df, axis=0, ignore_index=True)
return df


Expand Down

0 comments on commit b88696f

Please sign in to comment.