Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get limit order sl tp order data #1005

Open
sinaptech opened this issue Feb 22, 2022 · 11 comments
Open

get limit order sl tp order data #1005

sinaptech opened this issue Feb 22, 2022 · 11 comments

Comments

@sinaptech
Copy link

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

@sinaptech
Copy link
Author

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

@eros1453
Copy link

eros1453 commented Mar 7, 2022

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

@sinaptech
Copy link
Author

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

@eros1453
Copy link

eros1453 commented Mar 7, 2022

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`

@sinaptech
Copy link
Author

@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
Copy link
Author

sinaptech commented Mar 8, 2022

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

@sinaptech
Copy link
Author

@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

@eros1453
Copy link

eros1453 commented Mar 8, 2022

@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

@sinaptech
Copy link
Author

@eros1453 @JKorf I have still confused in creating limit order with SL and TP limit order like #1005 (comment)
I want to know If I can place order with this package like the above screenshots.

@eros1453
Copy link

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

@urbanchaman
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@sinaptech @eros1453 @urbanchaman and others