mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 00:23:07 +00:00
fix test
This commit is contained in:
@@ -200,6 +200,10 @@ def calculate_expectancy(trades: pd.DataFrame) -> float:
|
|||||||
:param trades: DataFrame containing trades (requires columns close_date and profit_abs)
|
:param trades: DataFrame containing trades (requires columns close_date and profit_abs)
|
||||||
:return: expectancy
|
:return: expectancy
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if len(trades) == 0:
|
||||||
|
return 0
|
||||||
|
|
||||||
winning_trades = trades.loc[trades['profit_abs'] > 0]
|
winning_trades = trades.loc[trades['profit_abs'] > 0]
|
||||||
losing_trades = trades.loc[trades['profit_abs'] < 0]
|
losing_trades = trades.loc[trades['profit_abs'] < 0]
|
||||||
profit_sum = winning_trades['profit_abs'].sum()
|
profit_sum = winning_trades['profit_abs'].sum()
|
||||||
|
|||||||
Reference in New Issue
Block a user