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

# Social Trading

> Per-trader equity curve, PnL calendar, performance stats, account leverage and top trades: everything needed to build a copy-trading or leaderboard product.

Everything below works for **any Hyperliquid address**: no opt-in, no registration from the trader. Five endpoints cover a full trader profile page.

> [card] [Equity chart](https://docs.hypedexer.com/api-reference/social-trading/equity-history.md)
>
> Account value over time with cash, open notional, unrealized PnL and leverage at each point.

> [card] [PnL calendar](https://docs.hypedexer.com/api-reference/social-trading/pnl-calendar.md)
>
> Daily realized PnL, fees, funding and net result: the data behind a calendar heatmap.

> [card] [Performance](https://docs.hypedexer.com/api-reference/social-trading/user-performance.md)
>
> Win rate, PnL, trade count, volume, average holding time, long/short ratio, max drawdown.

> [card] [Account & leverage](https://docs.hypedexer.com/api-reference/social-trading/account-state-and-leverage.md)
>
> Current equity, account leverage and every open position with its own leverage.

## Building a trader profile

A typical profile page maps one-to-one onto these calls:

| Section of your UI | Endpoint |
| - | - |
| Equity chart, with a PnL / calendar toggle | `GET /users/{user}/equity-history` + `GET /users/{user}/pnl-calendar` |
| Stat row: win rate, PnL, trades, volume, avg holding time | `GET /users/{user}/performance?window=7d` |
| Current leverage badge | `GET /users/{user}/account` → `account_leverage` |
| Top 5 trades table | `GET /users/{user}/top-trades?limit=5` |
| Leaderboard / many traders at once | `POST /users/batch/performance` (up to 500 wallets) |

All responses are wrapped in `{ success, message, data, execution_time_ms }`. Amounts are USDC, sizes are in the asset's own unit, timestamps are ISO-8601 UTC. Addresses come back lower-cased; an invalid address returns `400`.

## Quick start

```bash Performance theme={null}
curl -s "https://api.hypedexer.com/users/0x0000000000bdc2fd416def2d8688069052eb0f87/performance?window=7d" \
  -H "X-API-Key: $HYPEDEXER_API_KEY"
```

```bash Equity chart theme={null}
curl -s "https://api.hypedexer.com/users/0x0000000000bdc2fd416def2d8688069052eb0f87/equity-history?window=7d&interval=1h" \
  -H "X-API-Key: $HYPEDEXER_API_KEY"
```

```bash PnL calendar theme={null}
curl -s "https://api.hypedexer.com/users/0x0000000000bdc2fd416def2d8688069052eb0f87/pnl-calendar?window=30d" \
  -H "X-API-Key: $HYPEDEXER_API_KEY"
```

```bash Account & leverage theme={null}
curl -s "https://api.hypedexer.com/users/0x0000000000bdc2fd416def2d8688069052eb0f87/account" \
  -H "X-API-Key: $HYPEDEXER_API_KEY"
```

```bash Batch performance theme={null}
curl -s -X POST "https://api.hypedexer.com/users/batch/performance" \
  -H "X-API-Key: $HYPEDEXER_API_KEY" -H "Content-Type: application/json" \
  -d '{"users": ["0xabc…", "0xdef…"], "window": "30d"}'
```

```bash Top trades theme={null}
curl -s "https://api.hypedexer.com/users/0x0000000000bdc2fd416def2d8688069052eb0f87/top-trades?limit=5&window=all&sort=pnl" \
  -H "X-API-Key: $HYPEDEXER_API_KEY"
```

## Where the numbers come from

Two different sources back these endpoints, and the distinction explains every coverage rule below.

**Round-trip trades** are reconstructed from fills: entry to exit, with realized PnL, duration and fees. They drive `/performance` and `/top-trades`, and are available from **10 September 2025**.

> [!NOTE]
>
> `total_funding` in `/performance` and `POST /users/batch/performance` currently returns `0`: funding is not yet attached to round-trip trades. Daily funding is in the `funding` column of `/pnl-calendar`, and each payment in `userFunding` over `POST /info` (or `GET /funding/userFunding`).

**Account snapshots** are read hourly from the on-chain clearinghouse state on our own full nodes. They drive `/equity-history`, `/account`, the `equity_close` column of the calendar and the leverage on each trade. They are available from **5 September 2026** and accumulate from there.

> [!NOTE]
>
> `account_value` is the **perp** account: the same figure Hyperliquid returns in `clearinghouseState.marginSummary.accountValue`. Spot balances and HIP-3 builder-dex positions are not included yet.

> [!WARNING]
>
> An account that trades **only on HIP-3 dexes** has an empty main perp account: `/account` returns `account_value: 0` and `perp_account_empty: true`, and `/equity-history` returns `0` points, even when the account holds large HIP-3 positions. For the daily value of an account across every dex (positions on the main dex and HIP-3, spot, staked HYPE, vaults), use [account statements](https://docs.hypedexer.com/indexed-data/account-statements.md) (`GET /users/{address}/statements`).

### Reading a zero

A trader who moved funds to spot, withdrew, or simply closed everything has an empty perp account. Rather than hiding those moments, the API states them:

* `/account` returns `account_value: 0`, `perp_account_empty: true` and `last_nonempty_snapshot`
* `/equity-history` fills those hours with a `0` point carrying `perp_account_empty: true`

That is a real zero on the main perp dex, not missing data: worth handling explicitly if your chart interpolates gaps. It is also what an account trading only on HIP-3 dexes returns (see above).

### Leverage

**leverage\_type** `string`

`cross` or `isolated` when the trader set it. `default` means they never configured leverage for that asset: Hyperliquid then applies `min(20, maxLeverage)`, and that resolved value is what `leverage` returns.

**leverage on closed trades** `integer | null`

Taken from the first hourly snapshot captured while the position was open. Trades closed before **6 September 2026** predate snapshot coverage and return `null`.

### Two kinds of drawdown

`/performance` returns both, because they answer different questions:

* `max_drawdown`: measured on the cumulative **realized-PnL curve** of closed trades. Always available.
* `equity_max_drawdown_usd` / `equity_max_drawdown_pct`: measured on **real account value**, which includes unrealized PnL and deposits. Requires snapshot coverage in the window; `equity_snapshots` tells you how many points backed the figure.

## Freshness

Trades and the PnL calendar update within seconds of on-chain execution. Equity, positions and leverage come from hourly snapshots: every response carries an `as_of` (or `points[].time`) with the exact snapshot time, so you can display it rather than implying live data.

> [!NOTE]
>
> Building a copy-trading or leaderboard product and missing a field? Spot balances and HIP-3 dex positions in the equity are the natural next step: [tell us what you need](https://docs.hypedexer.com/guides/for-builders.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.