Skip to content

Instantly share code, notes, and snippets.

@vedranmarkulj vedranmarkulj/get_main_df_04.py Secret
Last active Feb 25, 2018

Embed
What would you like to do?
get_main_df_04.py
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
You can’t perform that action at this time.