I am trying to sell all my positions, however, I am having some trouble. Here is my code:
def makeTrades(context, data):
#close all current positions
for position in context.portfolio.positions:
#line 97 \/
order(position, position.amount * -1, style=MarketOrder())
perTrade = context.account.net_liquidation / len(context.toTradeReturn)
for security in context.toTradeReturn:
order(security, perTrade, style=MarketOrder())
and here is my error
AttributeError: 'zipline.assets._assets.Equity' object has no attribute 'amount'
...
USER ALGORITHM:97, in makeTrades
order(position, position.amount * -1, style=MarketOrder())
Please help.
Thanks.