Close Position not possible

I want to sell my future position using the postOrder method. Does someone know what I am doing wrong? The hedge mode is activated and I want to close my long position in this example.

System.out.println(syncRequestClient.postOrder(“ETHUSDT”, OrderSide.SELL, PositionSide.LONG, OrderType.TAKE_RPOFIT_MARKET, null,
“0.1”, null,null,null, “2200.00”, null, null));

Thank you guys!

Hi. Can you provide more info about your request? There are many libraries developed by different parties available online. It’s hard to know what the method you provide really does.

  1. Which endpoint did you call?
  2. What are the parameters you sent? It will be better if you can provide the complete query string.
  3. Is there any error message shown?
1 Like

I am checking for some signals and when the counter reaches 8 it sends a BUY / LONG position.

if(ethCounter.getcAnzahl()>=8) {
System.out.println(syncRequestClient.postOrder(“ETHUSDT”, OrderSide.BUY, PositionSide.LONG, OrderType.MARKET, null,
“0.003”, null, null, null, null, WorkingType.MARK_PRICE, NewOrderRespType.RESULT));

At this point a position is opened and everything is allright. Now I want to close the position by reaching a specific Marker Price. You could say I want to place a take profit order.

To close the position you wrote in an other thread that I should place a SELL order. So I use the postOrder function again and SELL the LONG position using the postOrder function below.

System.out.println(syncRequestClient.postOrder(“ETHUSDT”, OrderSide.SELL, PositionSide.LONG, OrderType.TAKE_RPOFIT_MARKET, null,
“0.1”, null,null,null, “2200.00”, null, null));

Order postOrder(String symbol, OrderSide side, PositionSide positionSide, OrderType orderType,
TimeInForce timeInForce, String quantity, String price, String reduceOnly,
String newClientOrderId, String stopPrice, WorkingType workingType, NewOrderRespType newOrderRespType);

The error message is that it would trigger immediately. When I change some parameters the error message is that the order type is invalid.

No one there who could help?

You can set closePosition = true for your TAKE_RPOFIT_MARKET order. It seems like the method you called does not include that parameter. Please update it accordingly. https://binance-docs.github.io/apidocs/futures/en/#new-order-trade

No one has any idea here?