Skip to content

Adj Close in yfinance has been removed #563

Open
@rowanc1

Description

@rowanc1

In colab and locally, I am having trouble executing prob_dist.md:

image

It might be related to this:
ranaroussi/yfinance#1333

Activity

mattiaslamotte

mattiaslamotte commented on Jan 10, 2025

@mattiaslamotte

I've had the same issue. My code was working fine last week, and it won't run this week as "Adj Close" is no longer accessible through the yf.download() method. Really annoying! Using unadjusted closing prices is completely useless - I will no longer use yfinance package in the future...

Heinrich-XIAO

Heinrich-XIAO commented on Jan 10, 2025

@Heinrich-XIAO

Same.

rowanc1

rowanc1 commented on Jan 14, 2025

@rowanc1
ContributorAuthor

Should be fixed with #564!

mattiaslamotte

mattiaslamotte commented on Jan 14, 2025

@mattiaslamotte

It is not fixed. Any changes to an API such as yfinance should be back compatible to ensure that people's code is not broken subsequent to changes. If you're planning on implementing breaking code, you need to have a user warning months in advance - otherwise users will just walk away and use a different API.

If you go on Google Colab, the code below used to work and doesn't work anymore.

!pip install yfinance
import yfinance as yf
data = yf.download(["AAPL","AMZN"], start="2020-01-01")
prices= data['Adj_Close'] #fails on this line
print(prices)

Historically, if you were going to download one data series with yfinance, it would be 'Adj_Close'. If 'Close' has become 'Adj_Close' in the YF database, it's a very serious issue for everyone using the API. When I go on the web site, both the 'Close' and 'Adj_Close' columns are still shown in manually downloaded data - this implies that both columns are still in the underlying yahoo finance data.

mmcky

mmcky commented on Jan 14, 2025

@mmcky
Contributor

Thanks everyone for your comments - We definitely want to use Adj Close as it accounts for splits and dividends. Digging through the yfinance api to see if it is accessible.

https://stackoverflow.com/questions/76964889/yfinance-download-auto-adjust-true-what-does-it-actually-do

mmcky

mmcky commented on Jan 14, 2025

@mmcky
Contributor

This code https://github.com/ranaroussi/yfinance/blob/0713d9386769b168926d3959efd8310b56a33096/yfinance/utils.py#L445-L462 suggests that the Close is the Adj Close but I will confirm by posting an issue on the yfinance repo.

mattiaslamotte

mattiaslamotte commented on Jan 14, 2025

@mattiaslamotte

I agree that it looks like it has been renamed, and that Close is actually now "Adj_Close". This is a really surprising change given that it breaks everyone's code. It would be interesting to understand the logical reasoning behind it given that the Yahoo Finance web site still shows both Close and Adj Close under the historical data tab.

This change also breaks your code if you built your own custom Adj_Close using the old nominal Close (for example, an "after tax" custom series to measure the after tax performance of different dividend distributing stock portfolios). There are just so many reasons why this change is complete nonsense...

cfigy

cfigy commented on Jan 15, 2025

@cfigy

Using 0.2.51 I added auto_adjust=TorF as example below:

df = yf.download("AAPL", start="2024-01-01", end="2025-01-14", auto_adjust=False)

Should get you back to having "Adj Close"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @rowanc1@mmcky@mattiaslamotte@Heinrich-XIAO@cfigy

        Issue actions

          `Adj Close` in `yfinance` has been removed · Issue #563 · QuantEcon/lecture-python-intro