watchOrders
Receba atualizações em tempo real sobre o status das ordens de compra e venda.
Subscrição
{
"action": "subscribe",
"channel": "watchOrders"
}
Payload de Dados
{
"channel": "watchOrders",
"message": {
"account": "string",
"id": "string",
"orderPoolId": "number",
"side": "buy | sell",
"symbol": "string",
"exchange": "string",
"status": "string",
"filledStatus": "string",
"amount": "string",
"amountOriginal": "string",
"remainingAmount": "string",
"filled": "string",
"remaining": "string",
"quoteAmount": "string",
"quoteAmountOriginal": "number",
"remainingQuoteAmount": "string",
"cost": "string",
"price": "string",
"average": "string",
"info": "string",
"errorMessage": "string",
"type": "string",
"channel": "string",
"createdAt": "number",
"updatedAt": "number",
"fee": {
"cost": "string",
"rate": "string",
"cripto": "string",
"tierCaas": {
"currentTierFeeRate": "string",
"currentTierFeeFiat": "string",
"currentTierFeeCripto": "string"
}
},
"trades": [
{
"id": "number",
"side": "string",
"price": "string",
"amount": "string",
"cost": "string",
"timestamp": "number",
"fee": {
"cost": "string",
"rate": "string",
"cripto": "string"
}
}
]
}
}
Campos Principais
| Campo | Tipo | Descrição |
|---|---|---|
account | string | ID da conta do cliente |
id | string | Identificador da ordem |
side | string | buy ou sell |
symbol | string | Par de mercado (ex: BTC/BRL) |
exchange | string | Exchange utilizada |
status | string | Status da ordem (closed, executed, rejected, pending) |
amount | string | Quantidade de cripto negociada |
quoteAmount | string | Valor em FIAT (R$) |
average | string | Preço médio de execução |
fee | object | Detalhes das taxas |
trades | array | Lista de trades individuais |
Exemplo JavaScript
const ws = new WebSocket('wss://websocket-caas-it-sandbox.liqi.app.br/');
ws.onopen = () => {
ws.send(JSON.stringify({
action: 'subscribe',
channel: 'watchOrders'
}));
};
ws.onmessage = (event) => {
const { channel, message } = JSON.parse(event.data);
if (channel === 'watchOrders') {
console.log(`Ordem ${message.id}: ${message.status}`);
console.log(`${message.side} ${message.amount} ${message.symbol} @ ${message.average}`);
}
};