Stream Subscription API

Stream Subscription API is a real-time data push service based on the WebSocket protocol. Unlike the request-response model of REST APIs, WebSocket establishes a persistent connection, allowing the server to proactively push data to the client.

FeaturesWebSocketREST API
DelayLowHigh than websocket
Push modeServer active pushClient polling
ConnectPersistent connectionNew per request

Applicable scenarios : real-time market display, order status monitoring, account asset change notification, high-frequency trading data acquisition


Connection address


Public channels (no certification required):

wss://stream-hk.osl.com/ws/v5/public
wss://stream-hk.oslsandbox.com/ws/v5/public


Private channels (authentication required):

wss://stream-hk.osl.com/ws/v5/private
wss://stream-hk.oslsandbox.com/ws/v5/private


Connection parameters :

ParameterExplanation
Heartbeat interval30 seconds (recommended)
Connection timed out60 seconds no data automatically disconnected
Connection restrictions100/IP, current active sessions
Message sizeUp to 64KB

Heartbeat

Client needs to send a heartbeat every 30 seconds to keep the connection active. If there is no subscription or server does not push data within 60 seconds after connection, the system will automatically disconnect.

Heartbeat request : ping

Heartbeat response : pong


Error code

Error codeExplanation
30001Channel does not exist
30002Illegal request
30003Invalid op
30004User needs to log in
30005Login failed
30011Invalid ACCESS_KEY
30013Invalid ACCESS_TIMESTAMP
30014Request timestamp expired
30015Invalid signature
30016Parameter error