Quickstart
Connect to an authenticated Polaris liquidity book stream.
Request access first, then open a server-side WebSocket to the liquidity book stream:
wss://data.polarislab.xyz/ws?feed=liquidity_book&pair=SOL-USDC&profile=denseMinimal Node example:
import WebSocket from "ws";
const ws = new WebSocket("wss://data.polarislab.xyz/ws?feed=liquidity_book&pair=SOL-USDC&profile=dense", {
headers: { Authorization: `Bearer ${process.env.POLARIS_DATA_API_KEY}` },
});
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
if (message.type === "hello" || message.type === "subscribed") return;
console.log(message);
};The first data payload is a liquidity_book message with an aggregate book, per-pool books,
current slot, and freshness fields.