def cancel_order(self, id, symbol=None, params={}):
    if (symbol is None):
        raise ArgumentsRequired((self.id + ' cancelOrder() requires a symbol argument'))
    self.load_markets()
    market = self.market(symbol)
    type = None
    if (market['futures'] or market['swap']):
        type = market['type']
    else:
        defaultType = self.safe_string_2(self.options, 'cancelOrder', 'defaultType', market['type'])
        type = self.safe_string(params, 'type', defaultType)
    if (type is None):
        raise ArgumentsRequired((self.id + " cancelOrder() requires a type parameter(one of 'spot', 'margin', 'futures', 'swap')."))
    method = (type + 'PostCancelOrder')
    request = {'instrument_id': market['id']}
    if (market['futures'] or market['swap']):
        method += 'InstrumentId'
    else:
        method += 's'
    clientOrderId = self.safe_string_2(params, 'client_oid', 'clientOrderId')
    if (clientOrderId is not None):
        method += 'ClientOid'
        request['client_oid'] = clientOrderId
    else:
        method += 'OrderId'
        request['order_id'] = id
    query = self.omit(params, ['type', 'client_oid', 'clientOrderId'])
    response = getattr(self, method)(self.extend(request, query))
    result = (response if ('result' in response) else self.safe_value(response, market['id'], {}))
    return self.parse_order(result, market)
def cancel_order(self, id, symbol=None, params={}):
    if (symbol is None):
        raise ArgumentsRequired((self.id + ' cancelOrder() requires a symbol argument'))
    self.load_markets()
    market = self.market(symbol)
    type = None
    if (market['futures'] or market['swap']):
        type = market['type']
    else:
        defaultType = self.safe_string_2(self.options, 'cancelOrder', 'defaultType', market['type'])
        type = self.safe_string(params, 'type', defaultType)
    if (type is None):
        raise ArgumentsRequired((self.id + " cancelOrder() requires a type parameter(one of 'spot', 'margin', 'futures', 'swap')."))
    method = (type + 'PostCancelOrder')
    request = {'instrument_id': market['id']}
    if (market['futures'] or market['swap']):
        method += 'InstrumentId'
    else:
        method += 's'
    clientOrderId = self.safe_string_2(params, 'client_oid', 'clientOrderId')
    if (clientOrderId is not None):
        method += 'ClientOid'
        request['client_oid'] = clientOrderId
    else:
        method += 'OrderId'
        request['order_id'] = id
    query = self.omit(params, ['type', 'client_oid', 'clientOrderId'])
    response = getattr(self, method)(self.extend(request, query))
    result = (response if ('result' in response) else self.safe_value(response, market['id'], {}))
    return self.parse_order(result, market)