requirements thinned out again

StrategyResolver.search_all_objects(enum_failed) set to False since we got no use in True
shortened update_code call
added modified_code8 test which currently still fails. (and thereby is commented out)
This commit is contained in:
hippocritical 2023-01-02 20:45:56 +01:00
parent 66f7c91357
commit 0817e1698f
4 changed files with 17 additions and 22 deletions

View File

@ -22,7 +22,7 @@ def start_strategy_update(args: Dict[str, Any]) -> None:
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE) config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
strategy_objs = StrategyResolver.search_all_objects( strategy_objs = StrategyResolver.search_all_objects(
config, enum_failed=True, recursive=config.get('recursive_strategy_search', False)) config, enum_failed=False, recursive=config.get('recursive_strategy_search', False))
filtered_strategy_objs = [] filtered_strategy_objs = []
for args_strategy in args['strategy_list']: for args_strategy in args['strategy_list']:

View File

@ -69,7 +69,7 @@ class StrategyUpdater:
shutil.copy(source_file, target_file) shutil.copy(source_file, target_file)
# update the code # update the code
new_code = StrategyUpdater.update_code(self, old_code) new_code = self.update_code(old_code)
# write the modified code to the destination folder # write the modified code to the destination folder
with open(source_file, 'w') as f: with open(source_file, 'w') as f:
f.write(new_code) f.write(new_code)
@ -113,7 +113,8 @@ class NameUpdater(ast.NodeTransformer):
def check_fields(self, field_value): def check_fields(self, field_value):
if isinstance(field_value, list): if isinstance(field_value, list):
for item in field_value: for item in field_value:
if isinstance(item, ast.AST) or isinstance(item, ast.If): if (isinstance(item, ast.AST) or isinstance(item, ast.If) or
isinstance(item, ast.Expr)):
self.visit(item) self.visit(item)
if isinstance(field_value, ast.Name): if isinstance(field_value, ast.Name):
self.visit_Name(field_value) self.visit_Name(field_value)
@ -138,6 +139,7 @@ class NameUpdater(ast.NodeTransformer):
if hasattr(node, "args"): if hasattr(node, "args"):
if isinstance(node.args, list): if isinstance(node.args, list):
for arg in node.args: for arg in node.args:
if arg.arg in StrategyUpdater.name_mapping:
arg.arg = StrategyUpdater.name_mapping[arg.arg] arg.arg = StrategyUpdater.name_mapping[arg.arg]
return node return node

View File

@ -58,22 +58,4 @@ schedule==1.1.0
websockets==10.4 websockets==10.4
janus==1.0.0 janus==1.0.0
pytest~=7.2.0
freqtrade~=2022.12.dev0
filelock~=3.8.2
plotly~=5.11.0
setuptools~=65.6.3
starlette~=0.22.0
gym~=0.21.0
torch~=1.13.1
scikit-learn~=1.1.3
scipy~=1.9.3
xgboost~=1.7.2
catboost~=1.1.1
lightgbm~=3.3.3
astor~=0.8.1 astor~=0.8.1
ta~=0.10.2
finta~=1.3
tapy~=1.9.1
matplotlib~=3.6.2
PyYAML~=6.0

View File

@ -59,6 +59,11 @@ def confirm_trade_exit(sell_reason):
if (sell_reason == 'stop_loss'): if (sell_reason == 'stop_loss'):
pass pass
""") """)
# modified_code8 = StrategyUpdater.update_code(StrategyUpdater, """
# sell_reason == 'sell_signal'
# sell_reason == 'force_sell'
# sell_reason == 'emergency_sell'
# """)
assert "populate_entry_trend" in modified_code1 assert "populate_entry_trend" in modified_code1
assert "populate_exit_trend" in modified_code1 assert "populate_exit_trend" in modified_code1
@ -93,3 +98,9 @@ def confirm_trade_exit(sell_reason):
assert "exit_reason" in modified_code7 assert "exit_reason" in modified_code7
assert "exit_reason == 'stop_loss'" in modified_code7 assert "exit_reason == 'stop_loss'" in modified_code7
# those tests currently don't work, next in line.
# assert "exit_signal" in modified_code8
# assert "exit_reason" in modified_code8
# assert "force_exit" in modified_code8
# assert "emergency_exit" in modified_code8