Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
etf market
  • Loading branch information
1nchaos committed Aug 15, 2024
1 parent bd9b254 commit bcd39e7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions adata/fund/market/etf_market_ths.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def get_market_etf_ths(self, fund_code: str = '512880', k_type: int = 1, start_d
for d in data_list:
data.append(str(d).split(',')[0:7])
result_df = pd.DataFrame(data=data, columns=['trade_date', 'open', 'high', 'low', 'close', 'volume', 'amount'])
result_df = result_df[result_df['volume'] != '0']
result_df['fund_code'] = fund_code
result_df['trade_time'] = pd.to_datetime(result_df['trade_date']).dt.strftime('%Y-%m-%d %H:%M:%S')
result_df['trade_date'] = pd.to_datetime(result_df['trade_date'], format='%Y%m%d').dt.strftime('%Y-%m-%d')
Expand Down Expand Up @@ -94,6 +95,7 @@ def get_market_etf_min_ths(self, fund_code='512880'):
data.append(str(d).split(','))
# 3. 封装数据
result_df = pd.DataFrame(data=data, columns=['trade_time', 'price', 'amount', 'avg_price', 'volume'])
result_df = result_df[result_df['volume'] != '0']
result_df['fund_code'] = fund_code
result_df['trade_time'] = trade_date + result_df['trade_time']
result_df['trade_date'] = pd.to_datetime(trade_date, format='%Y%m%d').strftime('%Y-%m-%d')
Expand Down

0 comments on commit bcd39e7

Please sign in to comment.