flake8 fix

This commit is contained in:
Stefano Ariestasia 2023-07-22 09:18:22 +09:00
parent 4812bcc28b
commit dcc3ef1309
2 changed files with 8 additions and 7 deletions

View File

@ -535,12 +535,13 @@ class RPC:
# winrate,
# loserate)
expectancy = calculate_expectancy(trades)
expectancy_ratio = calculate_expectancy_ratio(trades)
trades_df = DataFrame([{'close_date': trade.close_date.strftime(DATETIME_PRINT_FORMAT),
'profit_abs': trade.close_profit_abs}
for trade in trades if not trade.is_open and trade.close_date])
expectancy = calculate_expectancy(trades_df)
expectancy_ratio = calculate_expectancy_ratio(trades_df)
max_drawdown_abs = 0.0
max_drawdown = 0.0
if len(trades_df) > 0:

View File

@ -13,10 +13,10 @@ from freqtrade.data.btanalysis import (BT_DATA_COLUMNS, analyze_trade_parallelis
load_backtest_metadata, load_trades, load_trades_from_db)
from freqtrade.data.history import load_data, load_pair_history
from freqtrade.data.metrics import (calculate_cagr, calculate_calmar, calculate_csum,
calculate_expectancy, calculate_expectancy_ratio,
calculate_market_change, calculate_max_drawdown,
calculate_sharpe, calculate_sortino, calculate_underwater,
combine_dataframes_with_mean, create_cum_profit)
calculate_expectancy_ratio, calculate_market_change,
calculate_max_drawdown, calculate_sharpe, calculate_sortino,
calculate_underwater, combine_dataframes_with_mean,
create_cum_profit)
from freqtrade.exceptions import OperationalException
from freqtrade.util import dt_utc
from tests.conftest import CURRENT_TEST_STRATEGY, create_mock_trades