def has_deposit_fee_for_currency(exchange, currency): """ Checks if the given exchange supports the deposit of the specified currency. :param exchange: an exchange (as Exchange) :param currency: a currency (as str) :return: True/False """ check_isinstance_exchange(exchange) check_isinstance_string(currency) if has_funding_fees(exchange): try: depo = exchange.fees['funding']['deposit'] if currency in depo: if depo[currency] == 0: return False else: return True else: return False except: return False else: return False
def get_all_base_currencies_at_exchange(exchange): """Returns all currencies that are available as base currency.""" check_isinstance_exchange(exchange) bases = [] for market in exchange.markets: currency = exchange.markets[market]['base'] if not currency in bases: bases.append(currency) return bases
def has_deposit_fees_for_any_its_currencies(exchange): check_isinstance_exchange(exchange) if has_funding_fees(exchange): try: depo = exchange.fees['funding']['deposit'] for price in depo.values(): if price != 0: return True except (KeyError, TypeError, AttributeError) as e: print(e) return False
def get_all_quote_currencies_at_exchange(exchange): """Returns all currencies that are available as quote currency.""" check_isinstance_exchange(exchange) quotes = [] for market in exchange.markets: currency = exchange.markets[market]['quote'] if not currency in quotes: quotes.append(currency) return quotes
def is_currency_available_at_exchange(exchange, currency): """Checks if the currency is available at the exchange.""" check_isinstance_exchange(exchange) check_isinstance_string(currency) currency.upper() for market in exchange.markets: if (exchange.markets[market]['base'] == currency) \ or (exchange.markets[market]['quote'] == currency): return True return False
def are_bases_available_at_exchange(exchange, bases): """ Checks if the specified bases are available at the given exchange. :param exchange: an exchange (as Exchange) :param base: a list of base currencies (as str) :return: Boolean """ check_isinstance_exchange(exchange) check_isinstance_list(bases) mask = [] for base in bases: mask.append(is_base_available_at_exchange(exchange, base)) return mask
def are_quotes_available_at_exchange(exchange, quotes): """ Checks if the specified quotes are available at the given exchange. :param exchange: an exchange (as Exchange) :param quote: a list of quote currencies (as str) :return: Boolean """ check_isinstance_exchange(exchange) check_isinstance_list(quotes) mask = [] for quote in quotes: mask.append(is_quote_available_at_exchange(exchange, quote)) return mask
def is_base_available_at_exchange(exchange, base): """ Checks if the specified base is available at the given exchange. :param exchange: an exchange (as Exchange) :param base: a base currency (as str) :return: Boolean """ check_isinstance_exchange(exchange) check_isinstance_string(base) bases = get_all_base_currencies_at_exchange(exchange) if base in bases: return True else: return False
def has_deposit_fees_for_any_given_currency(exchange, currencies): """ Checks if the given exchange supports the deposit of the specified currencies. :param exchange: an exchange (as Exchange) :param currencies: a list of currencies (as str) :return: True/False """ check_isinstance_exchange(exchange) check_isinstance_list(currencies) for currency in currencies: if has_deposit_fee_for_currency(exchange, currency): return True return False
def are_currencies_available_at_exchange(exchange, currencies): """ Checks if the specified currencies are available at the given exchange. :param exchange: an exchange (as Exchange) :param currencies: a list of currencies (as str) :return: a list of Boolean values """ check_isinstance_exchange(exchange) check_isinstance_list(currencies) mask = [] for currency in currencies: mask.append(is_currency_available_at_exchange(exchange, currency)) return mask
def is_quote_available_at_exchange(exchange, quote): """ Checks if the specified quote is available at the given exchange. :param exchange: an exchange (as Exchange) :param quote: a quote currency (as str) :return: Boolean """ check_isinstance_exchange(exchange) check_isinstance_string(quote) quotes = get_all_quote_currencies_at_exchange(exchange) if quote in quotes: return True else: return False
def get_currencies_with_deposit_fee_at_exchange(exchange): """ Returns all currencies that have a fee associated with them on the given exchange. :param exchange: an exchange (as Exchange) :return: a list of currencies """ check_isinstance_exchange(exchange) deposits = [] try: for currency, price in exchange.fees['funding']['deposit'].items(): if price != 0: deposits.append(currency) except (KeyError, TypeError, AttributeError) as e: print(exchange.id, e) return deposits
def has_funding_fees(exchange): # TODO: This is not correct. Just because there is an entry doesn't mean it has fees. Could be 0... """Checks whether the exchange has funding fees. (via/in ccxt)""" check_isinstance_exchange(exchange) return bool(exchange.fees['funding'])
def get_all_currencies_at_exchange(exchange): """Returns all available currencies at the exchange.""" check_isinstance_exchange(exchange) return exchange.currencies