The perpetual contract of Gate.io supports a two-way position mode, referring to a contract that is allowed to hold positions in both long and short directions at the same time.
The switching between one-way and two-way position holding refers to the user's contract settlement of one currency entering into force simultaneously. The requirement for switching is that the user is not holding any contract position under this currency or having any pending orders.
For the contracts under isolated margin, the two positions under a two-way position mode have independent risks, that have their independent margin and close price. But the leverage and risk limit is consistent.
For the contract with cross margin, the risk hedges while the profit and loss cancel each other out. The locked profit and loss overlapping on both sides are unrealized on the position, yet it will be displayed as 'deleveraging PNL' in the user's billing history.
The margin and liquidation price are shared by both sides. If the forced liquidation is triggered, only the exceeding part of the larger position will be closed while the overlapping part remains locked. If both sides are equal, there's no risk of liquidation.
Switching between Isolated and Cross
The requirement for switching between isolated and cross is that there is no holding or pending orders in the position.
For two-way position mode, there is only long or short position, in stead of reverse position. So the reduce-only order is removed for the selection. Correpondingly, the revious two position of 'long' and 'short' become 'open long', 'close long', 'open short', and 'close short'.
Since there is no distinguish between one-way and two-way mode with in th engine, that the direction of the orders are displayed accordingly to the current mode, in stead of the actual mode when placing the order.