Created
July 24, 2019 15:24
-
-
Save mberrien-fitzsimons/fb53aca751a7991a98cd173a7a446087 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
# read in libraries | |
import os | |
import sys | |
import pandas as pd | |
import requests | |
from iexfinance.stocks import Stock | |
from iexfinance.refdata import get_symbols | |
root_dir = os.path.join(os.getcwd(), '..') | |
sys.path.append(root_dir) | |
from conf import secrets | |
# api key from alpha vantage | |
ALPHA_VANTAGE_KEY = secrets.ALPHA_VANTAGE_KEY | |
# perform API call for data | |
function = 'TIME_SERIES_DAILY_ADJUSTED' | |
symbol = 'MSFT' | |
datatype = 'csv' | |
url = f"https://www.alphavantage.co/query?function={function}&symbol={symbol}&datatype={datatype}&apikey={ALPHA_VANTAGE_KEY}" | |
msft_raw = pd.read_csv(url) | |
# before making any changes save this to raw data folder | |
msft_raw.to_csv('../data/01_raw/msft_raw.csv', index=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment