@@ -97,15 +97,19 @@ def get_script_from_module(module):
97
97
98
98
async def reload_scripts (self ):
99
99
for is_live in (False , True ):
100
- module = self .__class__ .TRADING_SCRIPT_MODULE if is_live else self .__class__ .BACKTESTING_SCRIPT_MODULE
101
- importlib .reload (module )
102
- self .register_script_module (module , live = is_live )
103
- # reload config
104
- await self .reload_config (self .exchange_manager .bot_id )
105
- if is_live :
106
- # todo cancel and restart live tasks
107
- await self .start_over_database ()
108
-
100
+ if ((is_live and self .__class__ .TRADING_SCRIPT_MODULE )
101
+ or (not is_live and self .__class__ .BACKTESTING_SCRIPT_MODULE )):
102
+ module = (self .__class__ .TRADING_SCRIPT_MODULE
103
+ if is_live
104
+ else self .__class__ .BACKTESTING_SCRIPT_MODULE )
105
+ importlib .reload (module )
106
+ self .register_script_module (module , live = is_live )
107
+ # reload config
108
+ await self .reload_config (self .exchange_manager .bot_id )
109
+ if is_live :
110
+ # todo cancel and restart live tasks
111
+ await self .start_over_database ()
112
+
109
113
async def start_over_database (self ):
110
114
await modes_util .clear_plotting_cache (self )
111
115
symbol_db = databases .RunDatabasesProvider .instance ().get_symbol_db (self .bot_id ,
@@ -267,7 +271,8 @@ async def call_script(self, matrix_id: str, cryptocurrency: str, symbol: str, ti
267
271
run_data_writer = databases .RunDatabasesProvider .instance ().get_run_db (self .exchange_manager .bot_id )
268
272
try :
269
273
await self ._pre_script_call (context )
270
- await self .trading_mode .get_script (live = True )(context )
274
+ if hasattr (self .trading_mode , "TRADING_SCRIPT_MODULE" ) and self .trading_mode .TRADING_SCRIPT_MODULE :
275
+ await self .trading_mode .get_script (live = True )(context )
271
276
except errors .UnreachableExchange :
272
277
raise
273
278
except (commons_errors .MissingDataError , commons_errors .ExecutionAborted ) as e :
0 commit comments