Synthetic Position

Pear Protocol constructs synthetic positions on top of raw Hyperliquid positions. Each basket trade gets its own position with independent sizing, entry prices, PnL, and TP/SL β€” even when the underlying Hyperliquid account holds a single aggregated position per asset.

Synthetic Positions vs Hyperliquid Positions

Hyperliquid tracks one position per asset per account. Pear splits that into baskets.

Example: One Underlying, Three Baskets

Trade
Long
Short
BTC Size

Trade 1

BTC

ETH

0.5

Trade 2

BTC

ALT

0.3

Trade 3

BTC

STOCK

0.2

Hyperliquid sees: 1.0 BTC long (single position, no basket concept)

Pear sees: 3 independent positions, each with own entry price, PnL, and TP/SL

Users can track performance per basket, set risk per basket, and close baskets independently.

How Fills Become Positions

After execution on Hyperliquid, each fill is processed against existing open positions: first closing exact-match inverse positions, then any partial matches, then merging into same-structure positions or creating new ones. Entry prices use weighted averages on merge.

Execution Flag (pear_execution_flag)

Every position carries a flag indicating where its fills originated:

Flag
Meaning

FULLY_PEAR

All fills came from Pear orders

FULLY_EXTERNAL

All fills came from outside Pear (direct Hyperliquid trades, other frontends)

PARTIAL

Mix of Pear and external fills touched this position

PnL Discrepancy: Pear vs Hyperliquid

Pear calculates PnL at the basket level. Hyperliquid calculates at the asset level. Different entry price tracking β†’ different displayed PnL until all related positions close.

Pear: each basket maintains its own entry price per asset.

Hyperliquid: global weighted average entry across all trades of same asset. Any close uses this global average.

Example

User opens same asset long in four baskets:

Pair
Entry Price

ASSET / SHORT-A

33.500

ASSET / SHORT-B

33.700

ASSET / SHORT-C

33.879

ASSET / SHORT-D

33.880

Hyperliquid global average entry: 33.74

User closes only ASSET / SHORT-C at 34.298:

Entry Used
PnL per Unit

Pear

33.879 (basket-specific)

+0.419

Hyperliquid

33.74 (global average)

+0.558

Neither is wrong β€” total PnL converges once all positions sharing that asset are fully closed.

Last updated