Hi
I am new in Quantopian this Phyton code is to open (buy) a position (go long) but I would like to learn to
go short and how to close the short positions in Quantopian
price = data[context.stock].price
notional = context.portfolio.positions[context.stock].amount * price
totalstocks = notional/price
if exmavg>eexmavg and price > xxmavg:
order(context.stock,+100)
elif xmavg < xxmavg:
order(context.stock,-totalstocks)
but I would like to know how to go short and how to close a short position in Phyton Quantopian
Thanks in advance
Eloy