Skip to content

Commit

Permalink
Merge pull request #109 from 1nchaos/dev
Browse files Browse the repository at this point in the history
version
  • Loading branch information
1nchaos authored Oct 21, 2024
2 parents e36b6ed + 36efda8 commit c236dbd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion adata/__version__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

VERSION = (2, 7, 0)
VERSION = (2, 7, 1)
PRERELEASE = None # alpha, beta or rc
REVISION = None

Expand Down
10 changes: 6 additions & 4 deletions adata/stock/info/concept/stock_concept_ths.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ def __index_constituent_ths_by_index_code(self, index_code=None, wait_time=None)
items = result_json['items']
data_list.extend(items)

if not data_list:
return pd.DataFrame(data=data_list, columns=self._CONCEPT_CONSTITUENT_COLUMNS)
# 4. 数据封装,去重
rename = {'5': 'stock_code', '55': 'short_name'}
result_df = pd.DataFrame(data=data_list).rename(columns=rename)
Expand Down Expand Up @@ -294,8 +296,8 @@ def get_concept_ths(self, stock_code: str = '000001'):


if __name__ == '__main__':
print(StockConceptThs().all_concept_code_ths())
print(StockConceptThs().concept_constituent_ths(name='生物医药'))
# print(StockConceptThs().all_concept_code_ths())
# print(StockConceptThs().concept_constituent_ths(name='生物医药'))
print(StockConceptThs().concept_constituent_ths(index_code='885403'))
print(StockConceptThs().concept_constituent_ths(concept_code='300769'))
print(StockConceptThs().get_concept_ths(stock_code='300033'))
# print(StockConceptThs().concept_constituent_ths(concept_code='300769'))
# print(StockConceptThs().get_concept_ths(stock_code='300033'))
5 changes: 3 additions & 2 deletions adata/stock/market/stock_market/stock_market_east.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
@desc: 东方财富
https://quote.eastmoney.com/center/
TODO 数据校验
@author: 1nchaos
@time: 2023/06/19
@log: change log
Expand Down Expand Up @@ -65,6 +65,7 @@ def get_market(self, stock_code: str = '000001', start_date='1990-01-01', end_da
# 4.清洗数据
df['pre_close'] = df['close'].astype(float) - df['change'].astype(float)
df['pre_close'] = df['pre_close'].round(2)
df['volume'] = df['volume'].astype(int) * 100
df['trade_time'] = pd.to_datetime(df['trade_date']).dt.strftime('%Y-%m-%d %H:%M:%S')
df['trade_date'] = pd.to_datetime(df['trade_date']).dt.strftime('%Y-%m-%d')
df['stock_code'] = stock_code
Expand Down Expand Up @@ -121,5 +122,5 @@ def get_market_min(self, stock_code: str = '000001'):


if __name__ == '__main__':
print(StockMarketEast().get_market(stock_code='600020', k_type=1, adjust_type=1))
print(StockMarketEast().get_market(stock_code='000333', k_type=1, adjust_type=1))
# print(StockMarketEast().get_market_min(stock_code='600020'))

0 comments on commit c236dbd

Please sign in to comment.