Skip to content

Exchange mechanics

Hedge mode vs one-way mode: how each exchange handles position modes

Updated Ninja Terminal team

Short answer

One-way mode keeps a single net position per contract, so an opposite order reduces, closes or flips it. Hedge mode (OKX long/short mode) keeps a long and a short at the same time, and orders must name the side. Binance, OKX and Bybit support both modes. Hyperliquid supports one-way only. Sending positionSide in the wrong mode causes Binance error -4061.

Every futures account runs in one of two position modes. The mode decides how the exchange stores your positions and which fields an order must carry. A mismatch between the mode and the order is one of the most common reasons an API order is rejected.

What is the difference between one-way and hedge mode?

In one-way mode (OKX calls it net mode) you hold one net position per contract. A buy against an open short reduces it, closes it, or flips it to long if the order is larger than the position.

In hedge mode (OKX calls it long/short mode) the long and the short are separate positions. You can hold both at once, and each order must say which side it acts on. See hedge mode for the general concept.

One-way:   BTC position = +0.5   (net)
           sell 0.8  ->  BTC position = -0.3   (flipped to short)

Hedge:     BTC LONG  = +0.5
           BTC SHORT = +0.3
           sell 0.8 with side LONG  ->  acts on the long only

How do the venues compare?

Binance USD-M OKX swaps Bybit linear Hyperliquid
Modes One-way, Hedge net_mode, long_short_mode One-way, Hedge One-way only
Order field positionSide: BOTH, LONG, SHORT posSide: net, long, short positionIdx: 0, 1, 2 None
Field required in hedge mode Yes Yes Yes Not applicable
reduceOnly Allowed in one-way, rejected in hedge Net mode only. Closing orders in long/short mode are reduce-only automatically Accepted with positionIdx r flag on the order
Scope of the setting Whole account, every symbol Account level Per symbol or per settle coin None
Switch blocked by open positions or orders Yes (-4068, -4067) Not stated in the docs. Close first Symbols with positions or orders are skipped Not applicable

Bybit’s positionIdx is 0 for one-way, 1 for the hedge-mode buy side and 2 for the hedge-mode sell side. Its mode switch takes 0 (merged single) or 3 (both sides), and the precedence is symbol, then coin, then system default.

OKX portfolio margin accounts support net mode only for futures and swaps.

Why does Binance return error -4061?

Binance error -4061 (POSITION_SIDE_NOT_MATCH) reads “Order’s position side does not match user’s setting.” The Binance documentation says positionSide defaults to BOTH in one-way mode, that LONG or SHORT is used in hedge mode, and that it must be sent in hedge mode.

The error points to a mismatch between the request and the account:

  1. You send positionSide=LONG or SHORT while the account is in one-way mode.
  2. You omit positionSide while the account is in hedge mode. The documentation says the field must be sent there.

The fix is to read the account’s current mode first (GET /fapi/v1/positionSide/dual) and build the request from it. A mode changed in the Binance app after your client connected is a common cause, because the client still uses the old value.

How does reduce-only behave in each mode?

  • Binance one-way: send reduceOnly=true on closing orders so they can never open a reverse position.
  • Binance hedge: do not send reduceOnly. Send the position side instead. A sell with positionSide=LONG closes the long.
  • OKX net mode: reduceOnly is supported. In long/short mode the documentation says closing orders already use reduce-only behavior and the parameter is not needed.
  • Bybit: reduceOnly works together with positionIdx in both modes.
  • Hyperliquid: reduceOnly is a flag on the order. Because there is one net position, it stops an order from flipping you.

See reduce-only for the order flag itself.

Can I switch modes at any time?

No. Binance applies the change to every symbol and rejects it while you have open orders (-4067) or open positions (-4068). Bybit’s coin-level switch skips symbols that hold positions or orders. Close the positions and cancel the orders before you switch.

How Ninja Terminal handles this

Ninja Terminal reads the position mode of each connected account and shapes every order from it:

  • Hedge accounts send the position side. On Binance and OKX, closing orders in hedge mode carry the side and no reduceOnly.
  • One-way accounts send reduceOnly on closes and no position side. Any long or short side is removed from the request.
  • Hyperliquid accounts always use the one-way shape.
  • If an exchange rejects an order because of a mode mismatch, Ninja Terminal re-reads the mode from the exchange and retries once. A pre-trade rejection places nothing, so the retry cannot close a position twice.
  • Positions are tracked by symbol and side, so a hedge account shows its long and its short as two separate rows. See positions and orders.

Trading derivatives is risky and you can lose more than you expect. This guide describes exchange mechanics and is not investment advice.

Frequently asked questions

What does Binance error -4061 mean?

Error -4061 (POSITION_SIDE_NOT_MATCH) means the order's position side does not match the account's position mode. The usual cause is a positionSide of LONG or SHORT sent to a one-way account, or a missing positionSide on a hedge-mode account.

Can I use hedge mode on Hyperliquid?

No. Hyperliquid keeps one net position per asset in each account, and its API reports positions with the type oneWay. To hold a long and a short on the same asset, use a separate account.

Can I switch position mode with open positions?

On Binance, the change is rejected while you have open orders (-4067) or open positions (-4068). Bybit skips symbols that have positions or open orders when you switch by coin. Close positions and cancel orders first, then switch.

Is reduce-only needed in hedge mode?

Not on every venue. Binance does not accept reduceOnly in hedge mode, and OKX applies reduce-only behavior automatically to closing orders in long/short mode. Bybit accepts reduceOnly in both modes.

Sources

  1. Binance — New Order (positionSide, reduceOnly)
  2. Binance — Change Position Mode
  3. Binance — USDⓈ-M Futures error codes
  4. OKX API v5 — Set position mode and Place order
  5. Bybit V5 — Switch position mode
  6. Bybit V5 — Place order (positionIdx)
  7. Hyperliquid — Info endpoint (perpetuals)

Trade every venue from one tab.

Binance, OKX, Bybit, and Hyperliquid with news, charts, and one-command orders. Included with Ninja Squad Pro membership.