> ## 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.

# Streams

> Hyperliquid Kakfa data streams

We offer Hyperliquid data via Kafka streams that offer the lowest possible latency and are schematically identical to the data that is available in the data source.

## Kafka Schema

| Topic Name   | Description                                                                                                                                                                                         |
| :----------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| blocks       | Block metadata                                                                                                                                                                                      |
| transactions | Block Transaction data                                                                                                                                                                              |
| trades       | Includes both the seller and the buyer in the same record.<br />Missing some fields when compared to fills.                                                                                         |
| fills        | One record for the seller and one record for the buyer.<br />When you have both, you have the trade.<br />It includes extra fields when compared to the trade topic.                                |
| orders       | Realtime order data with status changes.<br />Complete visibility as orders progress through their lifecycle.                                                                                       |
| misc\_events | User events in hyperliquid, including<br />- Funding fees<br />- Backstop liquidations by the HLP Vault<br />- Vault deposits and withdrawals<br />- Transfers<br />- Validator actions and rewards |

[Example connecting to a Kafka Topic](/datastreams/kafka)

# Example Data for each Topic

## Blocks

```json theme={null}
{
  "payload": {
    "height": 636283712,
    "blockTime": 1750476484151,
    "hash": "0xfa88e838735c1d74db2c3e956e258bbc60c55560be20816e8d443a1ae30d7773",
    "proposer": "0x5ac99df645f3414876c816caa18b2d234024b487",
    "numTxs": 734
  }
}
```

## Transactions

Raw transaction data from hyperliquid.

<Tabs>
  <Tab title="Payload">
    ```json theme={null}
      {
        "payload": {
          "time": 1753284680334,
          "user": "0x1dd4af3383fce2ee4a40d9fb6766cbfcce2ddbce",
          "action": {
            "type": "cancelByCloid",
            "cancels": [
              {
                "asset": 176,
                "cloid": "0x00000000000000001cc1cdd6e5932348"
              }
            ]
          },
          "block": 672483307,
          "hash": "0xe58ac836892b57be2a9604281547eb020187005e115c6145df9ba3b870490d1d",
          "error": "Invalid nonce: duplicate nonce 1753284680011"
        },
        "source": "hyperliquidinternal"
      }
    ```
  </Tab>

  <Tab title="Transaction Types">
    Here is a list of the available transaction types. This list could change as Hyperliquid adds more types.

    | Transaction Types                  |
    | :--------------------------------- |
    | "CSignerAction"                    |
    | "CValidatorAction"                 |
    | "NetChildVaultPositionsAction"     |
    | "PerpDexClassTransfer"             |
    | "SetGlobalAction"                  |
    | "SystemSpotSendAction"             |
    | "ValidatorSignWithdrawalAction"    |
    | "VoteEthDepositAction"             |
    | "VoteEthFinalizedWithdrawalAction" |
    | "VoteGlobalAction"                 |
    | "approveAgent"                     |
    | "approveBuilderFee"                |
    | "batchModify"                      |
    | "cDeposit"                         |
    | "cWithdraw"                        |
    | "cancel"                           |
    | "cancelByCloid"                    |
    | "claimRewards"                     |
    | "convertToMultiSigUser"            |
    | "createSubAccount"                 |
    | "createVault"                      |
    | "evmRawTx"                         |
    | "evmUserModify"                    |
    | "finalizeEvmContract"              |
    | "linkStakingUser"                  |
    | "liquidate"                        |
    | "modify"                           |
    | "order"                            |
    | "registerReferrer"                 |
    | "reserveRequestWeight"             |
    | "scheduleCancel"                   |
    | "setDisplayName"                   |
    | "setReferrer"                      |
    | "spotDeploy"                       |
    | "spotSend"                         |
    | "spotUser"                         |
    | "subAccountModify"                 |
    | "subAccountSpotTransfer"           |
    | "subAccountTransfer"               |
    | "tokenDelegate"                    |
    | "topUpIsolatedOnlyMargin"          |
    | "twapCancel"                       |
    | "twapOrder"                        |
    | "updateIsolatedMargin"             |
    | "updateLeverage"                   |
    | "usdClassTransfer"                 |
    | "usdSend"                          |
    | "vaultDistribute"                  |
    | "vaultModify"                      |
    | "vaultTransfer"                    |
    | "voteAppHash"                      |
    | "withdraw3"                        |
  </Tab>
</Tabs>

## Cancel Order

```json theme={null}
{
  "payload": {
    "time": 1750476756214,
    "user": "0xdcac85ecae7148886029c20e661d848a4de99ce2",
    "action": {
      "type": "cancel",
      "cancels": [
        {
          "a": 76, // asset
          "o": 104542041378 // order id
        }
      ]
    },
    "block": 636287120,
    "hash": "0xb2fb203f7b1f180c55100425ecf890013b00155983bf9cba2a6b34c2d1806e85",
    "error": null
  }
}
```

`a` is an index to an asset that is traded on Hyperliquid. [Click through for more information on assets.](/historical-data/supported-blockchains/hyperliquid/dex)

## Trades

Contains data from both sides of a trade

```json theme={null}
{
  "payload": {
    "coin": "JUP",
    "side": "B",
    "px": "0.38549",
    "sz": "47.0",
    "time": 1750478887622,
    "hash": "0xcf4ba4eb00f85a6b33b50425ed634f010700f45f63355da2eb7ddee06d3d210e",
    "tid": 748754436177574,
    "users": [
      "0x31ca8395cf837de08b24da3f660e77761dfb974b",
      "0xef5fdcefdb38803a654ee9f3539bed8058443d99"
    ]
  }
}
```

## Fills

Contains only one side of a trade, but with a lot more information than what is contained in the trades.

**Fill**

```json theme={null}
{
  "payload": [
    "0x79ca2977402aba6b2e45504b94e21124f825a860",
    {
      "coin": "ETH",
      "px": "2421.4",
      "sz": "0.0091",
      "side": "B",
      "time": 1750478892028,
      "startPosition": "2.7593",
      "dir": "Open Long",
      "closedPnl": "0.0",
      "hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "oid": 104547788931,
      "crossed": true,
      "fee": "0.009915",
      "tid": 476343473381576,
      "feeToken": "USDC"
    }
  ]
}
```

**Liquidation Fill**

```json theme={null}
{
  "payload": [
    "0x82e79e9786a2a18d62ed6e3beaded9d803748f95",
    {
      "coin": "ALT",
      "px": "0.041602",
      "sz": "1480.0",
      "side": "A",
      "time": 1750068415640,
      "startPosition": "1480.0",
      "dir": "Close Long",
      "closedPnl": "-8.54256",
      "hash": "0xd3e4a7cbd94632b45dbd04259cf7af02021a0084ef0b01e5e07ee06f34dcc3ac",
      "oid": 103041172134,
      "crossed": true,
      "fee": "0.027706",
      "tid": 721956262633271,
      "liquidation": {
        "liquidatedUser": "0x82e79e9786a2a18d62ed6e3beaded9d803748f95",
        "markPx": "0.0418",
        "method": "market"
      },
      "feeToken": "USDC"
    }
  ]
}
```

## Trade Fills

Trade fills is the trades topic enhanced with the fills. However currently we are unable to always get all the fills for a trade.
If you absolutely require the fill, then it is better to use the fills topic which will always be complete.

```json theme={null}
{
  "payload": {
    "coin": "HYPE",
    "extra_fields": {
      "buyer": {
        "builder_fee": null,
        "closed_pnl": "-1.800181",
        "crossed": true,
        "dir": "Close Short",
        "fee": "0.019579",
        "fee_token": "USDC",
        "order_id": 104547724355,
        "start_position": "-92667.36"
      },
      "seller": {
        "builder_fee": null,
        "closed_pnl": "-0.019941",
        "crossed": false,
        "dir": "Close Long",
        "fee": "-0.002996",
        "fee_token": "USDC",
        "order_id": 104547723702,
        "start_position": "7.04"
      }
    },
    "hash": "0x011483d2e4dac0c9df710425ed622a01c2009d120eb4a007cd3812dad4521c9c",
    "px": "34.566",
    "side": "B",
    "sz": "2.89",
    "tid": 1085099771108828,
    "time": 1750478864336,
    "users": [
      "0xefd3ab65915e35105caa462442c9ecc1346728df",
      "0x4fb31d5ffaa08be2128cb14485584d76eebef173"
    ]
  }
}
```

## Misc Events

**Event Types**

| Type                  | Description                                                   | Where Clause                                            |
| :-------------------- | :------------------------------------------------------------ | :------------------------------------------------------ |
| accountActivationGas  |                                                               | event:LedgerUpdate:delta:type = 'accountActivationGas'  |
| accountClassTransfer  | Moving from Perpetuals balance to Spot balance and vice versa | event:LedgerUpdate:delta:type = 'accountClassTransfer'  |
| deployGasAuction      |                                                               | event:LedgerUpdate:delta:type = 'deployGasAuction'      |
| deposit               | deposits from arbitrum                                        | event:LedgerUpdate:delta:type = 'deposit'               |
| internalTransfer      | usdc transfers from one perpetual account to another          | event:LedgerUpdate:delta:type = 'internalTransfer'      |
| liquidation           |                                                               | event:LedgerUpdate:delta:type = 'liquidation'           |
| rewardsClaim          |                                                               | event:LedgerUpdate:delta:type = 'rewardsClaim'          |
| spotGenesis           |                                                               | event:LedgerUpdate:delta:type = 'spotGenesis'           |
| spotTransfer          | spot token transfers                                          | event:LedgerUpdate:delta:type = 'spotTransfer'          |
| subAccountTransfer    | transfer to subaccounts                                       | event:LedgerUpdate:delta:type = 'subAccountTransfer'    |
| vaultCreate           |                                                               | event:LedgerUpdate:delta:type = 'vaultCreate'           |
| vaultDeposit          | deposits into vaults                                          | event:LedgerUpdate:delta:type = 'vaultDeposit'          |
| vaultDistribution     |                                                               | event:LedgerUpdate:delta:type = 'vaultDistribution'     |
| vaultLeaderCommission |                                                               | event:LedgerUpdate:delta:type = 'vaultLeaderCommission' |
| vaultWithdraw         | withdrawals from vaults                                       | event:LedgerUpdate:delta:type = 'vaultWithdraw'         |
| withdraw              | withdraws to arbitrum                                         | event:LedgerUpdate:delta:type = 'withdraw'              |
| CDeposit              | Staking Deposit                                               | event:CDeposit IS NOT NULL                              |
| CWithdrawal           | Staking Withdrawal                                            | event:CWithdrawal IS NOT NULL                           |
| Delegation            |                                                               | event:Delegation IS NOT NULL                            |
| Funding               | Funding fee                                                   | event:Funding IS NOT NULL                               |
| ValidatorRewards      |                                                               | event:ValidatorRewards IS NOT NULL                      |

**AccountClassTransfer**

Moving USDC from the Perpetuals balance to the Spot balance and the Spot balance to the Perpetuals balance.

```json theme={null}
{
  "payload": {
    "time": "2025-06-21T04:13:14.531007927",
    "hash": "0xc3d656ddc9188136cbca0425ed729b01500014ef48b95d534daf2a0b9c0e7e42",
    "inner": {
      "LedgerUpdate": {
        "users": ["0x6f577a1b7e3915d4d8c49c951e2332912a62d8a1"],
        "delta": {
          "type": "accountClassTransfer",
          "usdc": "132.225145",
          "toPerp": true
        }
      }
    }
  }
}
```

**VaultWithdraw**

```json theme={null}
{
  "payload": {
    "time": "2025-06-21T04:12:14.291293956",
    "hash": "0x498f5bfe11627a88c9d40425ed6f9402014000b3cf8b99f28f0c224da6f84d8d",
    "inner": {
      "LedgerUpdate": {
        "users": [
          "0x2c717613dd5c3cb2d51e17d499cf977ffbb88279",
          "0xdfc24b077bc1425ad1dea75bcb6f8158e10df303"
        ],
        "delta": {
          "type": "vaultWithdraw",
          "vault": "0xdfc24b077bc1425ad1dea75bcb6f8158e10df303",
          "user": "0x2c717613dd5c3cb2d51e17d499cf977ffbb88279",
          "requestedUsd": "6019.187643",
          "commission": "0.0",
          "closingCost": "0.0",
          "basis": "6000.709999",
          "netWithdrawnUsd": "6019.187643"
        }
      }
    }
  }
}
```

**Funding**

```json theme={null}
{
  "payload": {
    "hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "inner": {
      "Funding": {
        "coin": "BTC",
        "funding_amount": "-0.000524",
        "funding_rate": "0.0000125",
        "szi": "0.0004",
        "user": "0xdf6454c52c12437e7e8ba3e61e4dd8e41fa7faa5"
      }
    },
    "time": "2025-06-04T22:00:00.054355497"
  }
}
```

**HLP Vault Liquidation**

```json theme={null}
{
  "payload": {
    "time": "2025-05-18T20:00:31.068266548",
    "hash": "0xce021d6212767dcea0740423b9523a02046c00c8f7ca73b17cb17f2d8138013f",
    "inner": {
      "LedgerUpdate": {
        "users": ["0xa4cdf5ada61c413e68acfa80ffaaa23c98d1f940"],
        "delta": {
          "type": "liquidation",
          "liquidatedNtlPos": "202960.84289",
          "accountValue": "2699.469486",
          "leverageType": "Isolated",
          "liquidatedPositions": [
            {
              "coin": "ETH",
              "szi": "85.6411"
            }
          ]
        }
      }
    }
  }
}
```
