Hello I am trying to import a CSV file of prices from Google Drive and then plot the closing prices on a plot save the values in the csv columns as a list.
Something is wrong the code below isn't working like that
import pandas, talib
from pytz import timezone
def rename_col(df):
df = df.rename(columns={'Close': 'Closing_Data'})
df = df.fillna(method='ffill')
return df
#---------------------------------------------------------------------#
def initialize(context):
context.stocks = {}
url_x = 'https://drive.google.com/file/d/0B8sToPDpAlKpYVl5SEUzNFRXUjA/view?usp=sharing'
#url_x = 'http://www.nseindia.com/content/indices/histdata/CNX%20NIFTY12-04-2014-10-04-2015.csv'
fetch_csv(url_x,
date_column='Date',
symbol = 'NIFTY',
usecols = ['Close'],
post_func=rename_col ,
date_format='%d-%mmm-%Y',
)
#context.stock = symbol('NIFTY')
#----------------------------------------------------------------------#
def handle_data(context, data):
if 'Closing_Data' in data['NIFTY']:
record(Day_Closes = data['NIFTY'].Closing_Data)