def get_allowed(group, symbol, direction): """ Determine whether the trade is allowed according to the Asset Groups linked to the strategy. """ # TODO: figure out what to do with direction allowed = group.allowed if not isinstance(allowed, dict): return False if symbol not in allowed: return True return allowed[symbol] def check_asset_aggregation(value, trigger_above, trigger_below): """ Check if the value is within the bounds of the aggregation """ # If both are defined if trigger_above is not None and trigger_below is not None: if value > trigger_above and value < trigger_below: return True return False if trigger_below is not None: if value < trigger_below: # Value is less than lower bound, match return True if trigger_above is not None: if value > trigger_above: return True return False