await binance.futuresOrder( symbol,closeSide, 0, undefined, {
type: 'TAKE_PROFIT',
stopPrice: tpPrice,
reduceOnly: true,
workingType: 'MARK_PRICE',
closePosition:true,
timeInForce: 'GTC'
});
Hey,
Could you provide more information on the library you’re using to make this request, or share the final URL with the parameters?
Sure ,
I’m using binance-node-api,
here is instance code :
const binance = new Binance().options({
APIKEY: apiKey,
APISECRET: apiSecret,
httpBase: 'https://testnet.binancefuture.com', // Important
test:true,
default_type:"futures"
});
I am using One Way Mode and market purchase order is being triggered sucessfully.
but for tp and Sl i am getting invalid order type again & again.
let tpOrder = await binance.futuresOrder(
symbol,
'SELL',
0, // quantity 0 because closePosition: true
undefined,
{
type: 'TAKE_PROFIT_MARKET',
stopPrice: 122000, // Adjust this for current market price
closePosition: true,
reduceOnly: true,
workingType: 'MARK_PRICE',
timeInForce: 'GTC'
}
);
As API doesn’t support TP/SL, I recommend referring to the post below for instructions on placing a TP/SL order indirectly: How to implement OTOCO(TP/SL) orders using API - #24 by gold-er