Skip to content

Quote Push Overview

WebSocket quote push is used to continuously receive real-time market data changes after a connection is established. It is suitable for scenarios with high time-sensitivity requirements such as quote dashboards, market monitoring, strategy triggering, and trade-detail streams.

WebSocket Quote endpoint:

text
wss://webapi-quote.moomoo.com

Capabilities

CategoryDescription
Basic QuotePushes Quote basic quote fields for a symbol, including last price, open price, high price, low price, prev close price, volume, turnover, and security status.
Order BookPushes the real-time order book for a symbol. The number of levels and the book shape depend on the user's quote permission level (LV1/LV2/LV3) and the security category.
TickerPushes trade details, including trade time, sequence, direction, price, volume, turnover, and trade type.
K-linePushes updates for the current K-line. Supports minute/daily/weekly/monthly/quarterly/yearly periods. The actual available periods and adjustment methods are subject to the subscription API and the data format page.
Broker QueueSome Hong Kong Stock categories may return a broker queue along with the order book capability. Availability depends on the market, category, and permission.
Market StatePushes market-level trading state information, such as market, status, and trade date.

For the message structure, event types, and field meanings of WebSocket push, see Data Format.

Onboarding Flow

StepDescription
1. Establish connectionConnect to the WebSocket Quote endpoint wss://webapi-quote.moomoo.com.
2. Login authenticationAfter the connection is established, complete login authentication first. Using a Bearer Token obtained via OAuth 2.1 + PKCE is recommended; the legacy API Key method is also compatible. See Authentication.
3. Subscribe to dataSubscribe by symbol code and data type, such as basic quote, order book, ticker, or K-line. See Subscribe and Unsubscribe.
4. Receive pushesThe server returns JSON messages over WebSocket when market data changes. The client should distinguish message types such as QUOTE, ORDER_BOOK, TICKER, and KLINE by type.
5. Keep-aliveRefresh the token periodically to keep the connection valid and avoid disconnects caused by token expiration. See Keep-alive.
6. ReconnectAfter a disconnect, the client should reconnect, re-authenticate, and re-subscribe to the required symbols. Do not assume the subscription state is automatically restored after a disconnect.

Subscription and Push Types

The market data types a client can explicitly subscribe to typically include:

  • quote — basic quote, corresponding to the QUOTE push message.
  • order_book — order book, corresponding to the ORDER_BOOK push message.
  • ticker — ticker / trade tick, corresponding to the TICKER push message.
  • kline — current K-line, corresponding to the KLINE push message.

The server may also push derivative messages based on the subscribed symbols and permissions:

  • BROKER_QUEUE — broker queue, mainly related to the order book capability of some Hong Kong Stock categories.
  • MARKET_STATE — market state, pushed at the market level and not bound to a single symbol.

Symbol Code

Subscription requests use a unified symbol code format {market}.{code} for developers, such as HK.00700 and US.AAPL. Different markets, categories, and quote permissions may support different data types. Refer to the specific API description and permission results.

Relationship with REST Real-time Quote

Both WebSocket push and REST real-time quote are used to obtain real-time market data, but they apply to different scenarios:

ScenarioRecommended Approach
Need to continuously receive changesUse WebSocket quote push; after subscribing, the server actively pushes updates.
Only need a one-time queryUse the REST real-time quote API, such as market snapshot, real-time quote, order book, current K-line, or ticker.
Few symbols with low refresh frequencyREST polling is acceptable; the logic is simple and convenient for on-demand retrieval.
Many symbols with high-frequency updatesPrefer WebSocket push to avoid frequent REST polling.
Backfill after a disconnectAfter reconnecting, use REST to query the latest snapshot, then resume the WebSocket subscription.

Related REST APIs:

  • Market Snapshot — batch retrieve market snapshots for symbols (real-time).
  • Real-time Quote — batch retrieve real-time stock quotes for symbols (lightweight snapshot), aligned with the Quote basic quote in push.
  • Order Book — retrieve the real-time order book for a symbol.
  • Current K-line — retrieve the current K-line data for a symbol.
  • Ticker — retrieve the ticker / trade tick data for a symbol.

Important Constraints

  • Authenticate before subscribing: When login authentication is not completed or permissions are insufficient, subscription or push may fail.
  • Permissions affect returned content: Market permissions, category permissions, and the quote permission level (LV1/LV2/LV3) affect the subscribable data types, the number of order book levels, and the availability of depth data.
  • Subscriptions consume quota: Subscribed symbols and data types consume the corresponding quota. Subscribe on demand and unsubscribe promptly when leaving a page or no longer needing the data. See Rate Limit and Quota.
  • Long connections require fault tolerance: Network switching, proxy timeouts, and server maintenance can all cause disconnects. The client should implement reconnection, re-authentication, and re-subscription.
  • Do not rely on message ordering to backfill history: Push is used for real-time incremental notifications. To retrieve the complete state at a given time or the latest state during a disconnect, use the REST real-time quote API.
  • Fields may be omitted by category: Fields not applicable to a category may be omitted, set to 0, or empty. When parsing, handle them compatibly according to Data Format.

Next Steps

  • Getting Started — Obtain access credentials and learn about the API Host, authentication methods, and common conventions.
  • Authentication — Learn the login authentication flow after the WebSocket connection.
  • Subscribe and Unsubscribe — Learn how to subscribe, unsubscribe, and manage subscription state.
  • Keep-alive — Recommendations for heartbeat, timeout, reconnection, and other long-connection handling.
  • Data Format — View the push message structure, message types, and field descriptions.
  • Error Codes — Troubleshoot authentication, subscription, permission, and quota errors.
  • Rate Limit and Quota — Learn about subscription quotas, call rates, and retry recommendations.