ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
14.98k stars 2.45k forks source link

Yahoo Finance URL Change #271

Closed tjGecko closed 1 year ago

tjGecko commented 4 years ago

Hi Ran, Good job on the library. I ran into an issue with the URL. I've attached my test code. When I run this code, I noticed that the financials are not resolving correctly (e.g. balance sheet, cashflow, ...). I inspected with a debugger and copied the URL from your base class into the browser to see if it would resolve. No luck. It appears that Yahoo changed the formatting of the URL slightly.

Here's what I found:

T_Pull_Yahoo.py.txt

Any ideas?

tjGecko commented 4 years ago

Hey Ran, Don't know what the etiquette is for updating others' repos. I made a fix that appears to work in my code. I'll attach here for your review. Check around line 353 of base.py:

Code Changes

    # get fundamentals
    # https://finance.yahoo.com/quote/MSFT/financials?p=MSFT
    # ,
    tj_url = f'{self._scrape_url}/{self.ticker}/financials?p={self.ticker}'
    data = utils.get_json(tj_url, proxy)
    # data = utils.get_json(url+'/financials', proxy)

base.py.txt

denisrasulev commented 4 years ago

@tjGecko probably this info could help with pull requests :)

tjGecko commented 4 years ago

@tjGecko probably this info could help with pull requests :)

Thank you! I will educate myself. :)

brunomorampc commented 4 years ago

Hey Ran, Don't know what the etiquette is for updating others' repos. I made a fix that appears to work in my code. I'll attach here for your review. Check around line 353 of base.py:

Code Changes

    # get fundamentals
    # https://finance.yahoo.com/quote/MSFT/financials?p=MSFT
    # ,
    tj_url = f'{self._scrape_url}/{self.ticker}/financials?p={self.ticker}'
    data = utils.get_json(tj_url, proxy)
    # data = utils.get_json(url+'/financials', proxy)

base.py.txt

this works for me as well, thanks!

francopiccolo commented 4 years ago

Hey Ran, Don't know what the etiquette is for updating others' repos. I made a fix that appears to work in my code. I'll attach here for your review. Check around line 353 of base.py:

Code Changes

    # get fundamentals
    # https://finance.yahoo.com/quote/MSFT/financials?p=MSFT
    # ,
    tj_url = f'{self._scrape_url}/{self.ticker}/financials?p={self.ticker}'
    data = utils.get_json(tj_url, proxy)
    # data = utils.get_json(url+'/financials', proxy)

same here thank you!