File tree 2 files changed +3
-3
lines changed 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1404,13 +1404,13 @@ def geometric_mean(x):
1404
1404
# our risk doesn't; they use the simpler approach below.
1405
1405
annualized_return = (1 + gmean_day_return )** annual_trading_days - 1
1406
1406
s .loc ['Return (Ann.) [%]' ] = annualized_return * 100
1407
- s .loc ['Risk (Ann.) [%]' ] = np .sqrt ((day_returns .var (ddof = 1 ) + (1 + gmean_day_return )** 2 )** annual_trading_days - (1 + gmean_day_return )** (2 * annual_trading_days )) * 100 # noqa: E501
1407
+ s .loc ['Volatility (Ann.) [%]' ] = np .sqrt ((day_returns .var (ddof = 1 ) + (1 + gmean_day_return )** 2 )** annual_trading_days - (1 + gmean_day_return )** (2 * annual_trading_days )) * 100 # noqa: E501
1408
1408
# s.loc['Return (Ann.) [%]'] = gmean_day_return * annual_trading_days * 100
1409
1409
# s.loc['Risk (Ann.) [%]'] = day_returns.std(ddof=1) * np.sqrt(annual_trading_days) * 100
1410
1410
1411
1411
# Our Sharpe mismatches `empyrical.sharpe_ratio()` because they use arithmetic mean return
1412
1412
# and simple standard deviation
1413
- s .loc ['Sharpe Ratio' ] = np .clip (s .loc ['Return (Ann.) [%]' ] / (s .loc ['Risk (Ann.) [%]' ] or np .nan ), - 1 , np .inf ) # noqa: E501
1413
+ s .loc ['Sharpe Ratio' ] = np .clip (s .loc ['Return (Ann.) [%]' ] / (s .loc ['Volatility (Ann.) [%]' ] or np .nan ), - 1 , np .inf ) # noqa: E501
1414
1414
# Our Sortino mismatches `empyrical.sortino_ratio()` because they use arithmetic mean return
1415
1415
s .loc ['Sortino Ratio' ] = annualized_return / (np .sqrt (np .mean (day_returns .clip (- np .inf , 0 )** 2 )) * np .sqrt (annual_trading_days )) # noqa: E501
1416
1416
max_dd = - np .nan_to_num (dd .max ())
Original file line number Diff line number Diff line change @@ -274,7 +274,7 @@ def test_compute_stats(self):
274
274
'Profit Factor' : 2.0880175388920286 ,
275
275
'Return (Ann.) [%]' : 21.32802699608929 ,
276
276
'Return [%]' : 419.59949999999964 ,
277
- 'Risk (Ann.) [%]' : 36.53825234483751 ,
277
+ 'Volatility (Ann.) [%]' : 36.53825234483751 ,
278
278
'SQN' : 0.916892986080858 ,
279
279
'Sharpe Ratio' : 0.5837177650097084 ,
280
280
'Sortino Ratio' : 1.0923863161583591 ,
You can’t perform that action at this time.
0 commit comments