We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
你看看这个地方怎么处理呀
def load_financial_data(start_date='20230101', end_date='20240306', batch_size=50): """ 分批获取财务数据,每批最多获取batch_size只股票,每批之间延时5秒,防止Tushare限流 """ stock_list = get_stock_list_with_retry()
all_data = [] for i in range(0, len(stock_list), batch_size): batch = stock_list[i:i+batch_size] print(f"正在获取第 {i//batch_size + 1} 批财务数据,共 {len(batch)} 只股票...") for ts_code in batch: try: df = pro.fina_indicator(ts_code=ts_code, start_date=start_date, end_date=end_date) all_data.append(df) except Exception as e: print(f"获取 {ts_code} 财务数据失败,跳过。错误信息:{e}") time.sleep(5) # 每批次间隔5秒,降低触发限流风险 print(all_data[0:5]) financial_data = pd.concat(all_data, ignore_index=True) financial_data['trade_date'] = pd.to_datetime(financial_data['trade_date']) #这里
The text was updated successfully, but these errors were encountered:
财务数据转换那一块的代码也提供下吧 pe_ttm那些计算的代码 现在应该跑不起来
Sorry, something went wrong.
No branches or pull requests
你看看这个地方怎么处理呀
分批获取财务数据
def load_financial_data(start_date='20230101', end_date='20240306', batch_size=50):
"""
分批获取财务数据,每批最多获取batch_size只股票,每批之间延时5秒,防止Tushare限流
"""
stock_list = get_stock_list_with_retry()
The text was updated successfully, but these errors were encountered: