-
-
Save vedranmarkulj/b6120b12aa817bfa129c98cf6c0d2d44 to your computer and use it in GitHub Desktop.
get_main_df_04.py
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
from get_historical_data import AlphaVantage | |
import pandas as pd | |
import json | |
def get_main_data_frame(symbol): | |
. | |
. | |
. | |
# | |
# Find and list all relevant keys in the original historical data response | |
# | |
list_keys = [] | |
list_historical_data__daily = [] | |
for key in historical_data_daily['Time Series (Daily)']: | |
list_keys.append(key) | |
for k in list_keys: | |
# | |
# Extract relevant data from original historical data response | |
# | |
data = historical_data_daily['Time Series (Daily)'][k] | |
price_open = data['1. open'] | |
price_high = data['2. high'] | |
price_low = data['3. low'] | |
price_close = data['4. close'] | |
dict_data = dict([ | |
(u'date', k), | |
(u'symbol', symbol), | |
(u'price_open', price_open), | |
(u'price_high', price_high), | |
(u'price_low', price_low), | |
(u'price_close', price_close), | |
]) | |
list_historical_data__daily.append(dict_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment