Zipline Live Trading Error

Hi there,

I'm getting an error when trying to live trade my Zipline algo. It's designed to execute based on daily data, and the backtest works fine.

Here's the error I'm getting:

  quantrocket_zipline_1|feeding 2020-08-19 11:14:00-04:00 BAR event to sp500_momentum_model_pos_reb strategy
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR Traceback (most recent call last):
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "sym://qrocket_log_py", line 34, in wrapped
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "sym://qrocket_qrzipline_trade_trade_py", line 59, in mule_trade_algo
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "sym://qrocket_qrzipline_trade_trade_py", line 161, in trade_algo
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/algorithm.py", line 671, in run
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR     for perf in self.get_generator():
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/gens/tradesimulation.py", line 205, in transform
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR     for capital_change_packet in every_bar(dt):
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/gens/tradesimulation.py", line 133, in every_bar
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR     handle_data(algo, current_data, dt_to_use)
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/utils/events.py", line 218, in handle_data
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR     dt,
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/utils/events.py", line 237, in handle_data
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR     self.callback(context, data)
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "/codeload/zipline/sp500_momentum_model_pos_reb.py", line 186, in port_rebalance
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR     hist = data.history(context.todays_universe, 'close', momentum_window, "1d")
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "zipline/_protocol.pyx", line 121, in zipline._protocol.check_parameters.__call__.assert_keywords_and_call (zipline/_protocol.c:3823)
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "zipline/_protocol.pyx", line 696, in zipline._protocol.BarData.history (zipline/_protocol.c:9251)
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "sym://qrocket_qrzipline_trade_data_portal_py", line 37, in get_history_window
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "sym://qrocket_qrzipline_trade_data_portal_py", line 37, in <listcomp>
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:02 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR   File "sym://qrocket_qrzipline_trade_asset_py", line 60, in patch_asset_end_date
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:02 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR AttributeError: 'str' object has no attribute 'end_date'
    quantrocket_houston_1|172.18.0.6 - - [19/Aug/2020:15:14:02 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-19 11:14:01 quantrocket.zipline: ERROR 

I can't tell if it's an issue with my code or with the live trading algorithm.

Please advise.

David

It sounds like you’re passing strings to the data.history function instead of Asset objects.

Thanks, Brian. I wasn't passing the Asset object properly.

My next issue is I'm getting an error that references minute bars, but the strategy is based on daily history data. Do I need a realtime tick database for a daily strategy?

Here's the error message:

quantrocket_zipline_1|feeding 2020-08-20 10:27:00-04:00 BAR event to sp500_momentum_model_pos_reb strategy
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: WARNING [sp500_momentum_model_pos_reb] No real-time database is set, current day data will be unavailable to strategy
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR Traceback (most recent call last):
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/data/resample.py", line 418, in closes
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     last_visited_dt, last_close = entries[asset]
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR KeyError: Equity(FIBBG000C2V3D6 [A])
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR 
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR During handling of the above exception, another exception occurred:
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR 
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR Traceback (most recent call last):
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/data/minute_bars.py", line 1073, in _open_minute_file
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     carray = self._carrays[field][sid]
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR KeyError: 1
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR 
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:00 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR During handling of the above exception, another exception occurred:
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR 
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR Traceback (most recent call last):
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/data/minute_bars.py", line 1078, in _open_minute_file
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     mode='r',
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "bcolz/carray_ext.pyx", line 1026, in bcolz.carray_ext.carray.__cinit__ (bcolz/carray_ext.c:13751)
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "bcolz/carray_ext.pyx", line 1326, in bcolz.carray_ext.carray._read_meta (bcolz/carray_ext.c:18289)
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/quantrocket/zipline/data/sp500current-1d-bundle/2020-01-01T00;00;00/minute_equities.bcolz/00/00/000001.bcolz/close/meta/sizes'
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR 
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR During handling of the above exception, another exception occurred:
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR 
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR Traceback (most recent call last):
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "sym://qrocket_log_py", line 34, in wrapped
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "sym://qrocket_qrzipline_trade_trade_py", line 59, in mule_trade_algo
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "sym://qrocket_qrzipline_trade_trade_py", line 161, in trade_algo
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/algorithm.py", line 671, in run
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     for perf in self.get_generator():
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/gens/tradesimulation.py", line 205, in transform
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     for capital_change_packet in every_bar(dt):
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/gens/tradesimulation.py", line 133, in every_bar
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     handle_data(algo, current_data, dt_to_use)
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/utils/events.py", line 218, in handle_data
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     dt,
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/utils/events.py", line 237, in handle_data
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     self.callback(context, data)
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/codeload/zipline/sp500_momentum_model_pos_reb.py", line 184, in port_rebalance
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     hist = data.history(context.todays_universe, 'close', momentum_window, "1d")
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "zipline/_protocol.pyx", line 121, in zipline._protocol.check_parameters.__call__.assert_keywords_and_call (zipline/_protocol.c:3823)
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "zipline/_protocol.pyx", line 696, in zipline._protocol.BarData.history (zipline/_protocol.c:9251)
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "sym://qrocket_qrzipline_trade_data_portal_py", line 38, in get_history_window
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/data/data_portal.py", line 967, in get_history_window
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     field, data_frequency)
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/data/data_portal.py", line 806, in _get_history_daily_window
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     assets, days_for_window, end_dt, field_to_use, data_frequency
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/data/data_portal.py", line 850, in _get_history_daily_window_data
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     assets, end_dt)
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/data/resample.py", line 440, in closes
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     asset, dt, 'close')
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/data/dispatch_bar_reader.py", line 97, in get_value
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     return r.get_value(asset, dt, field)
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/data/minute_bars.py", line 1138, in get_value
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     value = self._open_minute_file(field, sid)[minute_pos]
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR   File "/opt/conda/lib/python3.6/site-packages/zipline/data/minute_bars.py", line 1081, in _open_minute_file
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR     raise NoDataForSid('No minute data for sid {}.'.format(sid))
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR zipline.data.bar_reader.NoDataForSid: No minute data for sid 1.
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"
  quantrocket_flightlog_1|2020-08-20 10:27:00 quantrocket.zipline: ERROR 
    quantrocket_houston_1|172.18.0.6 - - [20/Aug/2020:14:27:01 +0000] "POST /flightlog/handler HTTP/1.1" 200 5 "-" "-"

I confirmed the Sid is in the bundle and there is close data from the prior day.

David

You don't need realtime data but you do currently need a minute bundle as live trading automatically runs at minute frequency. The next release will include support for live trading at daily frequency, but for the time being you need to adapt your strategy to use the minute bundle (using schedule_function to trade at the desired frequency).

Using the minute bundle worked. Thanks!

Is there a way to debug the algo after it runs for live trading? When I run it, it runs fine. I'm expecting orders, but I don't get any.

There aren't any debugging approaches specific to live trading, although it would be nice if there were. I would add lots of print statements and adjust schedule_function to run more frequently to see what's going on.

I adjusted the schedule_function to run every minute, but I'm not sure where to set any print statements. There aren't any errors in the logs so it looks like the algo is functioning. Just no orders are being generated when they should be.

The only thing I see in the logs when the strategy is being executed is:

quantrocket_zipline_1|feeding 2020-08-27 10:47:00-04:00 BAR event to all_weather_model strategy
quantrocket_zipline_1|waiting until 2020-08-27 10:48:00-04:00 to continue trading all_weather_model strategy
quantrocket_flightlog_1|2020-08-27 10:47:00 quantrocket.zipline: WARNING [all_weather_model] No current-day data is available in real-time database sp500-tick-1min

The strategy is based on daily close data.

David

I've included a print statement right after my rebalance function is defined which is called by schedule_function in def initialize(context), but it's not appearing in the logs.

   ...
    schedule_function(
        rebalance,
        #date_rules.month_start(),
        date_rules.every_day(),
        #time_rules.market_open(hours=2, minutes=30)
        time_rules.every_minute()
    )
             
def rebalance(context, data):
    """
    Execute orders according to our schedule_function() timing.
    """
    print("***REBALANCING***")
    ...

That's the right technique. Print statements will show up in the detailed logs. If they're not, I would probably try throwing an exception in initialize just to sanity check that the file you're editing and the file Zipline is running are really the same file.

Version 2.2.0 is now available and includes the ability to run Zipline live trading using a daily bundle.