Merge branch 'develop' into add-custom-roi-strategy-callback
This commit is contained in:
@@ -946,7 +946,7 @@ def test_is_informative_pairs_callback(default_conf):
|
||||
|
||||
def test_hyperopt_parameters():
|
||||
HyperoptStateContainer.set_state(HyperoptState.INDICATORS)
|
||||
from skopt.space import Categorical, Integer, Real
|
||||
from optuna.distributions import CategoricalDistribution, FloatDistribution, IntDistribution
|
||||
|
||||
with pytest.raises(OperationalException, match=r"Name is determined.*"):
|
||||
IntParameter(low=0, high=5, default=1, name="hello")
|
||||
@@ -977,7 +977,7 @@ def test_hyperopt_parameters():
|
||||
|
||||
intpar = IntParameter(low=0, high=5, default=1, space="buy")
|
||||
assert intpar.value == 1
|
||||
assert isinstance(intpar.get_space(""), Integer)
|
||||
assert isinstance(intpar.get_space(""), IntDistribution)
|
||||
assert isinstance(intpar.range, range)
|
||||
assert len(list(intpar.range)) == 1
|
||||
# Range contains ONLY the default / value.
|
||||
@@ -989,7 +989,7 @@ def test_hyperopt_parameters():
|
||||
|
||||
fltpar = RealParameter(low=0.0, high=5.5, default=1.0, space="buy")
|
||||
assert fltpar.value == 1
|
||||
assert isinstance(fltpar.get_space(""), Real)
|
||||
assert isinstance(fltpar.get_space(""), FloatDistribution)
|
||||
|
||||
fltpar = DecimalParameter(low=0.0, high=0.5, default=0.14, decimals=1, space="buy")
|
||||
assert fltpar.value == 0.1
|
||||
@@ -1006,7 +1006,7 @@ def test_hyperopt_parameters():
|
||||
["buy_rsi", "buy_macd", "buy_none"], default="buy_macd", space="buy"
|
||||
)
|
||||
assert catpar.value == "buy_macd"
|
||||
assert isinstance(catpar.get_space(""), Categorical)
|
||||
assert isinstance(catpar.get_space(""), CategoricalDistribution)
|
||||
assert isinstance(catpar.range, list)
|
||||
assert len(list(catpar.range)) == 1
|
||||
# Range contains ONLY the default / value.
|
||||
@@ -1017,7 +1017,7 @@ def test_hyperopt_parameters():
|
||||
|
||||
boolpar = BooleanParameter(default=True, space="buy")
|
||||
assert boolpar.value is True
|
||||
assert isinstance(boolpar.get_space(""), Categorical)
|
||||
assert isinstance(boolpar.get_space(""), CategoricalDistribution)
|
||||
assert isinstance(boolpar.range, list)
|
||||
assert len(list(boolpar.range)) == 1
|
||||
|
||||
|
||||
@@ -385,6 +385,17 @@ def test_strategy_max_open_trades_infinity_from_strategy(caplog, default_conf):
|
||||
assert strategy.max_open_trades == float("inf")
|
||||
assert default_conf["max_open_trades"] == float("inf")
|
||||
|
||||
# test if the default value is set to infinity (V2 doesn't set max_open_trades explicitly)
|
||||
del default_conf["max_open_trades"]
|
||||
default_conf.update(
|
||||
{
|
||||
"strategy": "StrategyTestV2",
|
||||
}
|
||||
)
|
||||
strategy2 = StrategyResolver.load_strategy(default_conf)
|
||||
assert strategy2.max_open_trades == float("inf")
|
||||
assert default_conf["max_open_trades"] == float("inf")
|
||||
|
||||
|
||||
def test_strategy_max_open_trades_infinity_from_config(caplog, default_conf, mocker):
|
||||
caplog.set_level(logging.INFO)
|
||||
|
||||
Reference in New Issue
Block a user