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.

Futures PlaceOrder and - set up take profit

See original GitHub issue

I try to find solution about place order. How can i set Take profit when i place order?

var otwarte_pozycje = client.FuturesUsdt.Order.PlaceOrder("BTCUSDT", OrderSide.Sell, OrderType.Limit, 1, PositionSide.Short, TimeInForce.GoodTillCancel, price: 57000M); How can i set take profit or stop loss?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
eros1453commented, Mar 8, 2022

binance-test

0reactions
eros1453commented, Mar 8, 2022

You can mess with this code its for winform There is some logic you can miss, its getting the data from orderbook and winform app.

`private void BesLongLimitbutton_Click(object sender, EventArgs e) { Task.Run(async () => { LongTradeAmount = tradeable_balance * (Convert.ToDecimal(Properties.Settings.Default.TRADEPERCENT) / 100); decimal trade_amount = Math.Round(LongTradeAmount * Leverage / bestBid, QUANTITYPRECISION); BesLongOrder_TP = Math.Round(bestAsk, PRICEPRECISION); using (var bfc = new BinanceClient()) { var BesLongorder_SellResult = await bfc.UsdFuturesApi.Trading.PlaceOrderAsync(ASSET, side: OrderSide.Buy, positionSide: PositionSide.Long, type: FuturesOrderType.Limit, quantity: trade_amount, price: bestBid, timeInForce: TimeInForce.GoodTillCrossing) ;

                if (BesLongorder_SellResult.Success)
                {
                    //var startTrail_trailing = bfc.UsdFuturesApi.Trading.PlaceOrder(ASSET, side: OrderSide.Sell, positionSide: PositionSide.Short, type: FuturesOrderType.TrailingStopMarket, quantity: BesLongorder_SellResult.Data.ExecutedQuantity, timeInForce: TimeInForce.GoodTillCanceled, callbackRate: "0.25", activationPrice: BesLongorder_SellResult.Data.Price * 1, 0025);
                    //MessageBox.Show(BesLongorder_SellResult.Data.ToString());
                    long_quantity = trade_amount;
                    long_price = BesLongorder_SellResult.Data.Price;
                    actpr = Math.Round(BesLongOrder_TP * 1.000454545M, PRICEPRECISION);
                    calbck = 0.2M;
                    var startTrail_trailing = await bfc.UsdFuturesApi.Trading.PlaceOrderAsync(ASSET, side: OrderSide.Sell, positionSide: PositionSide.Long, type: FuturesOrderType.TakeProfit, quantity: long_quantity, timeInForce: TimeInForce.GoodTillCanceled, price: long_price, stopPrice: actpr);
                    if (startTrail_trailing.Success)
                    {
                        //MessageBox.Show(startTrail_trailing.Data.ToString());
                    }
                    else
                    {
                        MessageBox.Show($"Order placing failed: {startTrail_trailing.Error.Message}", "Failed", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    //LongTrailStop();
                    OpenOrders();
                    OpenPositions();
                }
                else
                {
                    MessageBox.Show($"Order placing failed: {BesLongorder_SellResult.Error.Message}", "Failed", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        });
    }`
Read more comments on GitHub >

github_iconTop Results From Across the Web

How Take-Profit and Stop-Loss Orders Can Help Traders ...
On the Binance App, it's very easy to set up take-profit and stop-loss orders while entering a position. Go to [Futures] and check...
Read more >
Order Entry
To gain profit, you can use the Take Profit order, which will automatically close the position at the specified price. To do this,...
Read more >
Place Order | Bybit API Documentation
Parameter Required Type category true string symbol true string isLeverage false integer
Read more >
How To Set A Stop Loss On Binance Futures-Guide In ...
Suppose you want to cancel take profit order so that you can take profits of your desire, simply press the cross button on...
Read more >
How to set a take profit and a stop loss for futures market ...
Take profit order is different then the regular limit order & set TP value after the order executed. Here I explained the detail...
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