Bishal Shrestha
Kathmandu, Nepal • Consulting
Production • stock.bishalstha.info.np

Nepal Stock Exchange Intelligence at the Serverless Edge for $0/Month.

A zero-maintenance NEPSE assistant — price alerts, portfolio tracking, market news and a technical screener — built entirely on Cloudflare’s free tier. It reads NEPSE’s token-authenticated endpoints (there is no public API), polls watched stocks every 5 minutes during market hours, and pushes alerts to Telegram.

$0.00 /mo

Infrastructure Cost

Cloudflare Workers free tier

5 min

Poll Interval

Watched stocks, during market hours

4 crons

Scheduled Jobs

Open, in-hours poll, close, end of day

Full market

Open & Close Snapshots

Every listed security at 11:00 and 15:00 NPT

Sample Session Snapshot

Live Screener Telemetry

Market Open: Mon–Fri 11:00 – 15:00 NPTAuto-sync: 5 min
SymbolLTP (NPR)Day ChangeRSI (14)SMA 20/50Signal TriggerTrend Sparkline
SHIVM
524.00+4.80%
64.20Neutral
SMA20 > SMA50MACD bullish
NICA
418.50+2.15%
28.40Oversold
SMA20 < SMA50Buy zone active
HDL
1,390.00+1.45%
54.80Neutral
SMA20 > SMA50MACD bearish
Quotes cached in D1 for 5 minutes — dashboard, bot and cron share one NEPSE fetch.
Quote TTL: 5 minAlert cooldown: 4 h
Architecture Breakdown

Operational Pipeline

Four scheduled jobs, one D1 database and a webhook bot — all running on the Cloudflare Workers free tier.

01 / INGESTION

Cron Trigger Ingestion

Cron Triggers run Mon–Fri during NEPSE hours (11:00–15:00 NPT): a full-market snapshot at open and close, and a watched-stocks poll every 5 minutes in between. NEPSE has no public API, so the Worker derives the token for its authenticated endpoints in pure TypeScript.

Schedule: */5 5-9 * * mon-fri (UTC)
02 / COMPUTE

In-Isolate Screener

SMA 20/50, Wilder’s RSI (14), MACD and ATR are computed inside the Worker over accumulated daily OHLC history — no external maths service. A statistical recommender turns trend, momentum and range position into buy/sell zones.

Runs at end of day · 15:15 NPT
03 / PERSISTENCE

D1 SQLite & Edge Cache

Daily OHLC bars, holdings, alert rules and live quotes live in Cloudflare D1. Quotes fresher than 5 minutes are served straight from D1; market summaries and charts sit in the free Cache API. Workers KV was dropped after its free-tier write cap ran out daily.

Quote TTL: 5 min
04 / DISPATCH

Non-Blocking Alerts

Price above/below, % move and volume-spike rules are checked on every poll and pushed to Telegram through a grammY webhook bot. Jobs run inside ctx.waitUntil(), and each rule has a 4-hour cooldown so it never repeats itself.

Cooldown: 4 h per rule
src/index.ts
Cloudflare Worker Runtime
async scheduled(event: ScheduledEvent, env: Env, ctx: ExecutionContext) {
  const job = (async () => {
    switch (event.cron) {
      case "15 5 * * mon-fri":   // 11:00 NPT open — new listings + full snapshot
        await runMarketOpen(env); break;
      case "*/5 5-9 * * mon-fri": // in hours — watched stocks every 5 min
        await pollWatched(env); break;
      case "15 9 * * mon-fri":   // 15:00 NPT close — full snapshot
        await fullSnapshot(env); break;
      case "30 9 * * mon-fri":   // EOD — OHLC history, screener, news digest
        await runEod(env); break;
    }
  })();
  ctx.waitUntil(job);
}

// pollWatched: market-window guard → D1 quote cache → evaluate rules
// price_above · price_below · pct_change · volume_spike (4 h cooldown)
Zero-Cost Engineering

Bypassing Traditional Infrastructure

Conventional financial screeners rely on dedicated VPS instances with persistent WebSocket servers, easily incurring $25–$80 per month. By taking advantage of Cloudflare’s distributed execution model, this engine operates inside zero cold-start environments with zero idle overhead.

Isolate Constraints Mastered

  • Free-tier quotas: Workers KV hit its 1k writes/day cap, so quotes moved to D1 and summaries to the Cache API, which isn’t metered.
  • Shared quote cache: Dashboard, bot and cron read the same D1 quotes; only stale symbols cost a NEPSE request.
  • Quiet alerts: A 4-hour cooldown per rule keeps Telegram messages rare and well inside Bot API limits.
Instant Notifications

Telegram Price Alerts

When one of your rules fires — a price crossing, a % move or a volume spike — the bot messages you within the same 5-minute poll. The bot is private: it’s locked to the owner’s Telegram account, and the web dashboard’s portfolio is gated by an access key.

Open Web DashboardPrivate bot · owner only
NEP
NEPSE Alert Bot
Bot • private
11:42 AM
SHIVMPRICE ABOVE

SHIVM rose above 520 — LTP 524.00

NICA% MOVE

NICA moved 4.10% (≥4%) — LTP 418.50

Cloudflare Worker → grammY4 h cooldown per rule