I need to get Stock data using pandas DataReader for the following banks:
Bank of America
CitiGroup
Goldman Sachs
JPMorgan Chase
Morgan Stanley
Wells Fargo
How to get the stock data from Jan 1st 2006 to Jan 1st 2016 for each of these banks.
I have tried...
import numpy as np
import pandas as pd
from pandas_datareader import data, wb
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import requests
import io
%matplotlib inline
import datetime
start = datetime.datetime(2006,1,1)
end = datetime.datetime(2016,1,1)
# Bank of America
BAC = data.DataReader("BAC",'ff', start, end)
Your problem is with the source which you are using to retrieve the data with Datareader. It doesn't seems that 'ff'
corresponds to any accepted API.
I've tried this and it works:
import pandas_datareader.data as web
from datetime import datetime
start = datetime(2016, 9, 1)
end = datetime(2018, 9, 1)
f = web.DataReader('BAC', 'iex', start, end)
print(f)
Also, take a look at the pandas-datareader official doccumentation, there are plenty of examples.