File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -1585,16 +1585,15 @@ def geometric_mean(returns):
15851585 s .loc ['Max. Drawdown Duration' ] = _round_timedelta (dd_dur .max ())
15861586 s .loc ['Avg. Drawdown Duration' ] = _round_timedelta (dd_dur .mean ())
15871587 s .loc ['# Trades' ] = n_trades = len (trades )
1588- s .loc ['Win Rate [%]' ] = win_rate = np .nan if not n_trades else (pl > 0 ).sum () / n_trades * 100 # noqa: E501
1588+ s .loc ['Win Rate [%]' ] = np .nan if not n_trades else (pl > 0 ).sum () / n_trades * 100 # noqa: E501
15891589 s .loc ['Best Trade [%]' ] = returns .max () * 100
15901590 s .loc ['Worst Trade [%]' ] = returns .min () * 100
15911591 mean_return = geometric_mean (returns )
15921592 s .loc ['Avg. Trade [%]' ] = mean_return * 100
15931593 s .loc ['Max. Trade Duration' ] = _round_timedelta (durations .max ())
15941594 s .loc ['Avg. Trade Duration' ] = _round_timedelta (durations .mean ())
15951595 s .loc ['Profit Factor' ] = returns [returns > 0 ].sum () / (abs (returns [returns < 0 ].sum ()) or np .nan ) # noqa: E501
1596- s .loc ['Expectancy [%]' ] = ((returns [returns > 0 ].mean () * win_rate +
1597- returns [returns < 0 ].mean () * (100 - win_rate )))
1596+ s .loc ['Expectancy [%]' ] = returns .mean () * 100
15981597 s .loc ['SQN' ] = np .sqrt (n_trades ) * pl .mean () / (pl .std () or np .nan )
15991598
16001599 s .loc ['_strategy' ] = strategy
You can’t perform that action at this time.
0 commit comments