def fetch_ohlcv(self, symbol, timeframe='1m', since=None, limit=None, params={}):
    self.load_markets()
    market = self.market(symbol)
    duration = self.parse_timeframe(timeframe)
    request = {'instrument_id': market['id'], 'granularity': self.timeframes[timeframe]}
    options = self.safe_value(self.options, 'fetchOHLCV', {})
    defaultType = self.safe_string(options, 'type', 'Candles')
    type = self.safe_string(params, 'type', defaultType)
    params = self.omit(params, 'type')
    method = ((market['type'] + 'GetInstrumentsInstrumentId') + type)
    if (type == 'Candles'):
        if (since is not None):
            if (limit is not None):
                request['end'] = self.iso8601(self.sum(since, ((limit * duration) * 1000)))
            request['start'] = self.iso8601(since)
        elif (limit is not None):
            now = self.milliseconds()
            request['start'] = self.iso8601((now - ((limit * duration) * 1000)))
            request['end'] = self.iso8601(now)
    elif (type == 'HistoryCandles'):
        if market['option']:
            raise NotSupported((((((self.id + ' fetchOHLCV does not have ') + type) + ' for ') + market['type']) + ' markets'))
        if (since is not None):
            if (limit is None):
                limit = 300
            request['start'] = self.iso8601(self.sum(since, ((limit * duration) * 1000)))
            request['end'] = self.iso8601(since)
        elif (limit is not None):
            now = self.milliseconds()
            request['end'] = self.iso8601((now - ((limit * duration) * 1000)))
            request['start'] = self.iso8601(now)
    response = getattr(self, method)(self.extend(request, params))
    return self.parse_ohlcvs(response, market, timeframe, since, limit)
def fetch_ohlcv(self, symbol, timeframe='1m', since=None, limit=None, params={}):
    self.load_markets()
    market = self.market(symbol)
    duration = self.parse_timeframe(timeframe)
    request = {'instrument_id': market['id'], 'granularity': self.timeframes[timeframe]}
    options = self.safe_value(self.options, 'fetchOHLCV', {})
    defaultType = self.safe_string(options, 'type', 'Candles')
    type = self.safe_string(params, 'type', defaultType)
    params = self.omit(params, 'type')
    method = ((market['type'] + 'GetInstrumentsInstrumentId') + type)
    if (type == 'Candles'):
        if (since is not None):
            if (limit is not None):
                request['end'] = self.iso8601(self.sum(since, ((limit * duration) * 1000)))
            request['start'] = self.iso8601(since)
        elif (limit is not None):
            now = self.milliseconds()
            request['start'] = self.iso8601((now - ((limit * duration) * 1000)))
            request['end'] = self.iso8601(now)
    elif (type == 'HistoryCandles'):
        if market['option']:
            raise NotSupported((((((self.id + ' fetchOHLCV does not have ') + type) + ' for ') + market['type']) + ' markets'))
        if (since is not None):
            if (limit is None):
                limit = 300
            request['start'] = self.iso8601(self.sum(since, ((limit * duration) * 1000)))
            request['end'] = self.iso8601(since)
        elif (limit is not None):
            now = self.milliseconds()
            request['end'] = self.iso8601((now - ((limit * duration) * 1000)))
            request['start'] = self.iso8601(now)
    response = getattr(self, method)(self.extend(request, params))
    return self.parse_ohlcvs(response, market, timeframe, since, limit)