Why do you get "Order would immediately trigger" errors

A:
When you place an order with “type=STOP_*|TAKE_PROFIT_*”, you could get below error:
{
“code”: -2021,
“msg”: “Order would immediately trigger.”
}

What could be the possible reasons?

Similar to Order would trigger immediately error

A:
That’s because you choose the wrong combination of type & stopPrice. Please follow below rules and you’d be fine:

STOP, STOP_MARKET:
BUY: latest price (“MARK_PRICE” or “CONTRACT_PRICE”) >= stopPrice
SELL: latest price (“MARK_PRICE” or “CONTRACT_PRICE”) <= stopPrice
TAKE_PROFIT, TAKE_PROFIT_MARKET:
BUY: latest price (“MARK_PRICE” or “CONTRACT_PRICE”) <= stopPrice
SELL: latest price (“MARK_PRICE” or “CONTRACT_PRICE”) >= stopPrice