Hello everyone please does anyone have examples to post a take profit order with um_futures_client.new_order, i got this, but it has error

response = um_futures_client.new_order(
symbol=symbol, side=“BUY”,type=“TAKE_PROFIT_MARKET”, quantity = 0.02, stopPrice = 278, reduceOnly = True, timeInForce=“GTC”)

{“code”:-2021,“msg”:“Order would immediately trigger.”}

You need to understand the requirements for submitting a TAKE_PROFIT_MARKET order, consult more on, where it mentions the following details. Hope it can help :slight_smile:

  * BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= `stopPrice`
  * SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= `stopPrice`

The error that is being returned there is that the order that was attempted to be placed would be executed immediately given the current condition and price of the asset. It would surely be resolved by checking the price of the order to place