Trying to make a script that will sell all open positions at the close, im a bit stuck
portfolio = api.list_positions()
for position in portfolio:
print(“{} shares of {}”.format(position.qty, position.symbol))
order = api.submit_order(position.symbol,position.qty,‘sell’,‘market’,‘cls’)
Not sure how to feed multiple open positions in to those submit_orders.
Im not the best at coding, any help would be nice.
Rich