Reporting Websocket
This channel allows you to keep up to date with the status of your account. You can receive updates on your balances and orders. Each request requires authentication with signatures.
Last updated
const WebSocket = require("ws");
const crypto = require("crypto");
const ws = new WebSocket("");
const apiKey = "";
const secret = "";
function subscribeToOrders() {
const timestamp = Date.now().toString();
const payload = {
type: "subscribe",
channel: "executionReport",
nonce: timestamp
};
const apiSignature = crypto
.createHmac("sha384", secret)
.update(JSON.stringify(payload))
.digest("hex");
const subsOption = JSON.stringify({
...payload,
apiKey,
apiSignature
});
ws.send(subsOption);
}
ws.on("open", () => {
console.log(WS tunnel opened - trade);
subscribeToOrders({ apiKey, secret });
});
ws.on("message", data => {
console.log("data", data);
});const WebSocket = require("ws");
const crypto = require("crypto");
const ws = new WebSocket("");
const apiKey = "";
const secret = "";
function subscribeToOrders() {
const timestamp = Date.now().toString();
const payload = {
type: "subscribe",
channel: "parentOrderReport",
nonce: timestamp
};
const apiSignature = crypto
.createHmac("sha384", secret)
.update(JSON.stringify(payload))
.digest("hex");
const subsOption = JSON.stringify({
...payload,
apiKey,
apiSignature
});
ws.send(subsOption);
}
ws.on("open", () => {
console.log(WS tunnel opened - trade);
subscribeToOrders({ apiKey, secret });
});
ws.on("message", data => {
console.log("data", data);
});javaconst WebSocket = require("ws");
const crypto = require("crypto");
const ws = new WebSocket("");
const apiKey = "";
const secret = "";
function subscribeToOrders() {
const timestamp = Date.now().toString();
const payload = {
type: "subscribe",
channel: "balanceReport",
nonce: timestamp
};
const apiSignature = crypto
.createHmac("sha384", secret)
.update(JSON.stringify(payload))
.digest("hex");
const subsOption = JSON.stringify({
...payload,
apiKey,
apiSignature
});
ws.send(subsOption);
}
ws.on("open", () => {
console.log(WS tunnel opened - trade);
subscribeToOrders({ apiKey, secret });
});
ws.on("message", data => {
console.log("data", data);
});{
"type": "balance",
"payload": {
"createdAt": 1554400262916,
"accountId": "CA1000051R",
"symbol": "BTC",
"totalBalance": 2.30044886,
"depositAddress": "-",
"usernameSymbol": "helloWorld_BTC",
"pendingTransfer": 0,
"itemDateTime": 1557267645512,
"availableBalance": 2.24044886,
"updatedAt": 1554400262916,
"username": "helloWorld"
}
}{
"type": "order",
"payload": {
"createdAt": 1557267645477,
"accountId": "CA1000051R",
"symbol": "BTC-USD",
"totalBalance": 2.40047884,
"depositAddress": "-",
"usernameSymbol": "helloWorld_BTC",
"pendingTransfer": 0,
"itemDateTime": 1557267645646,
"availableBalance": 2.24044886,
"updatedAt": 1557267645477,
"username": "helloWorld"
}
}{
"type": "order",
"payload": {
"createdAt": 1557267645477,
"accountId": "CA1000051R",
"symbol": "BTC-USD",
"totalBalance": 2.40047884,
"depositAddress": "-",
"usernameSymbol": "helloWorld_BTC",
"pendingTransfer": 0,
"itemDateTime": 1557267645646,
"availableBalance": 2.24044886,
"updatedAt": 1557267645477,
"username": "helloWorld"
}
}{
"type": "balance",
"payload": {
"createdAt": 1554400262916,
"accountId": "CA1000051R",
"symbol": "BTC",
"totalBalance": 2.30044886,
"depositAddress": "-",
"usernameSymbol": "helloWorld_BTC",
"pendingTransfer": 0,
"itemDateTime": 1557267645512,
"availableBalance": 2.24044886,
"updatedAt": 1554400262916,
"username": "helloWorld"
}
}{
"type": "tradeCreditBalance",
"payload": {
"accountId": "CA1000051R",
"adjustedMtmUSD": 49215.15490545314
"createdAt": 1701366866377,
"ltv": 167.79987870494583,
"unutilizedCreditUSD": 950489.7899944618
"updatedAt": 1712857675713,
"username": "helloWorld"
}
}