Quote WebSocket
Step 1: Get access token
It's necessary to use the Corporate API Authorization to get the access_token.
Step 2: Check the server
To check if the server is running, you can send the message below (type PING
). The expected response message is from type PONG
.
{
"type": "PING",
"data": {
}
}
{
"type": "PONG",
"data": {
"at": "2022-06-10T14:11:18.007Z"
}
}
Step 3: Receive updated quotes
To start receiving updated quotes, it is needed to send the message below (type LOGIN
).
{
"type": "LOGIN",
"data": {
"accessToken": "<access_token>"
}
}
Then the inbound and outbound quotes will be streamed through the message below (type QUOTE_DELIVERY
). This message has an interval of 1 second.
{
"data": {
"quotes": [
{
"id": "d4a7ff04-b15a-4aa9-848e-bd4837b84583",
"corporateId": "cdc02c78-9a26-4483-874d-38b8c1c162d8",
"quotedAmount": 1,
"direction": "OUTBOUND",
"purpose": "CRYPTO",
"baseCurrencyISO": "USD",
"quotedCurrencyISO": "BRL",
"exchangeRate": 5.0620649661,
"createdAt": "2022-06-10T12:35:52.681Z",
"expiresIn": "2022-06-10T12:40:52.681Z"
},
{
"id": "9ca4a24a-5c88-41d0-9a19-b89ad53f9f8b",
"corporateId": "cdc02c78-9a26-4483-874d-38b8c1c162d8",
"quotedAmount": 1,
"direction": "INBOUND",
"purpose": "CRYPTO",
"baseCurrencyISO": "BRL",
"quotedCurrencyISO": "USD",
"exchangeRate": 5.007636,
"createdAt": "2022-06-10T12:35:53.328Z",
"expiresIn": "2022-06-10T12:40:53.328Z"
}
]
},
"type": "QUOTE_DELIVERY"
}
Attention
It is only allowed to have only one connection at a time, when making a new connection, the previous one will be disconnected.
Updated over 1 year ago