question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FuturesUsdt.Order.PlaceOrder TakeProfitLimit working?

See original GitHub issue

Thanks again for this wrapper - the best Binance Wrapper I have come across!

I have got the following code, but I was hoping you could kindly guide me through how to set TakeProfit in the same order placement. Is that possible?

Basically, in my code below I have got everything I need except for a takeProfitPrice optional parameter.

        public override bool PlaceBuyOrder(TradingData trade, bool closePosition)
        {
            using (var client = new BinanceClient())
            {
                var buyOrder = client.FuturesUsdt.Order.PlaceOrder(
                   trade.CoinPair.ToString(),
                   OrderSide.Buy,
                   OrderType.Limit,
                   quantity: Math.Round(trade.CoinQuantityToTrade, 3),
                   reduceOnly: closePosition,
                   price: Math.Round(trade.Price, 2),
                   timeInForce: TimeInForce.GoodTillCancel);

                if (buyOrder.Success)
                    trade.BuyOrderID = buyOrder.Data.OrderId;
                else
                    Console.WriteLine(buyOrder.Error.Message.ToString());

                return buyOrder.Success;
            }
        }

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
McoreDcommented, Nov 28, 2020

Hi @JKorf ,

Strangely, I did not get the desired outcome. I got the following error: Invalid order type Instead I used the following function twice (one to open, and one to close using the reduceOnly): This is not ideal but works.

                var sellOrder = client.FuturesUsdt.Order.PlaceOrder(
                   trade.CoinPair.ToString(),
                   OrderSide.Sell,
                   OrderType.Limit,
                   quantity: Math.Round(trade.CoinQuantityToTrade, 3),
                   reduceOnly: closePosition,
                   price: Math.Round(trade.Price, 2),
                   timeInForce: TimeInForce.GoodTillCancel);

Wonder why simply changing OrderType.Limit to OrderType.TakeProfitLimit and using stopPrice broke it?

0reactions
JKorfcommented, May 31, 2021

If it’s not supported/allowed by the Binance API there’s not much I can do about it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Binance Futures - problem creating Take Profit ...
First I send a limit order to open a long/short position. Right after that I can send an equivalent but opposite take profit...
Read more >
USDT-T - Cryptorg.net
Specify a trigger price to activate the order. It can be used to set a Stop Loss Limit, or Take Profit Limit Order....
Read more >
How To Take Profit On Binance
Profitable trading on Binance Futures USDT-margin with the bot. ... However, in Multiple Take Profits, you are spreading your Take Profit limit order...
Read more >
Untitled
Bitsgap Help Center. Successfully & Safely. 2.Trading cryptocurrency futures lets you be part of the crypto market movement through speculation.
Read more >
How To Sell Futures On Binance
Cryptocurrency Futures Defined and How They Work on. If you open a futures contract chart and feel that the! Margin is insufficient -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found