Created
July 12, 2021 11:48
-
-
Save quantra-go-algo/f9a8b3854cfe303e3a78e0c3e8c4c0e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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()