Hi, the following code get an error: Parameter start
received with timezone defined as ‘UTC’ although a Date must be timezone naive.
if remove tz_localize(‘UTC’),then it works. I wonder why. and if it’s correct to remove tz_localize(‘UTC’)?
def initialize(context):
pass
def handle_data(context, data):
order(symbol('AAPL'), 10)
# print('qtb=data ', symbol('AAPL'))
record(AAPL=data.current(symbol('AAPL'), fields = ['price']))
# record(AAPL=data[symbol('AAPL')].price)
start = pd.Timestamp('2014')
end = pd.Timestamp('2018')
# sp500 = web.DataReader('SP500', 'fred', start, end).SP500
# benchmark_returns = sp500.pct_change()
result = run_algorithm(start=start.tz_localize('UTC'),
end=end.tz_localize('UTC'),
initialize=initialize,
handle_data=handle_data,
capital_base=100000,
# benchmark_returns=benchmark_returns,
bundle='quandl',
data_frequency='daily')