mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-13 03:33:55 +00:00
Small Adjustments to improve compatibility
This commit is contained in:
parent
4d9b4ddc28
commit
8373a4e713
|
@ -427,7 +427,7 @@ It contains some useful key metrics about performance of your strategy on backte
|
||||||
- `Rejected Buy signals`: Buy signals that could not be acted upon due to max_open_trades being reached.
|
- `Rejected Buy signals`: Buy signals that could not be acted upon due to max_open_trades being reached.
|
||||||
- `Min balance` / `Max balance`: Lowest and Highest Wallet balance during the backtest period.
|
- `Min balance` / `Max balance`: Lowest and Highest Wallet balance during the backtest period.
|
||||||
- `Drawdown (Account)`: Maximum Account Drawdown experienced. Calculated as $(Absolute Drawdown) / (DrawdownHigh + startingBalance)$.
|
- `Drawdown (Account)`: Maximum Account Drawdown experienced. Calculated as $(Absolute Drawdown) / (DrawdownHigh + startingBalance)$.
|
||||||
- `Drawdown`: Maximum, absolute drawdown experienced. Difference between Drawdown High and Low.
|
- `Drawdown`: Maximum, absolute drawdown experienced. Difference between Drawdown High and Subsequent Low point.
|
||||||
- `Drawdown high` / `Drawdown low`: Profit at the beginning and end of the largest drawdown period. A negative low value means initial capital lost.
|
- `Drawdown high` / `Drawdown low`: Profit at the beginning and end of the largest drawdown period. A negative low value means initial capital lost.
|
||||||
- `Drawdown Start` / `Drawdown End`: Start and end datetime for this largest drawdown (can also be visualized via the `plot-dataframe` sub-command).
|
- `Drawdown Start` / `Drawdown End`: Start and end datetime for this largest drawdown (can also be visualized via the `plot-dataframe` sub-command).
|
||||||
- `Market change`: Change of the market during the backtest period. Calculated as average of all pairs changes from the first to the last candle using the "close" column.
|
- `Market change`: Change of the market during the backtest period. Calculated as average of all pairs changes from the first to the last candle using the "close" column.
|
||||||
|
|
|
@ -207,10 +207,10 @@ def generate_strategy_comparison(all_results: Dict) -> List[Dict]:
|
||||||
results['results'], results['config']['dry_run_wallet'], strategy)
|
results['results'], results['config']['dry_run_wallet'], strategy)
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
max_drawdown_per, _, _, _, _ = calculate_max_drawdown(results['results'],
|
max_drawdown_per, _, _, _, _, _ = calculate_max_drawdown(results['results'],
|
||||||
value_col='profit_ratio')
|
value_col='profit_ratio')
|
||||||
max_drawdown_abs, _, _, _, _ = calculate_max_drawdown(results['results'],
|
max_drawdown_abs, _, _, _, _, _ = calculate_max_drawdown(results['results'],
|
||||||
value_col='profit_abs')
|
value_col='profit_abs')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
max_drawdown_per = 0
|
max_drawdown_per = 0
|
||||||
max_drawdown_abs = 0
|
max_drawdown_abs = 0
|
||||||
|
@ -719,7 +719,10 @@ def text_table_add_metrics(strat_results: Dict) -> str:
|
||||||
('Max balance', round_coin_value(strat_results['csum_max'],
|
('Max balance', round_coin_value(strat_results['csum_max'],
|
||||||
strat_results['stake_currency'])),
|
strat_results['stake_currency'])),
|
||||||
|
|
||||||
('Drawdown (Account)', f"{strat_results['max_drawdown_account']:.2%}"),
|
# Compatibility to show old hyperopt results
|
||||||
|
('Drawdown (Account)', f"{strat_results['max_drawdown_account']:.2%}")
|
||||||
|
if 'max_drawdown_account' in strat_results else (
|
||||||
|
'Drawdown', f"{strat_results['max_drawdown']:.2%}"),
|
||||||
('Drawdown', round_coin_value(strat_results['max_drawdown_abs'],
|
('Drawdown', round_coin_value(strat_results['max_drawdown_abs'],
|
||||||
strat_results['stake_currency'])),
|
strat_results['stake_currency'])),
|
||||||
('Drawdown high', round_coin_value(strat_results['max_drawdown_high'],
|
('Drawdown high', round_coin_value(strat_results['max_drawdown_high'],
|
||||||
|
|
|
@ -282,7 +282,7 @@ def test_create_cum_profit1(testdatadir):
|
||||||
def test_calculate_max_drawdown(testdatadir):
|
def test_calculate_max_drawdown(testdatadir):
|
||||||
filename = testdatadir / "backtest-result_new.json"
|
filename = testdatadir / "backtest-result_new.json"
|
||||||
bt_data = load_backtest_data(filename)
|
bt_data = load_backtest_data(filename)
|
||||||
drawdown_abs, hdate, lowdate, hval, lval, drawdown = calculate_max_drawdown(
|
_, hdate, lowdate, hval, lval, drawdown = calculate_max_drawdown(
|
||||||
bt_data, value_col="profit_abs")
|
bt_data, value_col="profit_abs")
|
||||||
assert isinstance(drawdown, float)
|
assert isinstance(drawdown, float)
|
||||||
assert pytest.approx(drawdown) == 0.59495234
|
assert pytest.approx(drawdown) == 0.59495234
|
||||||
|
|
Loading…
Reference in New Issue
Block a user