Simplify strategy-resolver moving
This commit is contained in:
parent
158cb415a9
commit
3f669147f1
@ -45,10 +45,6 @@ class StrategyResolver(IResolver):
|
||||
strategy_name, config=config,
|
||||
extra_dir=config.get('strategy_path'))
|
||||
|
||||
# make sure ask_strategy dict is available
|
||||
if 'ask_strategy' not in config:
|
||||
config['ask_strategy'] = {}
|
||||
|
||||
if hasattr(strategy, 'ticker_interval') and not hasattr(strategy, 'timeframe'):
|
||||
# Assign ticker_interval to timeframe to keep compatibility
|
||||
if 'timeframe' not in config:
|
||||
@ -60,42 +56,36 @@ class StrategyResolver(IResolver):
|
||||
# Set attributes
|
||||
# Check if we need to override configuration
|
||||
# (Attribute name, default, subkey)
|
||||
attributes = [("minimal_roi", {"0": 10.0}, None),
|
||||
("timeframe", None, None),
|
||||
("stoploss", None, None),
|
||||
("trailing_stop", None, None),
|
||||
("trailing_stop_positive", None, None),
|
||||
("trailing_stop_positive_offset", 0.0, None),
|
||||
("trailing_only_offset_is_reached", None, None),
|
||||
("use_custom_stoploss", None, None),
|
||||
("process_only_new_candles", None, None),
|
||||
("order_types", None, None),
|
||||
("order_time_in_force", None, None),
|
||||
("stake_currency", None, None),
|
||||
("stake_amount", None, None),
|
||||
("protections", None, None),
|
||||
("startup_candle_count", None, None),
|
||||
("unfilledtimeout", None, None),
|
||||
("use_sell_signal", True, None),
|
||||
("sell_profit_only", False, None),
|
||||
("ignore_roi_if_buy_signal", False, None),
|
||||
("sell_profit_offset", 0.0, None),
|
||||
("disable_dataframe_checks", False, None),
|
||||
("ignore_buying_expired_candle_after", 0, None)
|
||||
attributes = [("minimal_roi", {"0": 10.0}),
|
||||
("timeframe", None),
|
||||
("stoploss", None),
|
||||
("trailing_stop", None),
|
||||
("trailing_stop_positive", None),
|
||||
("trailing_stop_positive_offset", 0.0),
|
||||
("trailing_only_offset_is_reached", None),
|
||||
("use_custom_stoploss", None),
|
||||
("process_only_new_candles", None),
|
||||
("order_types", None),
|
||||
("order_time_in_force", None),
|
||||
("stake_currency", None),
|
||||
("stake_amount", None),
|
||||
("protections", None),
|
||||
("startup_candle_count", None),
|
||||
("unfilledtimeout", None),
|
||||
("use_sell_signal", True),
|
||||
("sell_profit_only", False),
|
||||
("ignore_roi_if_buy_signal", False),
|
||||
("sell_profit_offset", 0.0),
|
||||
("disable_dataframe_checks", False),
|
||||
("ignore_buying_expired_candle_after", 0)
|
||||
]
|
||||
for attribute, default, subkey in attributes:
|
||||
if subkey:
|
||||
StrategyResolver._override_attribute_helper(strategy, config.get(subkey, {}),
|
||||
attribute, default)
|
||||
else:
|
||||
for attribute, default in attributes:
|
||||
StrategyResolver._override_attribute_helper(strategy, config,
|
||||
attribute, default)
|
||||
|
||||
# Loop this list again to have output combined
|
||||
for attribute, _, subkey in attributes:
|
||||
if subkey and attribute in config[subkey]:
|
||||
logger.info("Strategy using %s: %s", attribute, config[subkey][attribute])
|
||||
elif attribute in config:
|
||||
for attribute, _ in attributes:
|
||||
if attribute in config:
|
||||
logger.info("Strategy using %s: %s", attribute, config[attribute])
|
||||
|
||||
StrategyResolver._normalize_attributes(strategy)
|
||||
|
Loading…
Reference in New Issue
Block a user