def METHOD_NAME(default_conf, mocker, limitratio, expected, side, order_type):
    api_mock = MagicMock()
    order_id = f'test_prod_buy_{randint(0, 10 ** 6)}'
    api_mock.create_order = MagicMock(return_value={
        'id': order_id,
        'info': {
            'foo': 'bar'
        }
    })
    default_conf['dry_run'] = False
    mocker.patch(f'{EXMS}.amount_to_precision', lambda s, x, y: y)
    mocker.patch(f'{EXMS}.price_to_precision', lambda s, x, y, **kwargs: y)
    exchange = get_patched_exchange(mocker, default_conf, api_mock, 'kucoin')
    if order_type == 'limit':
        with pytest.raises(InvalidOrderException):
            order = exchange.create_stoploss(pair='ETH/BTC', amount=1, stop_price=190,
                                             order_types={
                                                 'stoploss': order_type,
                                                 'stoploss_on_exchange_limit_ratio': 1.05},
                                             side=side, leverage=1.0)
    api_mock.create_order.reset_mock()
    order_types = {'stoploss': order_type}
    if limitratio is not None:
        order_types.update({'stoploss_on_exchange_limit_ratio': limitratio})
    order = exchange.create_stoploss(pair='ETH/BTC', amount=1, stop_price=220,
                                     order_types=order_types, side=side, leverage=1.0)
    assert 'id' in order
    assert 'info' in order
    assert order['id'] == order_id
    assert api_mock.create_order.call_args_list[0][1]['symbol'] == 'ETH/BTC'
    assert api_mock.create_order.call_args_list[0][1]['type'] == order_type
    assert api_mock.create_order.call_args_list[0][1]['side'] == 'sell'
    assert api_mock.create_order.call_args_list[0][1]['amount'] == 1
    # Price should be 1% below stopprice
    if order_type == 'limit':
        assert api_mock.create_order.call_args_list[0][1]['price'] == expected
    else:
        assert api_mock.create_order.call_args_list[0][1]['price'] is None
    assert api_mock.create_order.call_args_list[0][1]['params'] == {
        'stopPrice': 220,
        'stop': 'loss'
    }
    # test exception handling
    with pytest.raises(DependencyException):
        api_mock.create_order = MagicMock(side_effect=ccxt.InsufficientFunds("0 balance"))
        exchange = get_patched_exchange(mocker, default_conf, api_mock, 'kucoin')
        exchange.create_stoploss(pair='ETH/BTC', amount=1, stop_price=220,
                                 order_types={}, side=side, leverage=1.0)
    with pytest.raises(InvalidOrderException):
        api_mock.create_order = MagicMock(
            side_effect=ccxt.InvalidOrder("kucoin Order would trigger immediately."))
        exchange = get_patched_exchange(mocker, default_conf, api_mock, 'kucoin')
        exchange.create_stoploss(pair='ETH/BTC', amount=1, stop_price=220,
                                 order_types={}, side=side, leverage=1.0)
    ccxt_exceptionhandlers(mocker, default_conf, api_mock, "kucoin",
                           "create_stoploss", "create_order", retries=1,
                           pair='ETH/BTC', amount=1, stop_price=220, order_types={},
                           side=side, leverage=1.0)