jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.
MIT License
1.58k stars 768 forks source link

stop loss and take profit on the same trade #786

Open MishiMish opened 2 years ago

MishiMish commented 2 years ago

Hey, anyone knows how I can put stop loss and take profit on the same trade? I couldn't find someone with a good answer that works for me.

ordimans commented 2 years ago

Hello

I think it's not possible

I used two call here.

Blaag28 commented 2 years ago

To place orders to open a long position, I use

//ORDER OPEN //await binance.futuresOrder('BUY', coin, amount)

//STOP-LOSS await binance.futuresOrder('SELL', coin, amount, false, { type: 'STOP_MARKET', workingType: 'MARK_PRICE', stopPrice: 0.0116, closePosition: true })

//TAKE_PROFIT_MARKET //await binance.futuresOrder('SELL', coin, amount, false, { type: 'TAKE_PROFIT_MARKET', workingType: 'MARK_PRICE', stopPrice: 0.01375, closePosition: true })

//LIMIT //await binance.futuresOrder('SELL', coin, amount / 3, false, { type: 'LIMIT', timeInForce: 'GTC', price: 0.012796, reduceOnly: true})

buckydroid commented 2 years ago

To place orders to open a long position, I use

//ORDER OPEN //await binance.futuresOrder('BUY', coin, amount)

//STOP-LOSS await binance.futuresOrder('SELL', coin, amount, false, { type: 'STOP_MARKET', workingType: 'MARK_PRICE', stopPrice: 0.0116, closePosition: true })

//TAKE_PROFIT_MARKET //await binance.futuresOrder('SELL', coin, amount, false, { type: 'TAKE_PROFIT_MARKET', workingType: 'MARK_PRICE', stopPrice: 0.01375, closePosition: true })

//LIMIT //await binance.futuresOrder('SELL', coin, amount / 3, false, { type: 'LIMIT', timeInForce: 'GTC', price: 0.012796, reduceOnly: true})

Is there any ways to auto close all SL or TP orders, once the original position is closed manually?

negst1994 commented 1 year ago

To have orders automatically closed, you need to specify an additional stop loss and take profit parameter: timeInForce: 'GTE_GTC'.

//ORDER OPEN //await binance.futuresOrder('BUY', coin, amount)

//STOP-LOSS await binance.futuresOrder('SELL', coin, amount, false, { type: 'STOP_MARKET', workingType: 'MARK_PRICE', stopPrice: 0.0116, closePosition: true, timeInForce: 'GTE_GTC' })

//TAKE_PROFIT_MARKET //await binance.futuresOrder('SELL', coin, amount, false, { type: 'TAKE_PROFIT_MARKET', workingType: 'MARK_PRICE', stopPrice: 0.01375, closePosition: true, timeInForce: 'GTE_GTC' })

skarbenic commented 1 year ago

To have orders automatically closed, you need to specify an additional stop loss and take profit parameter: timeInForce: 'GTE_GTC'.

//ORDER OPEN //await binance.futuresOrder('BUY', coin, amount)

//STOP-LOSS await binance.futuresOrder('SELL', coin, amount, false, { type: 'STOP_MARKET', workingType: 'MARK_PRICE', stopPrice: 0.0116, closePosition: true, timeInForce: 'GTE_GTC' })

//TAKE_PROFIT_MARKET //await binance.futuresOrder('SELL', coin, amount, false, { type: 'TAKE_PROFIT_MARKET', workingType: 'MARK_PRICE', stopPrice: 0.01375, closePosition: true, timeInForce: 'GTE_GTC' })

Hello, what does GTE mean in this context? I only know GTC as good till cancelled.. so far i used OTOCO to close another position when the initial position is closed manually and is looking other way to do it..