Skip to main content

Fetch positions

positions() hits the core API and returns enriched data: liquidation price, accrued rollover, and unrealized funding are already computed. Pass trader= to read any address.

Position fields (human units)

data.position(pair_index, index) looks up a single position.

Price triggers

price_triggers unifies every TP/SL attached to a position:
  • Global (on-chain) TP/SLis_global is True. These are the levels set at open / via trade.update_tp_sl(). Their entity_id is deterministic (global-tp-{trader}-{pair}-{index} / global-sl-...) and is not accepted by the partial TP/SL CRUD; the SDK rejects it client-side too.
  • Partial (off-chain) triggersis_global is False. Signed partial TP/SL orders whose entity_id works with trade.update_partial_tp_sl() and trade.cancel_partial_tp_sl(). Note that updating a partial order mints a new entity_id.

Live PnL

Combine a position with its pair snapshot and the live price for a UI-parity net PnL breakdown:
See Compute for the full breakdown fields.

Balance and raw reads

Use positions_onchain() when you need the unprocessed on-chain state; positions() is the right call for everything else.