Skip to content

Instantly share code, notes, and snippets.

@quantra-go-algo
Created July 12, 2021 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quantra-go-algo/f9a8b3854cfe303e3a78e0c3e8c4c0e8 to your computer and use it in GitHub Desktop.
Save quantra-go-algo/f9a8b3854cfe303e3a78e0c3e8c4c0e8 to your computer and use it in GitHub Desktop.
# Import quandl package
import quandl
# To get your API key, sign up for a free Quandl account.
# Then, you can find your API key on Quandl account settings page.
QUANDL_API_KEY = 'REPLACE-THIS-TEXT-WITH-A-REAL-API-KEY'
# This is to prompt you to change the Quandl Key
if QUANDL_API_KEY == 'REPLACE-THIS-TEXT-WITH-A-REAL-API-KEY':
raise Exception("Please provide a valid Quandl API key!")
# Set the start and end date
start_date = '1990-01-01'
end_date = '2018-03-01'
# Set the ticker name
ticker = 'AMZN'
# Feth the data
data = quandl.get('WIKI/'+ticker,
start_date=start_date,
end_date=end_date,
api_key=QUANDL_API_KEY)
# Print the first 5 rows of the dataframe
data.head()
@dylank641
Copy link

Import quandl package

import quandl

To get your API key, sign up for a free Quandl account.

Then, you can find your API key on Quandl account settings page.

QUANDL_API_KEY = '_99RMHQci8887LQoPRQE'

This is to prompt you to change the Quandl Key

if QUANDL_API_KEY != '_99RMHQci8887LQoPRQE':
raise Exception("Please provide a valid Quandl API key!")

Set the start and end date

start_date = '1990-01-01'
end_date = '2018-03-01'

Set the ticker name

ticker = 'AMZN'

Feth the data

data = quandl.get('WIKI/'+ticker,
start_date=start_date,
end_date=end_date,
api_key=QUANDL_API_KEY)

Print the first 5 rows of the dataframe

data.head()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment