Last active
May 4, 2021 09:58
-
-
Save joeng03/6a93a52c177f1b3fdeaceecdd181a507 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
data=requests.get('https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&outputsize=full&symbol=FB&apikey=YOURAPIKEY') | |
data=data.json() | |
prices_low,prices_high,prices_close=[],[],[] | |
for i in range(200,1,-1): | |
d=date.today()-timedelta(i) | |
d=d.strftime("%Y-%m-%d") | |
try: | |
prices_high.append(float(data["Time Series (Daily)"][d]["2. high"])) | |
prices_low.append(float(data["Time Series (Daily)"][d]["3. low"])) | |
prices_close.append(float(data["Time Series (Daily)"][d]["4. close"])) | |
except: | |
continue | |
prices_low=np.array(prices_low) | |
prices_high=np.array(prices_high) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment