load_bars_from_yahoo but now i want to do it through excel. i have chaged the data excatly into panel but m not able to do it.
this is the code :
import pytz
from datetime import datetime
from zipline.api import order, symbol, record, order_target
from zipline.algorithm import TradingAlgorithm
from zipline.utils.factory import load_bars_from_yahoo
import pyexcel
import zipline
import pandas as pd
# Load data manually from Yahoo! finance
start = datetime(2011, 1, 1, 0, 0, 0, 0, pytz.utc).date()
end = datetime(2012,1,1,0,0,0,0, pytz.utc).date()
d = zipline.data.load_prices_from_csv('/home/priyanka.s/work/algorithms/AAPL.csv', 'Date')
d = d.rename(columns=str.lower)
data = pd.Panel({zipline.assets.Equity(24, 'AAPL'): d})
def initialize(context):
context.security = symbol('AAPL')
def handle_data(context, data):
MA1 = data[context.security].mavg(50)
algo_obj = TradingAlgorithm(initialize=initialize,
handle_data=handle_data)
perf_manual = algo_obj.run(data)
i m getting this error :
TypeError: Cannot compare type 'Timestamp' with type 'NoneType'
I want to calculate profit,cash, portfolio value also
d = pd.read_csv('/home/priyanka.s/work/algorithms/AAPL.csv', index_col='Date', parse_dates=True, dayfirst=True)