From 0de3c6945b864f96f8f433d2b13bbe43204e0e95 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 22 Oct 2024 06:40:51 +0200 Subject: [PATCH] test: add test for api/hyperopt-loss --- tests/rpc/test_rpc_apiserver.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index 98c97ad53..b4b4a3289 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -2189,6 +2189,22 @@ def test_api_exchanges(botclient): } +def test_list_hyperoptloss(botclient, tmp_path): + ftbot, client = botclient + ftbot.config["user_data_dir"] = tmp_path + + rc = client_get(client, f"{BASE_URI}/hyperopt-loss") + assert_response(rc) + response = rc.json() + assert isinstance(response["loss_functions"], list) + assert len(response["loss_functions"]) > 0 + + sharpeloss = [r for r in response["loss_functions"] if r["name"] == "SharpeHyperOptLoss"] + assert len(sharpeloss) == 1 + assert "Sharpe Ratio calculation" in sharpeloss[0]["description"] + assert len([r for r in response["loss_functions"] if r["name"] == "SortinoHyperOptLoss"]) == 1 + + def test_api_freqaimodels(botclient, tmp_path, mocker): ftbot, client = botclient ftbot.config["user_data_dir"] = tmp_path