I'm trying to write a custom moving average function that will update every trading minute and use a trailing window of minutely ticks. Under the minutely backtest, it appears that I am able to extract a trailing window of 390 ticks with this code:
def get_prices(datapanel, sids):
The window is updated every minute (due to the setting refresh_period=0).
Note that the code won't execute under the daily backtester, due to this line:
log.debug(' prices: ' + str(prices))
But, if I ignore the error, I can still run under the minutely backtest.
The problem is that the minutely backtester runs this simple algorithm very slowly. Any idea why? I tried commenting out the logging, but it didn't help.