Skip to content

Instantly share code, notes, and snippets.

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

Embed
What would you like to do?
get_main_df_05.py
from get_historical_data import AlphaVantage
import pandas as pd
import json
def get_main_data_frame(symbol):
.
.
.
#
# convert data to data frame
#
df = pd.read_json(json.dumps(list_historical_data__daily))
#
# prepare data, and add calculated fields to data frame
#
df['date_str'] = df['date']
df.set_index('date', inplace=True)
df.sort_index(inplace=True)
df['price_close_lag'] = df['price_close'].shift(1)
df['price_close_lead'] = df['price_close'].shift(-1)
df.insert(0, 'date_id', range(1, 1 + len(df)))
#
# returns data frame
#
return df
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.