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)
from empyrial import empyrial, Engine
β
portfolio = Engine(
start_date ="2018-01-01",
portfolio=["BABA","PDD","KO","AMD","^IXIC"],
optimizer ="EF",
rebalance ="1y",#rebalance every year
risk_manager ={"Stop Loss":-0.2}#Stop the investment when the loss becomes superior to 20%