Comments (4)
@RobinDeeCee Thank you for your feedback.
Did you try running YahooFinancials in concurrency mode? You'll see significantly improved performance when simultaneously pulling data for multiple tickers.
i.e:
yahoo_financials = YahooFinancials(tickers, concurrent=True, max_workers=8, country="US")
from yahoofinancials.
I have using the new version, but is extremely slow. Slower than looping over millions of data, I would say. The parallelisation for some reason is not working properly.
And often I get errors like this:
yahoo_financials.get_stock_profile_data()
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/Users/safishajjouz/opt/anaconda3/envs/obb/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/Users/safishajjouz/opt/anaconda3/envs/obb/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/Users/safishajjouz/opt/anaconda3/envs/obb/lib/python3.9/site-packages/yahoofinancials/etl.py", line 499, in _create_dict_ent
re_data = self._get_historical_data(YAHOO_URL, r_map, tech_type, statement_type)
File "/Users/safishajjouz/opt/anaconda3/envs/obb/lib/python3.9/site-packages/yahoofinancials/etl.py", line 237, in _get_historical_data
self._request_handler(url, config.get("response_field"))
File "/Users/safishajjouz/opt/anaconda3/envs/obb/lib/python3.9/site-packages/yahoofinancials/etl.py", line 198, in _request_handler
raise ManagedException("Server replied with HTTP " + str(response.status_code) +
yahoofinancials.etl.ManagedException: Server replied with HTTP 404 code while opening the url: https://query2.finance.yahoo.com/v10/finance/quoteSummary/smt.l?modules=assetProfile&formatted=False&lang=en-US®ion=US&corsDomain=finance.yahoo.com
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/safishajjouz/opt/anaconda3/envs/obb/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3378, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-22-551664ebc37c>", line 1, in <module>
yahoo_financials.get_stock_profile_data()
File "/Users/safishajjouz/opt/anaconda3/envs/obb/lib/python3.9/site-packages/yahoofinancials/yf.py", line 114, in get_stock_profile_data
self.get_stock_data(statement_type='profile', tech_type='assetProfile', report_name='assetProfile'),
File "/Users/safishajjouz/opt/anaconda3/envs/obb/lib/python3.9/site-packages/yahoofinancials/etl.py", line 548, in get_stock_data
dict_ents = pool.map(partial(self._create_dict_ent,
File "/Users/safishajjouz/opt/anaconda3/envs/obb/lib/python3.9/multiprocessing/pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/Users/safishajjouz/opt/anaconda3/envs/obb/lib/python3.9/multiprocessing/pool.py", line 771, in get
raise self._value
yahoofinancials.etl.ManagedException: Server replied with HTTP 404 code while opening the url: https://query2.finance.yahoo.com/v10/finance/quoteSummary/smt.l?modules=assetProfile&formatted=False&lang=en-US®ion=US&corsDomain=finance.yahoo.com
from yahoofinancials.
I just pushed v1.15. I attempted to improve how yf handles the random 404 errors. If this issue continues, could you provide me with some of the symbols you are trying to run?
from yahoofinancials.
@RobinDeeCee Closing this issue due to inactivity. If you are still experiencing unexpected slowness, just open a new issue and we can revisit.
from yahoofinancials.
Related Issues (20)
- KeyError: 'incomeBeforeTax
- Get the last trading hour
- get_stock_earnings_data always fails HOT 8
- .get_key_statistics_data() results in a HTTP 401 code HOT 9
- Error when running test script HOT 4
- .get_key_statistics_data() http 401 yahoofinancials version 1.19 HOT 2
- get_key_statistic_data: 401 error HOT 2
- Problem with Demo.py HOT 4
- TypeError: can only concatenate str (not "NoneType") to str HOT 2
- get_net_income() provides the Net Income of 9/29/2020 (for AAPL) HOT 1
- get_historical_price_data() end_date HOT 4
- Can't fetch anything HOT 1
- unsupported operand type(s) for -: 'datetime.datetime' and 'str' HOT 5
- sessions.py _get_crumb does not get the crumb, it's empty HOT 6
- not working - get_financial_data() HOT 4
- TypeError: 'NoneType' object is not subscriptable
- Sleeping and retrying for a long time HOT 1
- get_historical_price_data() error HOT 1
- get_summary_data() freezes the application with a delisted stock symbol
- Unable to get any examples working.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yahoofinancials.