node-binance-api
node-binance-api copied to clipboard
How to use trailing stop?
Hello,
I'm looking how to use TRAILING STOP for my bot. Currently, every 10s, I'm canceling my STOP LOSS, calculating the new value, and send a new STOP LOSS to Binance. It's not super safe and I saw TRAILING STOP is available in this node package... But how can I use it?
Process: I want to buy Bitcoin AT market and set a trailing stop loss at 3%. Every price move, my stop loss is re-setted (a trailing stop) at -3% of the last price
Thanks!
I need to do this like this?
let trailingStopLoss = await user.binance.futuresOrder("SELL", pair, user.quantityBought, false,
{
type: "TRAILING_STOP_MARKET",
callbackRate: user.stopLossInPercent,
reduceOnly: true
}
);
yes, something like this I think:
let result = await binance.futuresOrder('SELL', 'BTCUSDT', 0.1, null, {
type: "TRAILING_STOP_MARKET",
callbackRate: 2,
});