Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The stateful market-data streams use two recovery models. This taxonomy does not

**Incremental streams** — `l2BookDiff`, `l4BookUpdates`, and `tpslUpdates`. Messages carry changes that chain onto previous state. These carry a cursor and support replay.

> A message with `isSnapshot: true` replaces your local state. Any message without it is a diff that must chain onto your previous state. If continuity is broken, a fresh message with `isSnapshot: true` is pushed to you — there is no separate resynchronization message and no epoch to track.
> A message with `isSnapshot: true` replaces your local state. Any message without it is a diff that must chain onto your previous state. If continuity is broken, a fresh message with `isSnapshot: true` is pushed to you. `isSnapshot` is the only continuity signal you need to handle — receiving it means discard local state and adopt the supplied snapshot.

## Detecting gaps

Expand Down
3 changes: 2 additions & 1 deletion content/api-reference/data/hypercore/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ description: "HyperCore private-preview documentation."

Review the [WebSocket streaming documentation](/docs/chains/websockets/hypercore) for the intended subscription envelope.

For REST reads, use the provisional base URL `https://api.g.alchemy.com/hypercore/v1`. Each REST operation includes its API key in the `{apiKey}` path segment. The base URL will be confirmed before general availability.
For REST reads, see the [REST API overview](/docs/data/hypercore/rest-api). Each REST
operation includes its API key in the `{apiKey}` path segment.

## Next steps
Review the WebSocket lifecycle, replay, and wallet-fill guide before integrating.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@ description: "HyperCore private-preview documentation."

# Rebuild a book from diffs

Start from a durable L2 snapshot. Apply ordered diffs one cursor at a time. On a cursor discontinuity, discard local state, fetch a new snapshot or historical cursor, then resume.
Subscribe to `l2BookDiff`. The first message for each market is the current book
snapshot with `isSnapshot: true`; install it as local state. Apply later diffs in
height order. The first diff for each market must carry `prev_seq` equal to that
market's snapshot `seq`; continue checking `prev_seq` against your local position on
every diff.

On a continuity break, discard local state for the affected markets and adopt the
pushed message with `isSnapshot: true`; bootstrap and recovery use the same
replacement mechanism.

For a snapshot shared by many consumers, or to let a slow client digest a large book
while buffering live updates, use [the REST snapshot read](/docs/data/hypercore/rest-api)
instead.

## Cursor rule

Advance a durable cursor only after downstream storage succeeds. Treat a gap, correction, or finality change as a reason to backfill and reconcile.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@ description: "HyperCore private-preview documentation."

# Stream an L2 order book

Subscribe to `l2Book` for the market, wait for the initial snapshot, store its cursor, and render price levels. Use `l2BookDiff` only after the snapshot is installed.
To maintain an L2 book from `l2BookDiff`, install the first message for each market
as local state. It carries the current levels with `isSnapshot: true`. Apply later
diffs in height order, checking each market's `prev_seq` against the snapshot `seq`
and then against your local position.

`l2Book` is a standalone display snapshot, not a bootstrap source for a
diff-maintained book. If continuity breaks, discard affected local state and adopt
the pushed `isSnapshot: true` message; bootstrap and recovery use the same
replacement mechanism.

For a snapshot shared by many consumers, or to let a slow client digest a large book
while buffering live updates, use [the REST snapshot read](/docs/data/hypercore/rest-api)
instead.

## Cursor rule

Advance a durable cursor only after downstream storage succeeds. Treat a gap, correction, or finality change as a reason to backfill and reconcile.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ description: "HyperCore private-preview documentation."

# HyperCore Data API networks and endpoints

HyperCore will support Hyperliquid mainnet and testnet. The REST base URL is provisionally `https://api.g.alchemy.com/hypercore/v1`; it will be confirmed before general availability.
HyperCore supports Hyperliquid mainnet and testnet. See the [REST API overview](/docs/data/hypercore/rest-api) for the current `/info` host handling.

For chain-level documentation, see [Chain API networks and endpoints](/docs/chains/hyperliquid/hypercore/networks-and-endpoints).
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: "Spot clearinghouse state"
description: "HyperCore private-preview documentation."
---

<Markdown src="../../../../shared/preview-notice-october.mdx" />

# Spot clearinghouse state

Returns a user's spot balances for account-state and balance checks.

## Request

`POST /{apiKey}/info`

| Parameter | Type | Required | Description |
| --------- | ------ | -------- | --------------------------------- |
| `type` | string | Yes | Selects `spotClearinghouseState`. |
| `user` | string | Yes | Master or sub-account address. |

```json
{
"type": "spotClearinghouseState",
"user": "0x0000000000000000000000000000000000000000"
}
```

## Response fields

| Field | Type | Description |
| --------------------- | ------- | ----------------------------------------------------------- |
| `balances[]` | array | Balance entries. |
| `balances[].coin` | string | Spot-token symbol, for example `USDC`. |
| `balances[].token` | integer | Numeric token index from the spot metadata response. |
| `balances[].hold` | string | Amount reserved by orders. |
| `balances[].total` | string | Combined balance held by the account, as a decimal string. |
| `balances[].entryNtl` | string | Entry notional for this token balance, as a decimal string. |

## Response example

```json
{
"balances": [
{
"coin": "USDC",
"token": 0,
"hold": "0.0",
"total": "14.625485",
"entryNtl": "0.0"
}
]
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: "Subaccounts"
description: "HyperCore private-preview documentation."
---

<Markdown src="../../../../shared/preview-notice-october.mdx" />

# Subaccounts

Returns a master's named sub-accounts with their perpetual and spot account state.

## Request

`POST /{apiKey}/info`

| Parameter | Type | Required | Description |
| --------- | ------ | -------- | ------------------------------ |
| `type` | string | Yes | Selects `subAccounts`. |
| `user` | string | Yes | Master or sub-account address. |

```json
{
"type": "subAccounts",
"user": "0x0000000000000000000000000000000000000000"
}
```

## Response fields

| Field | Type | Description |
| -------------------------------------- | ------------- | --------------------------------------------------------------------------------- |
| `[]` | array \| null | Sub-account entries; the native API can return `null` when no state is available. |
| `[].name` | string | Display name assigned to the sub-account. |
| `[].subAccountUser` | string | Address of the sub-account. |
| `[].master` | string | Address that controls this sub-account. |
| `[].clearinghouseState` | object | Perpetual account state for the sub-account. |
| `[].clearinghouseState.marginSummary` | object | Cross-margin collateral, notional, and margin metrics. |
| `[].clearinghouseState.withdrawable` | string | USDC withdrawable while retaining the current perpetual positions. |
| `[].clearinghouseState.assetPositions` | array | Open perpetual positions with their position state. |
| `[].clearinghouseState.time` | integer | Millisecond timestamp of the included perpetual-account state. |
| `[].spotState.balances[]` | array | Spot balances held by the sub-account. |
| `[].spotState.balances[].coin` | string | Spot-token symbol, for example `USDC`. |
| `[].spotState.balances[].total` | string | Combined balance for that spot token, as a decimal string. |
| `[].spotState.balances[].hold` | string | Amount reserved by orders. |

## Response example

```json
[
{
"name": "Test",
"subAccountUser": "0x035605fc2f24d65300227189025e90a0d947f16c",
"master": "0x8c967e73e6b15087c42a10d344cff4c96d877f1d",
"clearinghouseState": {
"withdrawable": "29.78001",
"assetPositions": [],
"time": 1733968369395
},
"spotState": {
"balances": [{ "coin": "USDC", "total": "0.22", "hold": "0.0" }]
}
}
]
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: "DEX abstraction state"
description: "HyperCore private-preview documentation."
---

<Markdown src="../../../../shared/preview-notice-october.mdx" />

# DEX abstraction state

Returns whether a user has enabled HIP-3 DEX abstraction.

## Request

`POST /{apiKey}/info`

| Parameter | Type | Required | Description |
| --------- | ------ | -------- | ------------------------------ |
| `type` | string | Yes | Selects `userDexAbstraction`. |
| `user` | string | Yes | Master or sub-account address. |

```json
{
"type": "userDexAbstraction",
"user": "0x0000000000000000000000000000000000000000"
}
```

## Response fields

| Field | Type | Description |
| ---------- | --------------- | ---------------------------------------------------------------------------------------------------- |
| `Response` | boolean \| null | `true` when DEX abstraction is enabled; the native API can return `null` when no state is available. |

## Response example

<Tabs>
<Tab title="Enabled">

```json
true
```

</Tab>
<Tab title="No state">

```json
null
```

</Tab>
</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: "Active asset data"
description: "HyperCore private-preview documentation."
---

<Markdown src="../../../../shared/preview-notice-october.mdx" />

# Active asset data

Returns a user's active perpetual-market trading capacity and leverage for one coin.

## Request

`POST /{apiKey}/info`

| Parameter | Type | Required | Description |
| --------- | ------ | -------- | ------------------------------ |
| `type` | string | Yes | Selects `activeAssetData`. |
| `user` | string | Yes | Master or sub-account address. |
| `coin` | string | Yes | Perpetual market identifier. |

```json
{
"type": "activeAssetData",
"user": "0x0000000000000000000000000000000000000000",
"coin": "BTC"
}
```

## Response fields

| Field | Type | Description |
| ------------------ | ----------------- | --------------------------------------------------------- |
| `user` | string | Account address. |
| `coin` | string | Perpetual market symbol requested by the caller. |
| `leverage` | object | Selected leverage configuration for this user and market. |
| `leverage.type` | cross \| isolated | Selected margin mode: `cross` or `isolated`. |
| `leverage.value` | integer | Configured leverage multiplier. |
| `leverage.rawUsd` | string | HIP-3 isolated-margin amount in USD, when supplied. |
| `maxTradeSzs` | array | Maximum buy and sell sizes permitted at current margin. |
| `availableToTrade` | array | Available buy and sell notional at current margin. |
| `markPx` | string | Current mark price used for margin and unrealized PnL. |

## Response example

<Tabs>
<Tab title="First perpetual DEX">

```json
{
"user": "0xb65822a30bbaaa68942d6f4c43d78704faeabbbb",
"coin": "APT",
"leverage": { "type": "cross", "value": 3 },
"maxTradeSzs": ["24836370.4400000013", "24836370.4400000013"],
"availableToTrade": ["37019438.0284740031", "37019438.0284740031"],
"markPx": "4.4716"
}
```

</Tab>
<Tab title="HIP-3 DEX">

```json
{
"user": "0xa15099a30bbf2e68942d6f4c43d70d04faeab0a0",
"coin": "xyz:XYZ100",
"leverage": { "type": "isolated", "value": 20, "rawUsd": "0.0" },
"maxTradeSzs": ["0.0", "0.0"],
"availableToTrade": ["0.0", "0.0"],
"markPx": "25451.0"
}
```

</Tab>
</Tabs>
Loading
Loading