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:
| Field | Description |
|---|---|
| Token pair | The token pair to monitor |
| Condition | Price above or below a target threshold |
| Target price | The 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:
| Action | Description |
|---|---|
| Create | Set up a new price alert with the desired condition |
| Pause | Temporarily suspend an alert without deleting it |
| Resume | Reactivate a paused alert |
| Dismiss | Mark a triggered notification as read |
| Delete | Permanently 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:
- Fetch all active (non-paused) alerts from the database.
- For each alert, query the relevant liquidity pool's on-chain reserves to compute the current price.
- Evaluate the alert condition (above or below the target threshold).
- If the condition is met, mark the alert as triggered and create a notification record.
- Triggered alerts are not automatically deleted -- they remain available for the user to review and dismiss.