Python Forum
Yfinance - Intraday stock data with yf.download - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Yfinance - Intraday stock data with yf.download (/thread-35902.html)



Yfinance - Intraday stock data with yf.download - diogo_80 - Dec-27-2021

Hi everyone, I am new to this, so sorry for the basic question.

I am using yfinance to obtain intraday historical data for stocks traded in Bovespa (Brazil's stock exchange).

When I use yf.download, I get intraday data up to 16:00 hours, but the market in Brazil closes at 18:00.

Is there a way to get data past 16:00hrs?

Can someone please direct me as to how to do that?

Thanks,
Diogo


RE: Yfinance - Intraday stock data with yf.download - diogo_80 - Dec-28-2021

Hi all, I will provide some more information about the issue I have been facing. Note in the below code/data that data for after "15:00:00" is not retrieved unless for the last day (not sure why). But the market in Brazil actually closes at around 18:00:00 (I say around because there is a closing autcion that goes from 17:55:00 up to max 18:15:00). How could I get all the data, from open to official closing time?

Thanks in advance,
Diogo


import pandas as pd
import yfinance as yf
data = yf.download(tickers='VALE3.SA', period='5d', interval='60m')
Output:
[*********************100%***********************] 1 of 1 completed data Open High Low Close Adj Close Volume Datetime 2021-12-20 10:00:00-03:00 78.000000 78.769997 77.279999 78.519997 78.519997 4395600 2021-12-20 11:00:00-03:00 78.529999 78.900002 77.739998 78.080002 78.080002 3283200 2021-12-20 12:00:00-03:00 78.099998 78.639999 77.970001 78.089996 78.089996 2252500 2021-12-20 13:00:00-03:00 78.089996 78.290001 77.870003 78.080002 78.080002 1307200 2021-12-20 14:00:00-03:00 78.080002 78.250000 77.860001 78.029999 78.029999 1496000 2021-12-20 15:00:00-03:00 78.019997 78.180000 77.849998 78.120003 78.120003 1349800 2021-12-21 10:00:00-03:00 79.800003 79.989998 79.150002 79.250000 79.250000 2718600 2021-12-21 11:00:00-03:00 79.250000 79.910004 79.199997 79.529999 79.529999 2396300 2021-12-21 12:00:00-03:00 79.529999 79.949997 79.400002 79.610001 79.610001 2891500 2021-12-21 13:00:00-03:00 79.599998 79.959999 79.570000 79.680000 79.680000 1933100 2021-12-21 14:00:00-03:00 79.680000 79.680000 79.389999 79.620003 79.620003 1001900 2021-12-21 15:00:00-03:00 79.599998 80.220001 79.599998 80.070000 80.070000 3361000 2021-12-22 10:00:00-03:00 79.889999 80.150002 79.360001 79.470001 79.470001 3046400 2021-12-22 11:00:00-03:00 79.470001 79.599998 78.580002 79.050003 79.050003 2860800 2021-12-22 12:00:00-03:00 79.050003 79.389999 79.050003 79.260002 79.260002 1649600 2021-12-22 13:00:00-03:00 79.279999 79.830002 79.180000 79.599998 79.599998 1621300 2021-12-22 14:00:00-03:00 79.589996 79.660004 79.360001 79.580002 79.580002 1680900 2021-12-22 15:00:00-03:00 79.580002 79.870003 79.550003 79.769997 79.769997 1771800 2021-12-23 10:00:00-03:00 79.949997 80.059998 79.360001 79.400002 79.400002 2574000 2021-12-23 11:00:00-03:00 79.389999 79.860001 79.389999 79.639999 79.639999 2354800 2021-12-23 12:00:00-03:00 79.650002 79.739998 79.370003 79.510002 79.510002 1201100 2021-12-23 13:00:00-03:00 79.519997 79.540001 79.220001 79.330002 79.330002 899900 2021-12-23 14:00:00-03:00 79.330002 79.370003 78.940002 79.199997 79.199997 1548700 2021-12-23 15:00:00-03:00 79.209999 79.220001 78.830002 79.129997 79.129997 1273300 2021-12-27 10:00:00-03:00 78.870003 79.029999 78.529999 78.650002 78.650002 1664100 2021-12-27 11:00:00-03:00 78.660004 79.050003 78.260002 78.889999 78.889999 2440600 2021-12-27 12:00:00-03:00 78.889999 79.339996 78.699997 79.300003 79.300003 1113000 2021-12-27 13:00:00-03:00 79.300003 79.320000 79.040001 79.250000 79.250000 871100 2021-12-27 14:00:00-03:00 79.260002 79.449997 79.180000 79.300003 79.300003 987000 2021-12-27 15:00:00-03:00 79.300003 79.309998 78.959999 78.989998 78.989998 677500 2021-12-27 16:00:00-03:00 78.949997 78.949997 78.949997 78.949997 78.949997 0



RE: Yfinance - Intraday stock data with yf.download - processingclouds - Apr-29-2022

Hey,

I hope you are doing good.
I think data you are receiving is correct, but the output time shown is not adjusted to your timezone. So although you see it as 16:00 it is actually for 18:00 in your timezone. Can you double check and verify this?