Open eddiecailinux opened 1 year ago
def risk_of_ruin(returns, prepare_returns=True):
"""
Calculates the risk of ruin
(the likelihood of losing all one's investment capital)
"""
if prepare_returns:
returns = _utils._prepare_returns(returns)
wins = win_rate(returns)
return ((1 - wins) / (1 + wins)) ** len(returns)
Check out https://github.com/Lumiwealth/quantstats_lumi, which is being updated regularly. We are a fork of this library that is being maintained by Lumiwealth
can you give me the Risk Of Ruin Formula? I found formula here: https://www.newtraderu.com/2021/03/13/risk-of-ruin-formula/ and here: https://moneyzine.com/investments/risk-of-ruin/ they use below formla to calculate risk of ruin, which is quite different from quantstats using. Risk of Ruin = ((1 - (W - L)) / (1 + (W - L)))U W = The probability of a winning trade. L = The probability of a loss. U = The maximum number of trading risks that can be taken before the trader reaches their threshold for being ruined.