def test_get_pairs(config): assert util.get_pairs(config, "BTC") == _select_by_base_or_quote(FULL_PAIRS_LIST, "BTC") assert util.get_pairs(config, "ICX") == ["ICX/BTC"] # with disabled currency config[commons_constants.CONFIG_CRYPTO_CURRENCIES]["Bitcoin"][commons_constants.CONFIG_ENABLED_OPTION] = False assert util.get_pairs(config, "BTC", enabled_only=False) == _select_by_base_or_quote(FULL_PAIRS_LIST, "BTC") assert util.get_pairs(config, "BTC", enabled_only=True) != _select_by_base_or_quote(FULL_PAIRS_LIST, "BTC") assert util.get_pairs(config, "BTC", enabled_only=True) == _filter_by_base(_select_by_base_or_quote(FULL_PAIRS_LIST, "BTC"), "BTC")
async def cancel_all_open_orders_with_currency(self, currency): """ Should be called only if the goal is to cancel all open orders for each traded symbol containing the given currency. :param currency: Currency to find trading pairs to cancel orders on. :return: None """ symbols = get_pairs(self.config, currency) if symbols: for symbol in symbols: await self.cancel_open_orders(symbol)
async def cancel_all_open_orders_with_currency(self, currency) -> bool: """ Should be called only if the goal is to cancel all open orders for each traded symbol containing the given currency. :param currency: Currency to find trading pairs to cancel orders on. :return: True if all orders got cancelled, False if an error occurred """ all_cancelled = True symbols = util.get_pairs(self.config, currency, enabled_only=True) if symbols: for symbol in symbols: all_cancelled = await self.cancel_open_orders( symbol) and all_cancelled return all_cancelled
async def cancel_all_open_orders_with_currency(self, currency): symbols = get_pairs(self.config, currency) if symbols: for symbol in symbols: await self.cancel_open_orders(symbol)