Merge pull request #2731 from freqtrade/btanalysis_align_columns
Btanalysis align columns
This commit is contained in:
commit
2ccdb67e4d
@ -47,7 +47,7 @@ def load_backtest_data(filename) -> pd.DataFrame:
|
|||||||
utc=True,
|
utc=True,
|
||||||
infer_datetime_format=True
|
infer_datetime_format=True
|
||||||
)
|
)
|
||||||
df['profitabs'] = df['close_rate'] - df['open_rate']
|
df['profit'] = df['close_rate'] - df['open_rate']
|
||||||
df = df.sort_values("open_time").reset_index(drop=True)
|
df = df.sort_values("open_time").reset_index(drop=True)
|
||||||
return df
|
return df
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ def test_load_backtest_data(testdatadir):
|
|||||||
filename = testdatadir / "backtest-result_test.json"
|
filename = testdatadir / "backtest-result_test.json"
|
||||||
bt_data = load_backtest_data(filename)
|
bt_data = load_backtest_data(filename)
|
||||||
assert isinstance(bt_data, DataFrame)
|
assert isinstance(bt_data, DataFrame)
|
||||||
assert list(bt_data.columns) == BT_DATA_COLUMNS + ["profitabs"]
|
assert list(bt_data.columns) == BT_DATA_COLUMNS + ["profit"]
|
||||||
assert len(bt_data) == 179
|
assert len(bt_data) == 179
|
||||||
|
|
||||||
# Test loading from string (must yield same result)
|
# Test loading from string (must yield same result)
|
||||||
|
Loading…
Reference in New Issue
Block a user