WRT quantopian.com/help#ide-batch-transforms, why does the value returned from the transform not have the same structure as the value inside the transform? In the example, below, the log statements' outputs are identical. When prices[sid(24)][0] is accessed within the transform function, the code works. But when prices[sid(24)][0] is accessed in the caller, there is a runtime error.
import datetime
import pytz
def initialize(context):
context.stocks = [sid(24), sid(8347), sid(3766)]
utc = pytz.timezone('UTC')
context.d = datetime.datetime(2000, 1, 1, 0, 0, 0, tzinfo=utc)
def handle_data(context, data):
prices = endpoints(data, context.stocks)
log.info('p2: {p}'.format(p=prices))
firstPrice = prices[sid(24)][0]
log.info('end-of-day')
@batch_transform(refresh_period=1, window_length=5)
def endpoints(data, stocks):
prices = data['price']
log.info('p1: {p}'.format(p=prices))
firstPrice = prices[sid(24)][0]
return prices