Connect WebSocket
Set up FastConnect WebSocket connection and general request rules.
Overview
FastConnect WebSocket is used to stream trading and market data in real time.
Before connecting, the client must obtain a token from the getAccessToken API.
Connection endpoint
wss://stream.ssi.com.vnUsage requirements
- Access token is still valid.
- The client keeps heartbeat throughout the connection session.
- After reconnecting, the client must subscribe again to required topics.
Authentication and connection
The document describes how to obtain a token from client_id, api_key, api_secret via the auth API.
Then use that token to connect to the stream.
{
"client_id": "666666",
"api_key": "<api-key>",
"api_secret": "<api-secret>",
"access_token": "<access-token>"
}General WebSocket request structure
Every message sent via WebSocket follows this general structure:
{
"method": "SUBSCRIBE|UNSUBSCRIBE|LIST_SUBSCRIPTION|PING|PONG",
"channel": "TRADING|DATA|HEARTBEAT",
"topics": ["trade.SSI@tick", "trade.SSI@1m", "room.*"]
}List subscription
The client can check current scopes with this request:
{
"method": "LIST_SUBSCRIPTION"
}The response returns access scopes by trading/data groups.
Main event types
connectheartbeatorderEventorderMatchEventclientPortfolioEventfcoEvent— conditional order (FCO) eventtradequoteroomputoddlotmarkettrade.index— realtime index valueindexsummary— index summary information
data-corporateActionsGET
Retrieve corporate action events (cash dividends, stock dividends, rights issues, etc.) by symbol and date range. Events that have an ex-rights date are filtered by that date; newly announced events without an ex-rights date yet are filtered by their issue date or announcement date, in which case `exrightDate` and `ratio` may be empty strings. Results are sorted by ex-rights date in descending order. The required scope is `data:corporateActions:get`.
Heartbeat and SubscriptionWS
Describes ping/pong, heartbeat, and subscription listing for FastConnect WebSocket.