Skip to content

Negative PnL Strategy's Sharpe, Sortino and Calmar ratios are zero #472

Answered by kernc
atakanokan asked this question in Q&A
Discussion options

You must be logged in to vote

You could remove np.clip() wrapping in these places:

s.loc['Sharpe Ratio'] = np.clip((s.loc['Return (Ann.) [%]'] - risk_free_rate) / (s.loc['Volatility (Ann.) [%]'] or np.nan), 0, np.inf) # noqa: E501

s.loc['Sortino Ratio'] = np.clip((annualized_return - risk_free_rate) / (np.sqrt(np.mean(day_returns.clip(-np.inf, 0)**2)) * np.sqrt(annual_trading_days)), 0, np.inf) # noqa: E501

s.loc['Calmar Ratio'] = np.clip(annualized_return / (-max_dd or np.nan), 0, np.inf)

Do nega…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@atakanokan
Comment options

@atakanokan
Comment options

@kernc
Comment options

@kernc
Comment options

@atakanokan
Comment options

Answer selected by atakanokan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants