Binance.Net icon indicating copy to clipboard operation
Binance.Net copied to clipboard

get limit order sl tp order data

Open sinaptech opened this issue 3 years ago • 11 comments

Hi. for futures api USDT please help me how to get SL and TP limit order when the main order is limit too?

sinaptech avatar Feb 22 '22 13:02 sinaptech

How are you going to do the 50 other things you need to do to place an order if you can't figure this out?

This isn't an issue.

HypsyNZ avatar Mar 03 '22 01:03 HypsyNZ

@HypsyNZ You do not have to worry about the rest. If you know this, help me, if not, you do not need to answer

sinaptech avatar Mar 07 '22 23:03 sinaptech

This is for TP : var startTP = await bfc.UsdFuturesApi.Trading.PlaceOrderAsync(ASSET, side: OrderSide.Sell, positionSide: PositionSide.Long, type: FuturesOrderType.TakeProfit, quantity: long_quantity, price: long_price, stopPrice: actpr, timeInForce: TimeInForce.GoodTillCanceled); You can make await order than => if(PositionLongOpenOrder.Success) { .... } For TP/SL you have to use STOP/TAKE_PROFIT | quantity, price, stopPrice

eros1453 avatar Mar 07 '22 23:03 eros1453

@eros1453 Thank you. Is it works on Both Cross and Isolated?

sinaptech avatar Mar 07 '22 23:03 sinaptech

yes for me But try it on both way, sometimes when you miss the order on one side it will close the other side positionb on 'Hedge mode`

eros1453 avatar Mar 07 '22 23:03 eros1453

@eros1453 Hi. I place an order with the following parameter values first for the limit order: Order Side: Sell, Order Type: Limit, Quantity: 5 ADA, PositionSide: Short, TimeInForce: TimeInForce.GoodTillCancel, Price: 1.25

after success result I place another order for SL Limit as follows: Order Side: Buy, Order Type: Stop, Quantity: 5 ADA, PositionSide: Short, TimeInForce: TimeInForce.GoodTillCancel, Price: 1.25, StopPrice: 1.45

But at binance the result is not as expected. see screen shot please b1

sinaptech avatar Mar 08 '22 13:03 sinaptech

change order type Stop or StopLoss to StopLossLimit

https://github.com/JKorf/Binance.Net/issues/734#issuecomment-842780655

You are currently trying to place a market order at your stop price

HypsyNZ avatar Mar 08 '22 13:03 HypsyNZ

@HypsyNZ I have set order type to stoplosslimit. binance futures api return error Invalid orderType. Shouldn't I set closeposition=true??

sinaptech avatar Mar 08 '22 14:03 sinaptech

@JKorf is this a bug? How are they supposed to place a StopLoss Limit order if its an invalid type?

( I don't trade futures just trying to help) @sinaptech

HypsyNZ avatar Mar 08 '22 14:03 HypsyNZ

@JKorf @HypsyNZ I want to place a limit order with limit stoploss order too like the attached files in binance. I could not add stoploss order limit by this package. b3 b2

sinaptech avatar Mar 08 '22 14:03 sinaptech

@eros1453 Hi. I place an order with the following parameter values first for the limit order: Order Side: Sell, Order Type: Limit, Quantity: 5 ADA, PositionSide: Short, TimeInForce: TimeInForce.GoodTillCancel, Price: 1.25

after success result I place another order for SL Limit as follows: Order Side: Buy, Order Type: Stop, Quantity: 5 ADA, PositionSide: Short, TimeInForce: TimeInForce.GoodTillCancel, Price: 1.25, StopPrice: 1.45

But at binance the result is not as expected. see screen shot please b1

Its cause from limit price. the order is not executed immediately. I use orderbook and use the bestAsk or bestBuy price. On fast moving market it gets stuck sometimes. Its better to use market order for position opening for fast trades

eros1453 avatar Mar 08 '22 16:03 eros1453

@eros1453 @JKorf I have still confused in creating limit order with SL and TP limit order like https://github.com/JKorf/Binance.Net/issues/1005#issuecomment-1061823508 I want to know If I can place order with this package like the above screenshots.

sinaptech avatar Mar 12 '22 05:03 sinaptech

The limit order has to be partially filled before you place the second order

limit orders that are still "new" don't actually count.

HypsyNZ avatar Mar 12 '22 07:03 HypsyNZ

Best way is to send Limit order with custom Order ID and when you receive the result trough userdatastream Event: Order Update execute the SL/TP orders. That must be the logic

eros1453 avatar Mar 12 '22 19:03 eros1453

Best way is to send Limit order with custom Order ID and when you receive the result trough userdatastream Event: Order Update execute the SL/TP orders. That must be the logic

thank you my lord of humanity. you just cured my depression.

urbanchaman avatar Mar 27 '24 23:03 urbanchaman