Kraken also allows users to margin trade with leverage and hold short positions. In this scenario the stop loss would be for when the price goes above a certain threshold. For example, when somebody shorts BTC at 6400 EUR, he might expect BTC to fall down below 6000 EUR and thus profit from the short. However, he might also place a stop loss order at 6500 EUR in case BTC price further shoots through the roof. An implementation would be to query the total amount of short positions held by the user and then place a leveraged buy order to close all those positions when the price goes above the predefined threshold.
Kraken also allows users to margin trade with leverage and hold short positions. In this scenario the stop loss would be for when the price goes above a certain threshold. For example, when somebody shorts BTC at 6400 EUR, he might expect BTC to fall down below 6000 EUR and thus profit from the short. However, he might also place a stop loss order at 6500 EUR in case BTC price further shoots through the roof. An implementation would be to query the total amount of short positions held by the user and then place a leveraged buy order to close all those positions when the price goes above the predefined threshold.