Skip to main content
This guide shows how to build a price alert system — poll the NGN Market API on an interval, compare prices against user-defined thresholds, and fire a notification (webhook, email, or push) when a condition is met. Endpoint used:
  • GET /companies/:symbol (Starter plan) — single stock quote with current price

Alert types

You can model any of these conditions:

Step 1: Define your alerts

JavaScript
Python

Step 2: Fetch a quote

Sample quote response (trimmed)

Step 3: Evaluate alert conditions

Step 4: Send a notification

Replace notify() with whatever delivery mechanism you use — webhook, email, SMS, or push.

Step 5: Run the checker on an interval

Persistent alerts with a database

For a production system where alert state survives restarts, store alerts and their triggered status in a database:
JavaScript

Tips

Debounce noisy conditions. A stock can briefly cross a threshold and come back. Consider requiring the condition to hold for two consecutive checks before firing. Reset daily alerts at midnight WAT. change_above / change_below alerts are based on price_change_percent, which resets each session. Clear those triggered flags at the start of each trading day. Only check during trading hours. Prices don’t move outside NGX hours (Mon–Fri, 09:00–16:00 WAT), so skip checks then to save quota.
JavaScript

Company detail reference

All fields returned by GET /companies/:symbol

Live price ticker guide

How to keep prices updating automatically