Python Forum
Yfinance - Intraday stock data with yf.download
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Yfinance - Intraday stock data with yf.download
#1
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
Reply
#2
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
Larz60+ write Dec-28-2021, 02:25 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Reply
#3
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Failed to download Qualtrics data using API balaKrishnaV 4 3,883 Sep-16-2023, 03:12 PM
Last Post: Jfreeland
  why is yfinance returning an ellipsis in the middle of ticket history db042190 3 967 Jun-12-2023, 06:03 PM
Last Post: db042190
Photo can't install yfinance db042190 4 25,731 Jun-12-2023, 01:14 PM
Last Post: db042190
  Create simple live plot of stock data dram 2 2,906 Jan-27-2023, 04:34 AM
Last Post: CucumberNox
  Exporting Stock Fundamental Data to a CSV file with yahoo_fin DustinKlent 2 4,709 Aug-01-2022, 06:08 PM
Last Post: paulyan
  SMA (simple moving avg) Not receiving Data (stock prices). gdbengo 2 1,437 Jul-31-2022, 08:20 PM
Last Post: paulyan
  download with internet download manager coral_raha 0 2,931 Jul-18-2021, 03:11 PM
Last Post: coral_raha
  Code should download and output trading data tayy 2 2,628 Mar-04-2021, 04:07 AM
Last Post: tayy
  How to plot intraday data of several days in one plot mistermister 3 2,896 Dec-15-2020, 07:43 PM
Last Post: deanhystad
  Having trouble with minute stock data MAZambelli4353 2 2,331 Sep-03-2019, 09:41 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020