Send the user a message when an asset restriction is hit

This commit is contained in:
2023-02-11 18:25:09 +00:00
parent 313c7f79d0
commit da9f32e882
2 changed files with 15 additions and 9 deletions

View File

@@ -328,12 +328,18 @@ def execute_strategy(callback, strategy, func):
# Callback now verified
# Check against the asset groups
if func == "entry":
if strategy.assetgroup is not None:
allowed = assetfilter.get_allowed(strategy, symbol, direction)
if not allowed:
log.debug(f"Asset trading not allowed for {strategy}: {symbol}")
return
if func == "entry" and strategy.assetgroup is not None:
allowed = assetfilter.get_allowed(strategy, symbol, direction)
if not allowed:
log.debug(
f"Denied trading {symbol} due to asset filter {strategy.assetgroup}"
)
sendmsg(
user,
f"Denied trading {symbol} due to asset filter {strategy.assetgroup}",
title="Asset filter denied",
)
return
if func == "exit":
check_exit = crossfilter(account, symbol, direction, func)