Skip to content

Trade Event Push Overview

WebSocket trade event push delivers real-time account-level trade notifications after the connection is established and authentication is complete. It is suitable for time-sensitive scenarios such as order status changes and fill status changes.

WebSocket Trade endpoint:

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

Capabilities

Event TypeDescription
EVENT_NEWOrder placed successfully. The order has been accepted by the exchange or system.
EVENT_REPLACEDOrder modified successfully. The order price or quantity has been updated.
EVENT_CANCELEDOrder cancelled successfully. The order has been cancelled.
EVENT_EXPIREDOrder expired. The order was cancelled by the system when its time-in-force expired.
EVENT_FILLFill event. Covers both partial fills and full fills.
EVENT_NEW_REJECTEDOrder placement rejected. The order was rejected by the exchange or system.
EVENT_REPLACE_REJECTEDOrder modification rejected. The modification request was rejected; the original order is unchanged.
EVENT_CANCEL_REJECTEDOrder cancellation rejected. The cancellation request was rejected; the original order is unchanged.
EVENT_FILL_CORRECTFill correction. An existing fill has been corrected.
EVENT_FILL_CANCELFill cancellation. An existing fill has been cancelled by the system.

See Data Format for the full field reference of push messages.

Integration Flow

StepDescription
1. Establish connectionConnect to the WebSocket Trade endpoint wss://webapi-trade.moomoo.com.
2. AuthenticateAfter the connection is established, complete authentication first. OAuth 2.1 + PKCE Bearer Token is recommended; traditional API Key is also supported. See Authentication.
3. Receive eventsOnce authenticated, all trade events for the current user are pushed automatically — no explicit subscription request is needed. The server pushes JSON messages when trade events occur. See Subscription.
4. Keep aliveRefresh the token periodically to maintain the connection and prevent disconnection due to token expiry. See Keep Alive.
5. Reconnect on disconnectWhen the connection drops, the client should reconnect and re-authenticate. Event push resumes automatically after reconnection. Do not assume events that occurred during the disconnect will be replayed.

Important Constraints

  • Authentication required: No events will be pushed until authentication is complete.
  • No replay on reconnect: Trade events that occur while the connection is down will not be replayed after reconnection. Use REST APIs to query historical orders or fills if needed.
  • Long connections need fault tolerance: Network switches, proxy timeouts, and server maintenance can all cause disconnections. Clients should implement reconnection and re-authentication.
  • Event order is not guaranteed: In rare cases, network jitter may cause events to arrive out of order. Do not rely solely on push order to drive state machines.

Next Steps

  • Authentication — Learn about the authentication flow after establishing a WebSocket connection.
  • Subscription — Learn about the subscription model and event coverage.
  • Keep Alive — Learn about heartbeats, timeouts, and reconnection handling.
  • Data Format — View the push message structure, event types, and field reference.
  • Error Codes — Troubleshoot authentication and connection errors.