Open marioanloru opened 3 years ago
all is working, my example:
to place buy limit
ret = await binance.futuresBuy(future_profit_obj.pair, future_profit_obj.bought_coins, current_price, {
newClientOrderId: my_order_id_market,
timeInForce: "GTC"
});
to place stop loss market
let ret2 = await binance.futuresMarketSell(future_profit_obj.pair, future_profit_obj.bought_coins, {
newClientOrderId: my_order_id_sl,
type: "STOP_MARKET",
stopPrice: future_profit_obj.stop_loss_price,
priceProtect: true
});
to place take profit limit
let ret3 = await binance.futuresSell(future_profit_obj.pair, future_profit_obj.bought_coins, future_profit_obj.take_profit_price, {
newClientOrderId: my_order_id_tp,
stopPrice: future_profit_obj.take_profit_price,
type: "TAKE_PROFIT",
timeInForce: "GTC",
priceProtect: true
});
@marioanloru did you manage to solve this?
@franalt no I did not, I did try again and it somehow it did not work either, I have another version using the Binance python SDK which is the one I am finally using at least for now
Whats your Telegram?
Whats your Telegram?
Hey, could you help me as well with something? I'm trying to put stop loss and take profit on trade but can only do 1 of them.
Yeah, I got to the exact same problem, I want to give stop loss and take profit at the same time but it just seems unavailable. If there is an answer please make it public.
I am also having this issue, a solution would be greatly appreciated!
I cannot find how to place a stop_loss and take_profit order for an open position in futures using node-binance-api.
I create my order using: await binance.futuresMarketSell( 'BTCUSDT', 1); // market price is 60000
And try to take profit as follows: await binance.futuresBuy( 'BTCUSDT', 1, 65000); And this for stop loss: await binance.futuresBuy( 'BTCUSDT', 1, 58000);
Using type: 'STOP_LOSS' as 4th param does not work and returns errors. Current approach creates orders in finance history with "EXPIRED", which lets the position open without take_profit neither stop_loss active.
Thanks for the help!