Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
What is the best way to do a GTC stop loss order?

I basically am doing the following:

I am saving the my initial buy price

order_percent(symbol('alny'),1)
context.buys['alny'] = price

and then going through the portfolio and the resubmitting a stop loss order every day since orders get cancelled at the end of the day. Is there
a better way to do it?

order_percent(symbol('alny'),-1,style=StopOrder(price * 0.95))