> ## Documentation Index
> Fetch the complete documentation index at: https://docs.allium.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Perpetual Closed Positions

> Completed Hyperliquid native and HIP-3 perpetual positions, flat back to flat.

The `hyperliquid.assets.perpetual_closed_positions` view contains one row per completed perpetual position, from flat back to flat, for native Hyperliquid perps and HIP-3 perps. Spot markets, HIP-4, positions still open, positions opened before coverage start, positions whose size changes between two fills without a fill, and positions that include a timestamp whose fills do not form one position path (for example duplicated fills) are not included.

Fills that share a timestamp have no execution order, so positions are cut on the position size at the end of each timestamp. Round trips that start and end flat inside one timestamp become one row per side. A close and reopen on the same side inside one timestamp stays one row.

`gross_realized_pnl`, `total_fees`, `total_funding`, and `net_realized_pnl` are denominated in the market's collateral token. Do not treat those columns as USD unless the collateral token is a dollar stablecoin at peg. Matching `*_usd` columns convert each fill or funding event at the collateral token's 5-minute USD price. When any contributing event lacks a price, the affected USD columns are null, `net_usd_is_complete` is false, and `unpriced_component_count` records the unpriced fill and funding events.

`net_realized_pnl` equals `gross_realized_pnl - total_fees + total_funding`. The exchange `fee` field already includes builder and HIP-3 deployer fees. Flip fills allocate fee by segment size so allocated fees sum to the raw fee. Funding is attributed on `[open_time, close_time)`.

Coverage starts at `2025-06-05 00:00:00` UTC.

<Info>
  Always filter with `WHERE user = ...`. A query without a user filter reconstructs every wallet and is slow.
</Info>

### Table Details

| Property | Value |
| - | - |
| Table Name | `hyperliquid.assets.perpetual_closed_positions` |
| Table Status | Production-Ready |
| Unique Key | `closed_position_id` |

### Sample Query

```sql theme={null}
SELECT
  coin,
  side,
  open_time,
  close_time,
  collateral_token,
  gross_realized_pnl,
  total_fees,
  total_funding,
  net_realized_pnl,
  net_realized_pnl_usd,
  net_usd_is_complete
FROM hyperliquid.assets.perpetual_closed_positions
WHERE user = '0x9237794d8e5c6eb247b20f2e5edd9ad5f530d8ec'
  AND close_time >= '2026-08-17'
  AND close_time < '2026-09-16'
ORDER BY close_time, coin;
```
