yfinance icon indicating copy to clipboard operation
yfinance copied to clipboard

hh::mm::ss and timezone showing up as part of Date

Open satoshi opened this issue 3 months ago • 7 comments

Describe bug

Until 0.2.44, the Date column only contained the date:

[*********************100%***********************]  1 of 1 completed
                 Open       High        Low      Close  Adj Close   Volume
Date
2011-01-04  158280.00  162700.00  158280.00  158460.00  158460.00       56
2011-01-05  160100.00  160200.00  154360.00  155100.00  155100.00       37
2011-01-06  154880.00  157360.00  153740.00  155760.00  155760.00       42
2011-01-07  154480.00  160020.00  152360.00  156080.00  156080.00       22
2011-01-10  159280.00  161740.00  155520.00  155760.00  155760.00       35

However, 0.2.48 produces the following (notice the 00:00:00+00:00)

[*********************100%***********************]  1 of 1 completed
Price                      Adj Close      Close       High        Low       Open   Volume
Ticker                          VIXY       VIXY       VIXY       VIXY       VIXY     VIXY
Date
2011-01-04 00:00:00+00:00  158460.00  158460.00  162700.00  158280.00  158280.00       56
2011-01-05 00:00:00+00:00  155100.00  155100.00  160200.00  154360.00  160100.00       37
2011-01-06 00:00:00+00:00  155760.00  155760.00  157360.00  153740.00  154880.00       42
2011-01-07 00:00:00+00:00  156080.00  156080.00  160020.00  152360.00  154480.00       22
2011-01-10 00:00:00+00:00  155760.00  155760.00  161740.00  155520.00  159280.00       35
...                              ...        ...        ...        ...        ...      ...
2024-10-25 00:00:00+00:00      13.63      13.63      13.66      12.77      12.90  5206400
2024-10-28 00:00:00+00:00      13.01      13.01      13.17      12.83      13.07  4404900
2024-10-29 00:00:00+00:00      12.94      12.94      13.14      12.76      13.06  2663000
2024-10-30 00:00:00+00:00      13.24      13.24      13.29      12.85      13.06  3199200
2024-10-31 00:00:00+00:00      14.30      14.30      14.31      13.59      13.60  6001400

Any way to get rid of the 00:00:00+00:00? This makes it really difficult to key table operations off of the Date.

Simple code that reproduces your problem

import yfinance as yf

vixy = yf.download('VIXY')
print(vixy)

Debug log

DEBUG    Entering download()
DEBUG     Disabling multithreading because DEBUG logging enabled
DEBUG     Entering history()
DEBUG      Entering history()
DEBUG       VIXY: Yahoo GET parameters: {'period1': '1925-11-26 09:50:04-05:00', 'period2': '2024-11-01 10:50:04-04:00', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG       Entering get()
DEBUG        Entering _make_request()
DEBUG         url=https://query2.finance.yahoo.com/v8/finance/chart/VIXY
DEBUG         params={'period1': -1391591396, 'period2': 1730472604, 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG         Entering _get_cookie_and_crumb()
DEBUG          cookie_mode = 'basic'
DEBUG          Entering _get_cookie_and_crumb_basic()
DEBUG           loaded persistent cookie
DEBUG           reusing cookie
DEBUG           crumb = 'RRaVJQIQUML'
DEBUG          Exiting _get_cookie_and_crumb_basic()
DEBUG         Exiting _get_cookie_and_crumb()
DEBUG         response code=200
DEBUG        Exiting _make_request()
DEBUG       Exiting get()
DEBUG       VIXY: yfinance received OHLC data: 2011-01-04 14:30:00 -> 2024-10-31 13:30:00
DEBUG       VIXY: OHLC after cleaning: 2011-01-04 09:30:00-05:00 -> 2024-10-31 09:30:00-04:00
DEBUG       VIXY: OHLC after combining events: 2011-01-04 00:00:00-05:00 -> 2024-10-31 00:00:00-04:00
DEBUG       VIXY: yfinance returning OHLC: 2011-01-04 00:00:00-05:00 -> 2024-10-31 00:00:00-04:00
DEBUG      Exiting history()
DEBUG     Exiting history()
DEBUG    Exiting download()

Bad data proof

No response

yfinance version

0.2.44 and 0.2.48

Python version

No response

Operating system

No response

satoshi avatar Nov 01 '24 14:11 satoshi