Skip to main content

Price Alerts

QsnDEX includes a real-time price alert system that monitors token prices and notifies users when their specified conditions are met.

Architecture

Price alerts are managed by a backend service that continuously monitors on-chain token prices.

  • Check interval: Every 30 seconds, the service queries live prices derived from on-chain liquidity pool reserves.
  • Storage: Alert configurations and state are persisted in PostgreSQL.
  • Price source: Prices are calculated from actual on-chain reserves, ensuring accuracy relative to the DEX's own trading prices.

Creating an Alert

To create a price alert, the user specifies:

FieldDescription
Token pairThe token pair to monitor
ConditionPrice above or below a target threshold
Target priceThe price level that triggers the alert
Notes (optional)A free-text note for personal reference

Notifications

When an alert condition is met, the user is notified through the interface:

  • A bell icon in the site header displays a badge with the count of unread notifications.
  • Clicking the bell opens a dropdown list showing all triggered alerts with their details.

Alert Management

Users can manage their alerts through the following actions:

ActionDescription
CreateSet up a new price alert with the desired condition
PauseTemporarily suspend an alert without deleting it
ResumeReactivate a paused alert
DismissMark a triggered notification as read
DeletePermanently remove an alert

Limits

  • Maximum of 20 active alerts per wallet per chain.
  • This limit applies to active and paused alerts combined. Dismissed and deleted alerts do not count toward the limit.

How Price Checking Works

The backend service follows this process on each 30-second cycle:

  1. Fetch all active (non-paused) alerts from the database.
  2. For each alert, query the relevant liquidity pool's on-chain reserves to compute the current price.
  3. Evaluate the alert condition (above or below the target threshold).
  4. If the condition is met, mark the alert as triggered and create a notification record.
  5. Triggered alerts are not automatically deleted -- they remain available for the user to review and dismiss.