Websocket

Connect via WebSocket to receive real-time notifications when your trigger conditions are met.

How Triggers Work

  1. Connect — Establish a persistent WebSocket connection to receive notifications

  2. Create Triggers — Use the REST API to define triggers with unique identifiers and market conditions

  3. Receive Notifications — When a trigger condition is met, a notification is dispatched to your connected client


Endpoint

wss://enterprise.guardis.io/v1/triggers/ws

Authentication

Include your API key as a query parameter when connecting.

wss://enterprise.guardis.io/v1/triggers/ws?api_key=your_api_key_here

Message Types

Connection Established

{
  "type": "connected",
  "message": "Successfully connected to triggers stream"
}

Trigger Fired

When a trigger's conditions are met, you'll receive a notification with the trigger ID and current pool state:


Field Reference

Trigger Notification

Field
Type
Description

type

string

Notification type (trigger_fired)

trigger_id

string

Your unique trigger identifier

fired_at

string

ISO 8601 timestamp when the trigger fired

pool

object

Current pool state that triggered the notification

Pool

Field
Type
Description

pair_address

string

The on-chain address of the liquidity pool

token_address

string

The mint address of the token

sol_amount

string

Amount of SOL currently in the pool

token_amount

string

Amount of tokens currently in the pool

number_of_buys

integer

Total buy transactions on the pool

number_of_sells

integer

Total sell transactions on the pool

buy_volume_usd

string

Cumulative buy volume in USD

sell_volume_usd

string

Cumulative sell volume in USD

total_volume_usd

string

Total trading volume in USD

Note: Decimal values are returned as strings to preserve precision.


Example Usage

JavaScript:

Python:


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

Last updated