import quandl
from datetime import datetime
quantrautil is a module specific to Quantra to fetch stock data
from quantrautil import get_quantinsti_api_key
api_key = get_quantinsti_api_key()
data = quandl.get('EOD/AAPL', start_date='2017-1-1', end_date='2018-1-1', api_key= api_key)
Note that you need to know the "Quandl code" of each dataset you download. In the above example, it is 'EOD/AAPL'.
To get your personal API key, sign up for a free Quandl account. Then, you can find your API key on Quandl account settings page.
data.head()