Coder Social home page Coder Social logo

Comments (4)

JECSand avatar JECSand commented on June 12, 2024

@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.

msh855 avatar msh855 commented on June 12, 2024

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&region=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&region=US&corsDomain=finance.yahoo.com

from yahoofinancials.

JECSand avatar JECSand commented on June 12, 2024

@msh855 @RobinDeeCee

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.

JECSand avatar JECSand commented on June 12, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.