Python Forum
Help me with yahoo finance excel sheet
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help me with yahoo finance excel sheet
#1
Hello Guys,

I am looking for help with my homework, as the code I have, I am not able to get 'Adj Close' price from yahoo finance, I am looking to add a new sheet to my excel with data of all the 'adj close' prices for my stock from yahoo finance. any help is appreciated
1) This works just for close price

import pandas_datareader.data as pdr
#company i am looking into
Tickers = ['AAPL']

#the dates for my data
start_date = '2003-01-01'
end_date = '2018-12-31'

panel_data = pdr.DataReader(Tickers,'yahoo', start_date, end_date)

#the data i am looking for
Close_Price = panel_data['Close']


Close_Price_monthly = Close_Price.resample("1m").ffill()

Close_Price_monthly.to_excel('data_Close_Price.xlsx')
I even tried a code just to extra 'adj close price' but it didn't work

2) This doesn't work just for adj price of the stock
import pandas_datareader.data as pdr
Tickers = ['AAPL'] 

start_date = '2003-01-01'
end_date = '2018-12-31'

panel_data = pdr.DataReader(Tickers,'yahoo', start_date, end_date)

Adj_Close = panel_data['Adj_Close']

Adj_Close_monthly = Adj_Close.resample("1m").ffill()

Close_Price_monthly.to_excel('data_adj_close.xlsx')
Picture of the data column i am trying to get for my stock
Reply
#2
Are you required to use yahoo?
You can get this data directly from the exchanges, and I have a program here: https://github.com/Larz60p/PySymbol
that fetches all three from the three US markets.
I am only interested in ticker and company name, but the json file contains daily market info as well.
Reply
#3
Well I will get more confused as my data has to be a monthly, if possible would you know how can I retrieve adj price as its the next column over to close price but the program doesn't seem to be working if I just change the name to the adj close column for the data I want. Thank you
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python for finance Not_skilled_at_all 11 4,825 Aug-03-2022, 04:14 PM
Last Post: deanhystad
  Dealing with duplicates to an Excel sheet DistraughtMuffin 6 3,200 Oct-28-2020, 05:16 PM
Last Post: Askic
  App for excel sheet analysis awookado 6 2,738 Jan-27-2020, 09:02 AM
Last Post: awookado
  Python with Finance - i have no code but don't do it for me give me tips please Akainu 1 2,358 May-30-2019, 07:57 PM
Last Post: nilamo
  3 Finance Python Exercises mmkthen 2 5,351 Oct-29-2017, 02:55 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

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