You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
yfinance version ... yfinance==0.2.48
environment google colab
If you want to display the price and volume over time of a certain stock ticker the code does not reproduces the same results as in previous yfinance version. See code example
Simple code that reproduces your problem
#code simply displays the price and volume of Tesla
#after you've run the code restart the kernel and change the yfinance version to !pip install yfinance==0.2.47 to see that #this fixes the problem
!pip install yfinance==0.2.48
import yfinance as yf
import plotly.graph_objects as go
from datetime import datetime, timedelta
Describe bug
yfinance version ... yfinance==0.2.48
environment google colab
If you want to display the price and volume over time of a certain stock ticker the code does not reproduces the same results as in previous yfinance version. See code example
Simple code that reproduces your problem
#code simply displays the price and volume of Tesla
#after you've run the code restart the kernel and change the yfinance version to !pip install yfinance==0.2.47 to see that #this fixes the problem
!pip install yfinance==0.2.48
import yfinance as yf
import plotly.graph_objects as go
from datetime import datetime, timedelta
start_date = '2023-01-01'
end_date = datetime.now().strftime('%Y-%m-%d')
data = yf.download("TSLA", start=start_date, end=end_date)
fig = go.Figure()
fig.add_trace(go.Scatter(x=data.index, y=data['Close'], name='Price'))
fig.add_trace(go.Bar(x=data.index, y=data['Volume'], name='Volume', yaxis='y2'))
fig.update_layout(
title='TSLA Price and Volume',
yaxis_title='Price',
yaxis2=dict(title='Volume', overlaying='y', side='right'),
xaxis=dict(
rangeselector=dict(
buttons=list([
dict(count=1, label="1m", step="month", stepmode="backward"),
dict(count=3, label="3m", step="month", stepmode="backward"),
dict(count=6, label="6m", step="month", stepmode="backward"),
dict(count=1, label="YTD", step="year", stepmode="todate"),
dict(count=1, label="1y", step="year", stepmode="backward"),
dict(step="all")
])
),
rangeslider=dict(visible=True),
type="date"
)
)
fig.show()
print(yf.version)
Debug log
DEBUG Entering download()
DEBUG:yfinance:Entering download()
DEBUG Disabling multithreading because DEBUG logging enabled
DEBUG:yfinance: Disabling multithreading because DEBUG logging enabled
DEBUG Entering history()
DEBUG:yfinance: Entering history()
DEBUG Entering _fetch_ticker_tz()
DEBUG:yfinance: Entering _fetch_ticker_tz()
DEBUG Entering get()
DEBUG:yfinance: Entering get()
DEBUG Entering _make_request()
DEBUG:yfinance: Entering _make_request()
DEBUG url=https://query2.finance.yahoo.com/v8/finance/chart/TSLA
DEBUG:yfinance: url=https://query2.finance.yahoo.com/v8/finance/chart/TSLA
DEBUG params=frozendict.frozendict({'range': '1d', 'interval': '1d'})
DEBUG:yfinance: params=frozendict.frozendict({'range': '1d', 'interval': '1d'})
DEBUG Entering _get_cookie_and_crumb()
DEBUG:yfinance: Entering _get_cookie_and_crumb()
DEBUG cookie_mode = 'basic'
DEBUG:yfinance: cookie_mode = 'basic'
DEBUG Entering _get_cookie_and_crumb_basic()
DEBUG:yfinance: Entering _get_cookie_and_crumb_basic()
DEBUG fetched basic cookie = <Cookie A3=d=AQABBKA0L2cCEE1e05jvPT8ruI6YyALs_jYFEgEBAQGGMGc5Z9xT0iMA_eMAAA&S=AQAAAvny0wTW1KSO2Do0qcUIK6M for .yahoo.com/>
DEBUG:yfinance: fetched basic cookie = <Cookie A3=d=AQABBKA0L2cCEE1e05jvPT8ruI6YyALs_jYFEgEBAQGGMGc5Z9xT0iMA_eMAAA&S=AQAAAvny0wTW1KSO2Do0qcUIK6M for .yahoo.com/>
DEBUG reusing cookie
DEBUG:yfinance: reusing cookie
DEBUG crumb = 'UGDMfqi49g4'
DEBUG:yfinance: crumb = 'UGDMfqi49g4'
DEBUG Exiting _get_cookie_and_crumb_basic()
DEBUG:yfinance: Exiting _get_cookie_and_crumb_basic()
DEBUG Exiting _get_cookie_and_crumb()
DEBUG:yfinance: Exiting _get_cookie_and_crumb()
DEBUG response code=200
DEBUG:yfinance: response code=200
DEBUG Exiting _make_request()
DEBUG:yfinance: Exiting _make_request()
DEBUG Exiting get()
DEBUG:yfinance: Exiting get()
DEBUG Exiting _fetch_ticker_tz()
DEBUG:yfinance: Exiting _fetch_ticker_tz()
DEBUG Entering history()
DEBUG:yfinance: Entering history()
DEBUG TSLA: Yahoo GET parameters: {'period1': '2023-01-01 00:00:00-05:00', 'period2': '2024-11-09 00:00:00-05:00', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG:yfinance: TSLA: Yahoo GET parameters: {'period1': '2023-01-01 00:00:00-05:00', 'period2': '2024-11-09 00:00:00-05:00', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG Entering get()
DEBUG:yfinance: Entering get()
DEBUG Entering _make_request()
DEBUG:yfinance: Entering _make_request()
DEBUG url=https://query2.finance.yahoo.com/v8/finance/chart/TSLA
DEBUG:yfinance: url=https://query2.finance.yahoo.com/v8/finance/chart/TSLA
DEBUG params=frozendict.frozendict({'period1': 1672549200, 'period2': 1731128400, 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'})
DEBUG:yfinance: params=frozendict.frozendict({'period1': 1672549200, 'period2': 1731128400, 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'})
DEBUG Entering _get_cookie_and_crumb()
DEBUG:yfinance: Entering _get_cookie_and_crumb()
DEBUG cookie_mode = 'basic'
DEBUG:yfinance: cookie_mode = 'basic'
DEBUG Entering _get_cookie_and_crumb_basic()
DEBUG:yfinance: Entering _get_cookie_and_crumb_basic()
DEBUG reusing cookie
DEBUG:yfinance: reusing cookie
DEBUG reusing crumb
DEBUG:yfinance: reusing crumb
DEBUG Exiting _get_cookie_and_crumb_basic()
DEBUG:yfinance: Exiting _get_cookie_and_crumb_basic()
DEBUG Exiting _get_cookie_and_crumb()
DEBUG:yfinance: Exiting _get_cookie_and_crumb()
DEBUG response code=200
DEBUG:yfinance: response code=200
DEBUG Exiting _make_request()
DEBUG:yfinance: Exiting _make_request()
DEBUG Exiting get()
DEBUG:yfinance: Exiting get()
DEBUG TSLA: yfinance received OHLC data: 2023-01-03 14:30:00 -> 2024-11-08 14:30:00
DEBUG:yfinance: TSLA: yfinance received OHLC data: 2023-01-03 14:30:00 -> 2024-11-08 14:30:00
DEBUG TSLA: OHLC after cleaning: 2023-01-03 09:30:00-05:00 -> 2024-11-08 09:30:00-05:00
DEBUG:yfinance: TSLA: OHLC after cleaning: 2023-01-03 09:30:00-05:00 -> 2024-11-08 09:30:00-05:00
DEBUG TSLA: OHLC after combining events: 2023-01-03 00:00:00-05:00 -> 2024-11-08 00:00:00-05:00
DEBUG:yfinance: TSLA: OHLC after combining events: 2023-01-03 00:00:00-05:00 -> 2024-11-08 00:00:00-05:00
DEBUG TSLA: yfinance returning OHLC: 2023-01-03 00:00:00-05:00 -> 2024-11-08 00:00:00-05:00
DEBUG:yfinance: TSLA: yfinance returning OHLC: 2023-01-03 00:00:00-05:00 -> 2024-11-08 00:00:00-05:00
DEBUG Exiting history()
DEBUG:yfinance: Exiting history()
DEBUG Exiting history()
DEBUG:yfinance: Exiting history()
DEBUG Exiting download()
DEBUG:yfinance:Exiting download()
Bad data proof
#!pip install yfinance==0.2.48
#!pip install yfinance==0.2.47
yfinance
version0.2.48
Python version
newest
Operating system
macOS
The text was updated successfully, but these errors were encountered: