efinance icon indicating copy to clipboard operation
efinance copied to clipboard

获取全市场基金数据会失败

Open shystartree opened this issue 1 year ago • 1 comments

代码:

all_funds_df = ef.fund.get_fund_codes()
all_funds_index = all_funds_df['基金代码'].apply(str).tolist()
funds_base = ef.fund.get_base_info(all_funds_index)

会报错: Processing => 217001: 0%| | 57/15437 [00:01<10:57, 23.39it/s]Traceback (most recent call last): File "/Users/q/Documents/ws/scan/test/funds.py", line 112, in save_base_data() File "/Users/q/Documents/ws/scan/test/funds.py", line 103, in save_base_data funds_base = ef.fund.get_base_info(all_funds_index) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/efinance/fund/getter.py", line 688, in get_base_info return get_base_info_muliti(fund_codes) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/efinance/fund/getter.py", line 635, in get_base_info_muliti Processing => 006539: 0%| | 58/15437 [00:01<10:57, 23.39it/s] start(fund_code) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/multitasking/init.py", line 121, in async_method single.start() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 852, in start _start_new_thread(self._bootstrap, ()) RuntimeError: can't start new thread Processing => 161505: 14%|█▎ | 2100/15437 [01:13<07:48, 28.47it/s]

MAC和win都不行,大佬看看,怎么获取全市场基金数据?

shystartree avatar Jul 29 '22 06:07 shystartree

参考这里限制一下线程数目:https://github.com/Micro-sheep/efinance/issues/50

或者不要一下子跑这么多只基金的,可以把基金代码列表切割成多个小部分再跑。

Micro-sheep avatar Jul 29 '22 07:07 Micro-sheep