Fix tests for new export format

This commit is contained in:
Matthias
2021-01-24 09:56:27 +01:00
parent deb8432d33
commit 789a980a30
5 changed files with 23 additions and 14 deletions

View File

@@ -26,6 +26,7 @@ BT_DATA_COLUMNS_MID = ['pair', 'profit_percent', 'open_date', 'close_date', 'tra
# Newest format
BT_DATA_COLUMNS = ['pair', 'stake_amount', 'amount', 'open_date', 'close_date',
'open_rate', 'close_rate',
'fee_open', 'fee_close', 'trade_duration',
'profit_ratio', 'profit_abs', 'sell_reason',
'initial_stop_loss_abs', 'initial_stop_loss_ratio', 'stop_loss_abs',
@@ -233,6 +234,7 @@ def trade_list_to_dataframe(trades: List[Trade]) -> pd.DataFrame:
if len(df) > 0:
df.loc[:, 'close_date'] = pd.to_datetime(df['close_date'], utc=True)
df.loc[:, 'open_date'] = pd.to_datetime(df['open_date'], utc=True)
df.loc[:, 'close_rate'] = df['close_rate'].astype('float64')
return df

View File

@@ -3,18 +3,18 @@
"""
This module contains the backtesting logic
"""
from freqtrade.data.btanalysis import BT_DATA_COLUMNS, trade_list_to_dataframe
import logging
from collections import defaultdict
from copy import deepcopy
from datetime import datetime, timedelta, timezone
from typing import Any, Dict, List, Optional, Tuple
from pandas import DataFrame, to_datetime
from pandas import DataFrame
from freqtrade.configuration import TimeRange, remove_credentials, validate_config_consistency
from freqtrade.constants import DATETIME_PRINT_FORMAT
from freqtrade.data import history
from freqtrade.data.btanalysis import trade_list_to_dataframe
from freqtrade.data.converter import trim_dataframe
from freqtrade.data.dataprovider import DataProvider
from freqtrade.exceptions import OperationalException