LegendTrade · AsyncAPI Specification

Legend WebSocket API

Version 0.1.0

Legend's Hyperliquid-compatible WebSocket at wss://api.legend.trade/ws, using subscription-based messaging. Clients subscribe to named channels; the server streams matching events. GENERATED by the API Evangelist enrichment pipeline on 2026-07-19 from the API's own self-describing root document (GET https://api.legend.trade), which enumerates the `/ws` path and the exact `wsSubscriptions` channel names under `marketData` and `userData`. Channel names are verbatim from that document. Message payload schemas are NOT modelled — Legend does not publish them and they were not observed on the wire, so they are left as open objects rather than invented.

View Spec View on GitHub CompanyDeFiTradingCryptocurrencyPerpetual FuturesSocial TradingCopy TradingMarket DataHyperliquidWebSocketAsyncAPIEventsWebSockets

Channels

trades
Market data — executed trades.
candle
Market data — candle updates.
activeAssetCtx
Market data — context for the active asset.
userFills
User data — fills for the subscribed account.
openOrders
User data — current open orders.
orderUpdates
User data — order lifecycle updates.
clearinghouseState
User data — margin and position state.
notification
User data — account notifications.
webData3
User data — aggregated client state payload.
twapStates
User data — state of running TWAP orders.
userEvents
User data — account events.
userFundings
User data — funding payments.
userNonFundingLedgerUpdates
User data — ledger updates other than funding.
activeAssetData
User data — per-asset account data.
userTwapSliceFills
User data — fills from individual TWAP slices.
userTwapHistory
User data — historical TWAP orders.

Messages

MarketDataEvent
Market data event
A market-data event on a public channel. Payload schema not published by Legend.
UserDataEvent
User data event
An account-scoped event. Payload schema not published by Legend.

Servers

wss
production
Production WebSocket endpoint.

AsyncAPI Specification

Raw ↑
asyncapi: 3.0.0
info:
  title: Legend WebSocket API
  version: 0.1.0
  description: >-
    Legend's Hyperliquid-compatible WebSocket at wss://api.legend.trade/ws,
    using subscription-based messaging. Clients subscribe to named channels;
    the server streams matching events.

    GENERATED by the API Evangelist enrichment pipeline on 2026-07-19 from the
    API's own self-describing root document (GET https://api.legend.trade),
    which enumerates the `/ws` path and the exact `wsSubscriptions` channel
    names under `marketData` and `userData`. Channel names are verbatim from
    that document. Message payload schemas are NOT modelled — Legend does not
    publish them and they were not observed on the wire, so they are left as
    open objects rather than invented.
  contact:
    name: Legend
    url: https://docs.legend.trade
  x-api-evangelist:
    method: generated
    generated: '2026-07-19'
    source: https://api.legend.trade (self-describing root, `wsSubscriptions`)
    upstream: https://hyperliquid.xyz
    caveat: >-
      Channel names are provider-published; payload schemas are unmodelled by
      design. A plain HTTPS GET to /ws returns 404 — the path is upgrade-only.
servers:
  production:
    host: api.legend.trade
    pathname: /ws
    protocol: wss
    description: Production WebSocket endpoint.
channels:
  trades:
    address: trades
    title: Trades
    description: Market data — executed trades.
    messages:
      trades:
        $ref: '#/components/messages/MarketDataEvent'
  candle:
    address: candle
    title: Candle
    description: Market data — candle updates.
    messages:
      candle:
        $ref: '#/components/messages/MarketDataEvent'
  activeAssetCtx:
    address: activeAssetCtx
    title: Active asset context
    description: Market data — context for the active asset.
    messages:
      activeAssetCtx:
        $ref: '#/components/messages/MarketDataEvent'
  userFills:
    address: userFills
    title: User fills
    description: User data — fills for the subscribed account.
    messages:
      userFills:
        $ref: '#/components/messages/UserDataEvent'
  openOrders:
    address: openOrders
    title: Open orders
    description: User data — current open orders.
    messages:
      openOrders:
        $ref: '#/components/messages/UserDataEvent'
  orderUpdates:
    address: orderUpdates
    title: Order updates
    description: User data — order lifecycle updates.
    messages:
      orderUpdates:
        $ref: '#/components/messages/UserDataEvent'
  clearinghouseState:
    address: clearinghouseState
    title: Clearinghouse state
    description: User data — margin and position state.
    messages:
      clearinghouseState:
        $ref: '#/components/messages/UserDataEvent'
  notification:
    address: notification
    title: Notification
    description: User data — account notifications.
    messages:
      notification:
        $ref: '#/components/messages/UserDataEvent'
  webData3:
    address: webData3
    title: Web data
    description: User data — aggregated client state payload.
    messages:
      webData3:
        $ref: '#/components/messages/UserDataEvent'
  twapStates:
    address: twapStates
    title: TWAP states
    description: User data — state of running TWAP orders.
    messages:
      twapStates:
        $ref: '#/components/messages/UserDataEvent'
  userEvents:
    address: userEvents
    title: User events
    description: User data — account events.
    messages:
      userEvents:
        $ref: '#/components/messages/UserDataEvent'
  userFundings:
    address: userFundings
    title: User fundings
    description: User data — funding payments.
    messages:
      userFundings:
        $ref: '#/components/messages/UserDataEvent'
  userNonFundingLedgerUpdates:
    address: userNonFundingLedgerUpdates
    title: User non-funding ledger updates
    description: User data — ledger updates other than funding.
    messages:
      userNonFundingLedgerUpdates:
        $ref: '#/components/messages/UserDataEvent'
  activeAssetData:
    address: activeAssetData
    title: Active asset data
    description: User data — per-asset account data.
    messages:
      activeAssetData:
        $ref: '#/components/messages/UserDataEvent'
  userTwapSliceFills:
    address: userTwapSliceFills
    title: User TWAP slice fills
    description: User data — fills from individual TWAP slices.
    messages:
      userTwapSliceFills:
        $ref: '#/components/messages/UserDataEvent'
  userTwapHistory:
    address: userTwapHistory
    title: User TWAP history
    description: User data — historical TWAP orders.
    messages:
      userTwapHistory:
        $ref: '#/components/messages/UserDataEvent'
operations:
  receiveTrades:
    action: receive
    channel:
      $ref: '#/channels/trades'
  receiveCandle:
    action: receive
    channel:
      $ref: '#/channels/candle'
  receiveActiveAssetCtx:
    action: receive
    channel:
      $ref: '#/channels/activeAssetCtx'
  receiveUserFills:
    action: receive
    channel:
      $ref: '#/channels/userFills'
  receiveOpenOrders:
    action: receive
    channel:
      $ref: '#/channels/openOrders'
  receiveOrderUpdates:
    action: receive
    channel:
      $ref: '#/channels/orderUpdates'
  receiveClearinghouseState:
    action: receive
    channel:
      $ref: '#/channels/clearinghouseState'
  receiveNotification:
    action: receive
    channel:
      $ref: '#/channels/notification'
  receiveWebData3:
    action: receive
    channel:
      $ref: '#/channels/webData3'
  receiveTwapStates:
    action: receive
    channel:
      $ref: '#/channels/twapStates'
  receiveUserEvents:
    action: receive
    channel:
      $ref: '#/channels/userEvents'
  receiveUserFundings:
    action: receive
    channel:
      $ref: '#/channels/userFundings'
  receiveUserNonFundingLedgerUpdates:
    action: receive
    channel:
      $ref: '#/channels/userNonFundingLedgerUpdates'
  receiveActiveAssetData:
    action: receive
    channel:
      $ref: '#/channels/activeAssetData'
  receiveUserTwapSliceFills:
    action: receive
    channel:
      $ref: '#/channels/userTwapSliceFills'
  receiveUserTwapHistory:
    action: receive
    channel:
      $ref: '#/channels/userTwapHistory'
components:
  messages:
    MarketDataEvent:
      name: MarketDataEvent
      title: Market data event
      summary: A market-data event on a public channel. Payload schema not published by Legend.
      contentType: application/json
      payload:
        type: object
        additionalProperties: true
    UserDataEvent:
      name: UserDataEvent
      title: User data event
      summary: An account-scoped event. Payload schema not published by Legend.
      contentType: application/json
      payload:
        type: object
        additionalProperties: true

Work with this as data

Every AsyncAPI spec here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for asyncapi

4 MCP tools reach this
  • find_asyncapisBrowse and filter every AsyncAPI spec in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This AsyncAPI spec
curl "https://apis.io/api/v1/asyncapis/legendtrade-ws-asyncapi"
All asyncapi
curl "https://apis.io/api/v1/asyncapis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.