test: add test for api/hyperopt-loss

This commit is contained in:
Matthias 2024-10-22 06:40:51 +02:00
parent 0bf30aaa6b
commit 0de3c6945b

View File

@ -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