def fetch_markets_by_type(self, type, params={}):
    if (type == 'option'):
        underlying = self.optionGetUnderlying(params)
        result = []
        for i in range(0, len(underlying)):
            response = self.optionGetInstrumentsUnderlying({'underlying': underlying[i]})
            result = self.array_concat(result, response)
        return self.parse_markets(result)
    elif ((type == 'spot') or (type == 'futures') or (type == 'swap')):
        method = (type + 'GetInstruments')
        response = getattr(self, method)(params)
        return self.parse_markets(response)
    else:
        raise NotSupported(((self.id + ' fetchMarketsByType does not support market type ') + type))
def fetch_markets_by_type(self, type, params={}):
    if (type == 'option'):
        underlying = self.optionGetUnderlying(params)
        result = []
        for i in range(0, len(underlying)):
            response = self.optionGetInstrumentsUnderlying({'underlying': underlying[i]})
            result = self.array_concat(result, response)
        return self.parse_markets(result)
    elif ((type == 'spot') or (type == 'futures') or (type == 'swap')):
        method = (type + 'GetInstruments')
        response = getattr(self, method)(params)
        return self.parse_markets(response)
    else:
        raise NotSupported(((self.id + ' fetchMarketsByType does not support market type ') + type))