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

how to set reduce-only stop orders with futures? #873

Open
willoptions opened this issue Feb 11, 2023 · 1 comment
Open

how to set reduce-only stop orders with futures? #873

willoptions opened this issue Feb 11, 2023 · 1 comment

Comments

@willoptions
Copy link

willoptions commented Feb 11, 2023

Hi all - my application is sending multiple orders (as intended) - the first is a limit buy/sell, then the following order is to set a stop loss.

The issue is that these stop losses are being set as limit orders as well, taking the opposite side of the original trade (intended) - but they will stay in the books even after the original position is closed.

2 issues:
I can't get stop_market orders to work: "Parameter 'price' sent when not required." - when I remove 'price' it then says "Signature for this request is not valid."

I can't get the orders to behave like proper stop-losses, only resting limits for the opposite side of the trade.

Here's my code that works at creating stop limit orders, but they behave more like resting limits and I've found myself taking trades that I don't intend to because of it:

    if (side == "Sell" || side == "Short") {
        const ssr = await binance.futuresSell( symbol, size, price, {
            type: 'STOP',
            stopPrice: stopPrice} )

        res.send(ssr)
    }

    if (side == "Buy" || side == "Long") {
        const ssr = await binance.futuresBuy( symbol, size, price, {
            type: 'STOP',
            stopPrice: stopPrice} )
            
        res.send(ssr)
    }

What I'd like is to have it place stop_market reduce-only orders at the specified price, so I don't end up taking unintended trades if I forget to manually cancel them.

any help would be much appreciated, thank you

@GTedZ
Copy link

GTedZ commented Jul 1, 2023

I am not sure if the node-binance-api library supports reduceOnly options, but that could be your solution!

Just try adding reduceOnly: true to your options and that could be it!

If you want full documentation, try using binance-lib once v3.0.0 is out in a couple of days. It has full intellisense documentation along with the responses, including websockets!

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