Hi there, I met a problem which works before, any solutions??
I saw the error in title at line
" for position in context.portfolio.positions.itervalues():" in the below codes:
def count_positions(context,data):
longs = 0
for position in context.portfolio.positions.itervalues():
if position.amount > 0:
longs += 1
leverage=context.account.leverage
# asset=context.portfolio.portfolio_value
# record(asset=asset)
record(longs=longs)
record(leverage=leverage)