Blog
Bybit inverse contractsOrder quantities

Bybit Inverse Contracts: Quantities and Position Modes

Keep Bybit inverse contract quantities, settlement, position settings, and private order progress explicit when implementing a Node.js connector.

Siebly.io2 min readMarkdown

Read the Instrument First

An inverse order quantity should not be copied from a linear-contract example merely because both instruments refer to Bitcoin. Contract denomination and settlement determine what the quantity represents. The same numeric string can describe a different exposure on another product.

The Bybit tutorial supplies the client setup. The connector still needs to select category: 'inverse' and interpret the instrument returned for that category.

Bybit's instrument information describes the selected symbol, settlement coin, price filter, and lot-size filter. Read those values rather than treating the symbol suffix as a complete product definition.

inverse-instrument.mjs

JavaScript
import { RestClientV5 } from 'bybit-api';

const client = new RestClientV5();
const response = await client.getInstrumentsInfo({
  category: 'inverse',
  symbol: 'BTCUSD',
});
if (response.retCode !== 0) throw new Error(response.retMsg);
const instrument = response.result.list.find((row) => row.symbol === 'BTCUSD');
if (!instrument) throw new Error('Requested inverse instrument was not returned');
console.log(instrument);

Keep prices and quantities in their original decimal representation while applying the instrument's increments. JavaScript floating-point rounding is not a substitute for a quantity-step calculation. The order-filter article develops that arithmetic for another venue; the actual constraints here come from Bybit.

Match the Position Configuration

side identifies the order direction. positionIdx identifies the applicable position slot when the account and product require it. Neither field alone establishes whether an order opens exposure or closes an existing position.

Check the current account's supported position mode and the placement parameters. Support can depend on account generation and product. A global rule copied from an old inverse example can reject a valid current configuration or send an incompatible request.

A service should validate its expected mode at startup and stop that workflow on a mismatch. Automatically switching position mode can affect existing positions and other workers sharing the account.

Reconcile in Native Units

Store the requested contract quantity with its product and symbol. Compare order progress in that same unit. Keep settlement amounts and execution fees as separate fields rather than adding unlike quantities to one total.

A placement acknowledgement is not a fill. Private order and execution events can arrive before the REST reply, and cancellation can race the remaining execution. Order-state handling must preserve those facts without converting a partial fill into zero exposure merely because the remainder was cancelled.

Related articles

Continue from here

Related Siebly resources

All articles

Subscribe on Substack

Complete the Substack form below to join our newsletter. Substack handles all subscriber data directly.