def fetch_markets(self, params={}):
    response = self.publicGetAvailableBooks(params)
    markets = self.safe_value(response, 'payload')
    result = []
    for i in range(0, len(markets)):
        market = markets[i]
        id = self.safe_string(market, 'book')
        (baseId, quoteId) = id.split('_')
        base = baseId.upper()
        quote = quoteId.upper()
        base = self.safe_currency_code(base)
        quote = self.safe_currency_code(quote)
        fees = self.safe_value(market, 'fees', {})
        flatRate = self.safe_value(fees, 'flat_rate', {})
        takerString = self.safe_string(flatRate, 'taker')
        makerString = self.safe_string(flatRate, 'maker')
        taker = self.parse_number(Precise.string_div(takerString, '100'))
        maker = self.parse_number(Precise.string_div(makerString, '100'))
        feeTiers = self.safe_value(fees, 'structure', [])
        fee = {'taker': taker, 'maker': maker, 'percentage': True, 'tierBased': True}
        takerFees = []
        makerFees = []
        for j in range(0, len(feeTiers)):
            tier = feeTiers[j]
            volume = self.safe_number(tier, 'volume')
            takerFee = self.safe_number(tier, 'taker')
            makerFee = self.safe_number(tier, 'maker')
            takerFees.append([volume, takerFee])
            makerFees.append([volume, makerFee])
            if (j == 0):
                fee['taker'] = takerFee
                fee['maker'] = makerFee
        tiers = {'taker': takerFees, 'maker': makerFees}
        fee['tiers'] = tiers
        defaultPricePrecision = self.safe_number(self.options['precision'], quote, self.options['defaultPrecision'])
        result.append(self.extend({'id': id, 'symbol': ((base + '/') + quote), 'base': base, 'quote': quote, 'settle': None, 'baseId': baseId, 'quoteId': quoteId, 'settleId': None, 'type': 'spot', 'spot': True, 'margin': False, 'swap': False, 'future': False, 'option': False, 'active': None, 'contract': False, 'linear': None, 'inverse': None, 'taker': taker, 'maker': maker, 'contractSize': None, 'expiry': None, 'expiryDatetime': None, 'strike': None, 'optionType': None, 'precision': {'amount': self.safe_number(self.options['precision'], base, self.options['defaultPrecision']), 'price': self.safe_number(market, 'tick_size', defaultPricePrecision)}, 'limits': {'leverage': {'min': None, 'max': None}, 'amount': {'min': self.safe_number(market, 'minimum_amount'), 'max': self.safe_number(market, 'maximum_amount')}, 'price': {'min': self.safe_number(market, 'minimum_price'), 'max': self.safe_number(market, 'maximum_price')}, 'cost': {'min': self.safe_number(market, 'minimum_value'), 'max': self.safe_number(market, 'maximum_value')}}, 'info': market}, fee))
    return result
def fetch_markets(self, params={}):
    response = self.publicGetAvailableBooks(params)
    markets = self.safe_value(response, 'payload')
    result = []
    for i in range(0, len(markets)):
        market = markets[i]
        id = self.safe_string(market, 'book')
        (baseId, quoteId) = id.split('_')
        base = baseId.upper()
        quote = quoteId.upper()
        base = self.safe_currency_code(base)
        quote = self.safe_currency_code(quote)
        fees = self.safe_value(market, 'fees', {})
        flatRate = self.safe_value(fees, 'flat_rate', {})
        takerString = self.safe_string(flatRate, 'taker')
        makerString = self.safe_string(flatRate, 'maker')
        taker = self.parse_number(Precise.string_div(takerString, '100'))
        maker = self.parse_number(Precise.string_div(makerString, '100'))
        feeTiers = self.safe_value(fees, 'structure', [])
        fee = {'taker': taker, 'maker': maker, 'percentage': True, 'tierBased': True}
        takerFees = []
        makerFees = []
        for j in range(0, len(feeTiers)):
            tier = feeTiers[j]
            volume = self.safe_number(tier, 'volume')
            takerFee = self.safe_number(tier, 'taker')
            makerFee = self.safe_number(tier, 'maker')
            takerFees.append([volume, takerFee])
            makerFees.append([volume, makerFee])
            if (j == 0):
                fee['taker'] = takerFee
                fee['maker'] = makerFee
        tiers = {'taker': takerFees, 'maker': makerFees}
        fee['tiers'] = tiers
        defaultPricePrecision = self.safe_number(self.options['precision'], quote, self.options['defaultPrecision'])
        result.append(self.extend({'id': id, 'symbol': ((base + '/') + quote), 'base': base, 'quote': quote, 'settle': None, 'baseId': baseId, 'quoteId': quoteId, 'settleId': None, 'type': 'spot', 'spot': True, 'margin': False, 'swap': False, 'future': False, 'option': False, 'active': None, 'contract': False, 'linear': None, 'inverse': None, 'taker': taker, 'maker': maker, 'contractSize': None, 'expiry': None, 'expiryDatetime': None, 'strike': None, 'optionType': None, 'precision': {'amount': self.safe_number(self.options['precision'], base, self.options['defaultPrecision']), 'price': self.safe_number(market, 'tick_size', defaultPricePrecision)}, 'limits': {'leverage': {'min': None, 'max': None}, 'amount': {'min': self.safe_number(market, 'minimum_amount'), 'max': self.safe_number(market, 'maximum_amount')}, 'price': {'min': self.safe_number(market, 'minimum_price'), 'max': self.safe_number(market, 'maximum_price')}, 'cost': {'min': self.safe_number(market, 'minimum_value'), 'max': self.safe_number(market, 'maximum_value')}}, 'info': market}, fee))
    return result