Getting Started
Endpoints
Each data type corresponds to a relevant endpoint:
Data Type | Description | Endpoint |
---|---|---|
Aggregated trade metrics | candlesticks (open, high, low, close, volume, trades count, VWAP) with granularities of 1h an 1m. | wss://api.financial.inca.digital/ws/trade-metrics |
Trades | executed tick-level transactions (matched order book) | wss://api.financial.inca.digital/ws/trades |
Authentication
To establish a new websocket connection to an endpoint with a selected data type, you should authorize with an API key.
HTTP Header:
Authorization: <API key>
Request/Response Message
A request/response message consists of 3 fields: traceId
,type
and payload
. It’s highly recommended that you provide an optional traceId
request unique identifier so that success or failure responses can be matched. Follow the links to find payload and type examples for OHLCV and trades endpoints.
{
"traceId": "<unique id generated by user>",
"type": "<type of request>",
"payload": {"<payload object>"
}
}
Field Name | Type | Required | Description |
---|---|---|---|
traceId | String | false | Random string generated by user to correlate response messages |
type | String | true | Unique message type name |
payload | Object | true | Payload object, structure depends on message type |
Data formats
JSON is currently the only supported default format.
Websocket Ping-Pong
We highly recommend using the ping-pong messages in client to keep websocket connections alive as long as possible, even behind proxies and load balancers.
At any point after the handshake, the server sends a ping to the clients. When the ping is received, the client must send back a pong as soon as possible. This is used to make sure that the client is still connected.
Predict data loosing
To exclude loss of data during internet connection stability or reconnecting, we use queue of the messages for last 2 mins to always deliver these messages when the ws connection is established.
Troubleshooting
The following HTTP codes can be received during websocket connection establishment:
HTTP Code | Description |
---|---|
401 - Unauthorized | Request cannot be authorized for some reason |
403 - Forbidden | User access to the requested resource is denied |
429 - Too Many Requests | User has exceeded connections or transferred bytes limits |
503 - Service Unavailable | Service is temporarily unavailable |
You can find more error details in the provided response.
HTTP Header:
x-inca-error-message: <MESSAGE>