Merge pull request #11141 from andrasmining/develop
Adding drawdown information for hyperopt-list --export-csv command & small fix stake currency source
This commit is contained in:
@@ -374,7 +374,6 @@ class HyperoptTools:
|
|||||||
|
|
||||||
trials = json_normalize(results, max_level=1)
|
trials = json_normalize(results, max_level=1)
|
||||||
trials["Best"] = ""
|
trials["Best"] = ""
|
||||||
trials["Stake currency"] = config["stake_currency"]
|
|
||||||
|
|
||||||
base_metrics = [
|
base_metrics = [
|
||||||
"Best",
|
"Best",
|
||||||
@@ -383,11 +382,13 @@ class HyperoptTools:
|
|||||||
"results_metrics.profit_mean",
|
"results_metrics.profit_mean",
|
||||||
"results_metrics.profit_median",
|
"results_metrics.profit_median",
|
||||||
"results_metrics.profit_total",
|
"results_metrics.profit_total",
|
||||||
"Stake currency",
|
"results_metrics.stake_currency",
|
||||||
"results_metrics.profit_total_abs",
|
"results_metrics.profit_total_abs",
|
||||||
"results_metrics.holding_avg",
|
"results_metrics.holding_avg",
|
||||||
"results_metrics.trade_count_long",
|
"results_metrics.trade_count_long",
|
||||||
"results_metrics.trade_count_short",
|
"results_metrics.trade_count_short",
|
||||||
|
"results_metrics.max_drawdown_abs",
|
||||||
|
"results_metrics.max_drawdown_account",
|
||||||
"loss",
|
"loss",
|
||||||
"is_initial_point",
|
"is_initial_point",
|
||||||
"is_best",
|
"is_best",
|
||||||
@@ -409,6 +410,8 @@ class HyperoptTools:
|
|||||||
"Avg duration",
|
"Avg duration",
|
||||||
"Trade count long",
|
"Trade count long",
|
||||||
"Trade count short",
|
"Trade count short",
|
||||||
|
"Max drawdown",
|
||||||
|
"Max drawdown percent",
|
||||||
"Objective",
|
"Objective",
|
||||||
"is_initial_point",
|
"is_initial_point",
|
||||||
"is_best",
|
"is_best",
|
||||||
@@ -432,6 +435,9 @@ class HyperoptTools:
|
|||||||
trials["Avg profit"] = trials["Avg profit"].apply(
|
trials["Avg profit"] = trials["Avg profit"].apply(
|
||||||
lambda x: f"{x * perc_multi:,.2f}%" if not isna(x) else ""
|
lambda x: f"{x * perc_multi:,.2f}%" if not isna(x) else ""
|
||||||
)
|
)
|
||||||
|
trials["Max drawdown percent"] = trials["Max drawdown percent"].apply(
|
||||||
|
lambda x: f"{x * perc_multi:,.2f}%" if not isna(x) else ""
|
||||||
|
)
|
||||||
trials["Objective"] = trials["Objective"].apply(
|
trials["Objective"] = trials["Objective"].apply(
|
||||||
lambda x: f"{x:,.5f}" if x != 100000 else ""
|
lambda x: f"{x:,.5f}" if x != 100000 else ""
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1532,8 +1532,11 @@ def test_hyperopt_list(mocker, capsys, caplog, tmp_path):
|
|||||||
assert csv_file.is_file()
|
assert csv_file.is_file()
|
||||||
line = csv_file.read_text()
|
line = csv_file.read_text()
|
||||||
assert (
|
assert (
|
||||||
'Best,1,2,-1.25%,-1.2222,-0.00125625,,-2.51,"3,930.0 m",0.43662' in line
|
'Best,1,2,-1.25%,-1.2222,-0.00125625,BTC,-2.51,"3,930.0 m",-0.00125625,23.00%,0.43662'
|
||||||
or "Best,1,2,-1.25%,-1.2222,-0.00125625,,-2.51,2 days 17:30:00,2,0,0.43662" in line
|
in line
|
||||||
|
or "Best,1,2,-1.25%,-1.2222,-0.00125625,BTC,-2.51,2 days 17:30:00,2,0,-0.00125625,23.00%,"
|
||||||
|
"0.43662"
|
||||||
|
in line
|
||||||
)
|
)
|
||||||
csv_file.unlink()
|
csv_file.unlink()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user