Skip to main content
Connect to the WebSocket endpoint at /pos and send a "quote" event to receive live pricing with FX margin calculations.

Connection

wss://secureapi.gridlog.io/pos

Sending a Quote Request

Send a JSON message with the following structure:
{
  "event": "quote",
  "requestId": "req-12345",
  "payload": {
    "chain": "polygon",
    "token": "USDC",
    "localAmount": "37500.00",
    "localCurrency": "NGN",
    "businessId": "456e7890-e89b-12d3-a456-426614174001"
  }
}

Message Fields

FieldTypeRequiredDescription
eventstringYesMust be "quote"
requestIdstringYesUnique ID to match this request with the response
payload.chainstringYesBlockchain network (e.g., "polygon")
payload.tokenstringYes"USDC" or "USDT"
payload.localAmountstringNoAmount in local currency (provide this or amount)
payload.localCurrencystringNoISO currency code (e.g., "NGN")
payload.amountstringNoAmount in cryptocurrency (provide this or localAmount)
payload.businessIdstringNoBusiness ID for margin calculation

Quote Response

{
  "event": "quote",
  "requestId": "req-12345",
  "data": {
    "chain": "polygon",
    "token": "USDC",
    "amount": "25.00",
    "localAmount": "37500.00",
    "fee": "0.50",
    "fxMargin": "2.5"
  }
}

Error Response

{
  "event": "error",
  "requestId": "req-12345",
  "error": "Invalid parameters"
}

Example

Node.js
const WebSocket = require("ws");

const ws = new WebSocket("wss://secureapi.gridlog.io/pos");

ws.on("open", () => {
  ws.send(JSON.stringify({
    event: "quote",
    requestId: "req-12345",
    payload: {
      chain: "polygon",
      token: "USDC",
      localAmount: "37500.00",
      localCurrency: "NGN",
    },
  }));
});

ws.on("message", (data) => {
  const msg = JSON.parse(data);
  if (msg.event === "quote") {
    console.log(`${msg.data.amount} USDC = ${msg.data.localAmount} NGN`);
    console.log(`Fee: ${msg.data.fee} | FX Margin: ${msg.data.fxMargin}%`);
  }
});
For one-off quotes, use the Get POS Quote REST endpoint instead.