Separate live tests for active management
This commit is contained in:
@@ -46,34 +46,34 @@ def within_callback_price_deviation(strategy, price, current_price):
|
||||
|
||||
def within_trends(strategy, symbol, direction):
|
||||
if strategy.trend_signals.exists():
|
||||
if len(strategy.trend_signals.all()) > 0:
|
||||
if strategy.trends is None:
|
||||
log.debug("Refusing to trade with no trend signals received")
|
||||
if strategy.trends is None:
|
||||
log.debug("Refusing to trade with no trend signals received")
|
||||
sendmsg(
|
||||
strategy.user,
|
||||
f"Refusing to trade {symbol} with no trend signals received",
|
||||
title="Trend not ready",
|
||||
)
|
||||
return None
|
||||
if symbol not in strategy.trends:
|
||||
log.debug("Refusing to trade asset without established trend")
|
||||
sendmsg(
|
||||
strategy.user,
|
||||
f"Refusing to trade {symbol} without established trend",
|
||||
title="Trend not ready",
|
||||
)
|
||||
return None
|
||||
else:
|
||||
if strategy.trends[symbol] != direction:
|
||||
log.debug("Refusing to trade against the trend")
|
||||
sendmsg(
|
||||
strategy.user,
|
||||
f"Refusing to trade {symbol} with no trend signals received",
|
||||
title="Trend not ready",
|
||||
f"Refusing to trade {symbol} against the trend",
|
||||
title="Trend rejection",
|
||||
)
|
||||
return None
|
||||
if symbol not in strategy.trends:
|
||||
log.debug("Refusing to trade asset without established trend")
|
||||
sendmsg(
|
||||
strategy.user,
|
||||
f"Refusing to trade {symbol} without established trend",
|
||||
title="Trend not ready",
|
||||
)
|
||||
return None
|
||||
return False
|
||||
else:
|
||||
if strategy.trends[symbol] != direction:
|
||||
log.debug("Refusing to trade against the trend")
|
||||
sendmsg(
|
||||
strategy.user,
|
||||
f"Refusing to trade {symbol} against the trend",
|
||||
title="Trend rejection",
|
||||
)
|
||||
return False
|
||||
else:
|
||||
log.debug(f"Trend check passed for {symbol} - {direction}")
|
||||
return True
|
||||
log.debug("No trend signals configured")
|
||||
return True
|
||||
log.debug(f"Trend check passed for {symbol} - {direction}")
|
||||
return True
|
||||
else:
|
||||
log.debug("No trend signals configured")
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user