A stop-loss is designed to limit an investor's loss on a security position. For example, setting a stop-loss order for 10% below the price at which you bought the stock will limit your loss to 10%. (Source: Investopedia)
1
from empyrial import empyrial, Engine
2
β
3
portfolio = Engine(
4
start_date ="2018-01-01",
5
portfolio=["BABA","PDD","KO","AMD","^IXIC"],
6
optimizer ="EF",
7
rebalance ="1y",#rebalance every year
8
risk_manager ={"Stop Loss":-0.2}#Stop the investment when the loss becomes superior to 20%