Skip to content

Commit 68429f9

Browse files
committed
fix: improve wording for config overriding strategy values
closes freqtrade#12212
1 parent 5cb41ba commit 68429f9

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

freqtrade/resolvers/strategy_resolver.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ def _override_attribute_helper(strategy, config: Config, attribute: str, default
109109
# Ensure Properties are not overwritten
110110
setattr(strategy, attribute, config[attribute])
111111
logger.info(
112-
f"Override strategy '{attribute}' with value in config file: {config[attribute]}.",
112+
f"Override strategy '{attribute}' with value from the configuration: "
113+
f"{config[attribute]}.",
113114
)
114115
elif hasattr(strategy, attribute):
115116
val = getattr(strategy, attribute)

tests/strategy/test_strategy_loading.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ def test_strategy_override_minimal_roi(caplog, default_conf):
169169

170170
assert strategy.minimal_roi[0] == 0.5
171171
assert log_has(
172-
"Override strategy 'minimal_roi' with value in config file: {'20': 0.1, '0': 0.5}.", caplog
172+
"Override strategy 'minimal_roi' with value from the configuration: {'20': 0.1, '0': 0.5}.",
173+
caplog,
173174
)
174175

175176

@@ -179,7 +180,7 @@ def test_strategy_override_stoploss(caplog, default_conf):
179180
strategy = StrategyResolver.load_strategy(default_conf)
180181

181182
assert strategy.stoploss == -0.5
182-
assert log_has("Override strategy 'stoploss' with value in config file: -0.5.", caplog)
183+
assert log_has("Override strategy 'stoploss' with value from the configuration: -0.5.", caplog)
183184

184185

185186
def test_strategy_override_max_open_trades(caplog, default_conf):
@@ -188,7 +189,9 @@ def test_strategy_override_max_open_trades(caplog, default_conf):
188189
strategy = StrategyResolver.load_strategy(default_conf)
189190

190191
assert strategy.max_open_trades == 7
191-
assert log_has("Override strategy 'max_open_trades' with value in config file: 7.", caplog)
192+
assert log_has(
193+
"Override strategy 'max_open_trades' with value from the configuration: 7.", caplog
194+
)
192195

193196

194197
def test_strategy_override_trailing_stop(caplog, default_conf):
@@ -198,7 +201,9 @@ def test_strategy_override_trailing_stop(caplog, default_conf):
198201

199202
assert strategy.trailing_stop
200203
assert isinstance(strategy.trailing_stop, bool)
201-
assert log_has("Override strategy 'trailing_stop' with value in config file: True.", caplog)
204+
assert log_has(
205+
"Override strategy 'trailing_stop' with value from the configuration: True.", caplog
206+
)
202207

203208

204209
def test_strategy_override_trailing_stop_positive(caplog, default_conf):
@@ -214,12 +219,14 @@ def test_strategy_override_trailing_stop_positive(caplog, default_conf):
214219

215220
assert strategy.trailing_stop_positive == -0.1
216221
assert log_has(
217-
"Override strategy 'trailing_stop_positive' with value in config file: -0.1.", caplog
222+
"Override strategy 'trailing_stop_positive' with value from the configuration: -0.1.",
223+
caplog,
218224
)
219225

220226
assert strategy.trailing_stop_positive_offset == -0.2
221227
assert log_has(
222-
"Override strategy 'trailing_stop_positive' with value in config file: -0.1.", caplog
228+
"Override strategy 'trailing_stop_positive' with value from the configuration: -0.1.",
229+
caplog,
223230
)
224231

225232

@@ -233,7 +240,7 @@ def test_strategy_override_timeframe(caplog, default_conf):
233240

234241
assert strategy.timeframe == 60
235242
assert strategy.stake_currency == "ETH"
236-
assert log_has("Override strategy 'timeframe' with value in config file: 60.", caplog)
243+
assert log_has("Override strategy 'timeframe' with value from the configuration: 60.", caplog)
237244

238245

239246
def test_strategy_override_process_only_new_candles(caplog, default_conf):
@@ -244,7 +251,8 @@ def test_strategy_override_process_only_new_candles(caplog, default_conf):
244251

245252
assert not strategy.process_only_new_candles
246253
assert log_has(
247-
"Override strategy 'process_only_new_candles' with value in config file: False.", caplog
254+
"Override strategy 'process_only_new_candles' with value from the configuration: False.",
255+
caplog,
248256
)
249257

250258

@@ -265,7 +273,7 @@ def test_strategy_override_order_types(caplog, default_conf):
265273
assert strategy.order_types[method] == order_types[method]
266274

267275
assert log_has(
268-
"Override strategy 'order_types' with value in config file:"
276+
"Override strategy 'order_types' with value from the configuration:"
269277
" {'entry': 'market', 'exit': 'limit', 'stoploss': 'limit',"
270278
" 'stoploss_on_exchange': True}.",
271279
caplog,
@@ -299,7 +307,7 @@ def test_strategy_override_order_tif(caplog, default_conf):
299307
assert strategy.order_time_in_force[method] == order_time_in_force[method]
300308

301309
assert log_has(
302-
"Override strategy 'order_time_in_force' with value in config file:"
310+
"Override strategy 'order_time_in_force' with value from the configuration:"
303311
" {'entry': 'FOK', 'exit': 'GTC'}.",
304312
caplog,
305313
)
@@ -340,7 +348,9 @@ def test_strategy_override_use_exit_signal(caplog, default_conf):
340348

341349
assert not strategy.use_exit_signal
342350
assert isinstance(strategy.use_exit_signal, bool)
343-
assert log_has("Override strategy 'use_exit_signal' with value in config file: False.", caplog)
351+
assert log_has(
352+
"Override strategy 'use_exit_signal' with value from the configuration: False.", caplog
353+
)
344354

345355

346356
def test_strategy_override_use_exit_profit_only(caplog, default_conf):
@@ -367,7 +377,9 @@ def test_strategy_override_use_exit_profit_only(caplog, default_conf):
367377

368378
assert strategy.exit_profit_only
369379
assert isinstance(strategy.exit_profit_only, bool)
370-
assert log_has("Override strategy 'exit_profit_only' with value in config file: True.", caplog)
380+
assert log_has(
381+
"Override strategy 'exit_profit_only' with value from the configuration: True.", caplog
382+
)
371383

372384

373385
def test_strategy_max_open_trades_infinity_from_strategy(caplog, default_conf):

0 commit comments

Comments
 (0)