1

Am using the following and it works, but only when i provide wide date range for around 10 days.

# Import yfinance
import yfinance as yf
import matplotlib.pyplot as plt

# Get the data for the stock Apple by specifying the stock ticker, start date, and end date
data = yf.download('AAPL','2019-01-01','2019-01-10', interval='1h')

data.Close.plot(figsize=(10, 5))
plt.show()

I want to see zoomed graph showing hourly ups and downs. It comes out as following.

enter image description here

user93796
  • 18,749
  • 31
  • 94
  • 150
  • Issue is there is no hourly time stamp recorded for the dates. So all the hourly data for each date is plotted altogether resulting in spikes. – SKPS Feb 16 '20 at 04:17
  • But am passing interval as 1hr to yahoo api – user93796 Feb 16 '20 at 06:13
  • 1
    But it does not return the hour data. Only the dates. You can print and see it. There is not much documentation available online. Probably the developers might not have thought about this issue. I would recommend looking into other python libraries to achieve this. – SKPS Feb 16 '20 at 06:43
  • Ah i see, i was passing too old date. I passed new one and it worked. You were correct. The data had same timestame without date for all data points. – user93796 Feb 16 '20 at 06:58
  • Thanks. Can u help me with this? https://stackoverflow.com/questions/60245999/plotting-a-vertical-line-using-matplotlib-in-python – user93796 Feb 16 '20 at 06:59

0 Answers0