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

Archiving Takeprofit and stoploss via the api #46

Open
pandglobal opened this issue Dec 27, 2022 · 3 comments
Open

Archiving Takeprofit and stoploss via the api #46

pandglobal opened this issue Dec 27, 2022 · 3 comments

Comments

@pandglobal
Copy link

I have been having issues with adding takeprofit and stoploss in my binance futures api.
I have been using the UI to trade futures and i can easily set Limit order and takeprofit and stoploss order at once.

Now with this API i have difficulty doing that.
These are things i have tried and their results:

  1. I have sent a Limit order with just price, quantity.
    then i send a second order Take_profit with same quality, price and stopprice, in this case my price and stop price are the same value, example 17000 for price and 17000 for stopprice.
    Then i sent the third order Stop similar to the Take_profit but with a lower price but same quantity.
    closeposition = true. on both STOP and TAKE_PROFIT
    but the outcome is this:
    if my limit orders where not filled, and the price gets to the takeprofit it will trigger with amount starting at -$4000 if that was the actual cost for buying that quantity of pair at 17000. yet but orders are not closed.

if limit order triggers first and then takeprofit orders gets triggered then only limit order and the takeprofit gets closed leaving the stoploss still opened.

but in the UI all orders are closed immediately takeprofit or Stoploss are closed.

Another thing is my amount for placing such orders are still counted individually, for example if it cost me $400 to place the limit order of 0.01 quantity of BTC, the order takeprofit and stoploss order i send will also be asking for a $400 each to have the orders placed, and if I only have $500 i get insufficient balance kind of error.

What am i not doing write and how can i effectively archive the takeprofit and stoploss workflow as it is in the UI of binance using this API

@pandglobal
Copy link
Author

I have also used reduceOnly = 'true'
for both take_profit and stoploss but the results is that once my order didn't get filled and the takeprofit or Stoploss is triggered it closes itself automatically without closing limit or stoploss orders.

@zhouaini528
Copy link
Owner

Sorry I didn't come across such a problem. The UI and API parameters are consistent, and the problem you mentioned will not occur. You should look at the API documentation more.

@pandglobal
Copy link
Author

Sorry I didn't come across such a problem. The UI and API parameters are consistent, and the problem you mentioned will not occur. You should look at the API documentation more.

Take a look at it again, the issue occurs with binance testnet but the live server is perfect.
I was testing it alongside a binance support team who said the issue is from their own end .

You may retest retest

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

2 participants