WebSocket
Stream real-time market data for liquidity pools across supported DEXs. Updates are emitted every block for pools that had transactions or state changes.
Endpoint
wss://enterprise.guardis.io/v1/market-data/wsAuthentication
Include your API key as a query parameter when connecting.
wss://enterprise.guardis.io/v1/market-data/ws?api_key=your_api_key_hereQuery Parameters
api_key
string
Yes
Your Guardis API key
dex-name
string
No
Comma-separated list of DEXs to filter by. If omitted, all supported DEXs are included
Supported DEX values:
PumpFunPumpSwapMeteoraDLMM
Example connection with filters:
wss://enterprise.guardis.io/v1/market-data/ws?api_key=your_api_key_here&dex-name=PumpFun,PumpSwapResponse Format
Once connected, you'll receive a stream of PoolBlockUpdate messages. Each message contains all pools that were modified during that block.
PoolBlockUpdate
{
"block_number": 284521789,
"timestamp": "2025-01-15T14:32:08.456Z",
"pools": [
{
"pair_address": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"token_address": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
"is_liquidity_locked": false,
"sol_amount": "1523.847291635",
"token_amount": "892847291.847362",
"sol_price_usd": "187.42",
"price_sol": "0.000001847",
"price_usd": "0.000346289",
"number_of_buys": 847,
"number_of_sells": 234,
"buy_volume_usd": "284729.47",
"sell_volume_usd": "94827.33",
"total_volume_usd": "379556.80",
"ath_token_price_usd": "0.00089247"
}
]
}Field Reference
PoolBlockUpdate
block_number
integer
The Solana slot number that was just processed
timestamp
string
ISO 8601 timestamp when the block update was sent
pools
array
All pools that had state changes during this block
PoolSnapshot
pair_address
string
The on-chain address of the liquidity pool
token_address
string
The mint address of the token
is_liquidity_locked
boolean
Whether the pool's liquidity is locked
sol_amount
string
Amount of SOL currently in the pool
token_amount
string
Amount of tokens currently in the pool
sol_price_usd
string
Price of SOL in USD at time of snapshot
price_sol
string
Token price denominated in SOL
price_usd
string
Token price denominated in USD
number_of_buys
integer
Total buy transactions on this pool
number_of_sells
integer
Total sell transactions on this pool
buy_volume_usd
string
Cumulative buy volume in USD
sell_volume_usd
string
Cumulative sell volume in USD
total_volume_usd
string
Cumulative trading volume in USD
ath_token_price_usd
string
All-time high token price in USD
Note: Decimal values are returned as strings to preserve precision.
Example Usage
JavaScript:
const socket = new WebSocket(
"wss://enterprise.guardis.io/v1/market-data/ws?api_key=your_api_key_here&dex-name=PumpFun"
);
socket.onopen = () => {
console.log("Connected to Guardis market data stream");
};
socket.onmessage = (event) => {
const update = JSON.parse(event.data);
console.log(`Block ${update.block_number}: ${update.pools.length} pools updated`);
for (const pool of update.pools) {
console.log(`${pool.token_address}: $${pool.price_usd}`);
}
};
socket.onerror = (error) => {
console.error("WebSocket error:", error);
};
socket.onclose = () => {
console.log("Connection closed");
};Python:
import asyncio
import websockets
import json
async def stream_market_data():
uri = "wss://enterprise.guardis.io/v1/market-data/ws?api_key=your_api_key_here&dex-name=PumpFun,PumpSwap"
async with websockets.connect(uri) as socket:
print("Connected to Guardis market data stream")
async for message in socket:
update = json.loads(message)
print(f"Block {update['block_number']}: {len(update['pools'])} pools updated")
for pool in update["pools"]:
print(f"{pool['token_address']}: ${pool['price_usd']}")
asyncio.run(stream_market_data())Connection Best Practices
Implement reconnection logic — Network interruptions happen; automatically reconnect with exponential backoff
Handle heartbeats — Keep your connection alive by responding to ping frames if required by your WebSocket client
Process messages asynchronously — Don't block on message processing; queue updates if needed to avoid falling behind
Last updated
