A simple python script that scrapes yahoo finance's CSV files of historical daily stock prices and returns them into a pandas dataframe object.
Dependencies:
requests
pandas
Usage:
import yahoofinancecsv
yahoo = yahoofinancecsv.YahooCsv()
df = yahoo.get_csv('MSFT', "2018-01-01", "2019-01-01")
print(df)
Open High Low Close Adj Close Volume
Date
2018-01-02 86.129997 86.309998 85.500000 85.949997 82.599319 22483800
2018-01-03 86.059998 86.510002 85.970001 86.349998 82.983727 26061400
2018-01-04 86.589996 87.660004 86.570000 87.110001 83.714119 21912000
2018-01-05 87.660004 88.410004 87.430000 88.190002 84.752014 23407100
2018-01-08 88.199997 88.580002 87.599998 88.279999 84.838486 22113000
... ... ... ... ... ... ...
2018-12-24 97.680000 97.970001 93.980003 94.129997 92.026421 43935200
2018-12-26 95.139999 100.690002 93.959999 100.559998 98.312729 51634800
2018-12-27 99.300003 101.190002 96.400002 101.180000 98.918884 49498500
2018-12-28 102.089996 102.410004 99.519997 100.389999 98.146530 38196300
2018-12-31 101.290001 102.400002 100.440002 101.570000 99.300156 33173800
[251 rows x 6 columns]