quantstats icon indicating copy to clipboard operation
quantstats copied to clipboard

Risk Of Ruin Formula

Open eddiecailinux opened this issue 2 years ago • 3 comments

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.

eddiecailinux avatar Aug 29 '23 13:08 eddiecailinux

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)

issamansur avatar Aug 29 '23 13:08 issamansur

from https://patternswizard.com/risk-of-ruin/

issamansur avatar Aug 29 '23 13:08 issamansur

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

grzesir avatar Jul 30 '24 06:07 grzesir