Skip to content

About

Dividend yields for Shariah-compliant KMI All Share (KMIALLSHR) stocks on the Pakistan Stock Exchange, refreshed daily from PSX. Next.js + Convex.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

KMIALLSHR Dividend Board

Dividend yields for the Shariah-compliant stocks in the KMI All Share Islamic index (KMIALLSHR) on the Pakistan Stock Exchange, refreshed daily from PSX.

Live: https://kmiallshr.vercel.app

KMIALLSHR Dividend Board

What it shows

  • Dividend board (/): every current KMIALLSHR constituent that paid a cash dividend, ranked by net yield for FY24, FY25 or FY26 (year to date). It shows payout frequency (Single, Biannual, Triannual, Quarterly), dividend per share, and the cash a given holding would have received. Investment size, withholding tax, zakat and face value are adjustable.
  • Stock pages (/stock/<SYMBOL>, e.g. /stock/MEBL): dividend history, frequency and yield by fiscal year for one company. These pages are server-rendered and listed in sitemap.xml.
  • Price hikes (/price-hikes): each stock's largest low-to-high price run within a calendar year, from stored price snapshots.

Data sources

All data comes from public pages on the PSX Data Portal:

Data Source
Constituents and latest price dps.psx.com.pk/indices/KMIALLSHR
New payout announcements, market-wide dps.psx.com.pk/payouts
Per-company payout history (period, detail, book closure) POST dps.psx.com.pk/company/payouts
Fiscal year end dps.psx.com.pk/company/<SYMBOL>

A Convex cron (convex/crons.ts) runs psxImport.run every day at 18:00 PKT. To stay well inside PSX's rate limits, the import is incremental. It reads the constituent list and the market-wide payout listing (about 10 requests), then re-reads the payout history only for stocks with announcements it hasn't stored yet. Every other stock just gets its price updated. If PSX throttles the run, it stops without touching the data and tries again two hours later. The header's "Last updated" time comes from the most recent successful import.

How yields are computed

PSX publishes cash dividends as a percentage of face value, for example 75%(ii) (D). Only (D) cash entries count; bonus (B) and rights (R) issues are ignored.

  1. Dividend per share = dividend % / 100 × face value. Face value defaults to Rs 10, the PSX norm; the dashboard lets you change it.
  2. Fiscal year: each payout is assigned using the period end in PSX's "Financial Results" column and the company's fiscal year end. For a June year-end company, a dividend for the period ending 31/12/2025 counts toward FY26.
  3. Gross yield = total dividend per share in the fiscal year / latest price.
  4. Net yield = gross yield × (1 − withholding tax − zakat). Withholding tax defaults to 15% and zakat to 0%. Both are free inputs, so you can enter your own rates (PSX does not tell the app whether you are a filer). Stock pages use the 15% default.

Yields compare past dividends with today's price, so they are trailing yields, not forecasts. FY26 is year to date until each company's fiscal year closes.

Stack

  • Next.js 16 (App Router) on Vercel
  • Convex for the database, queries, the import action and the cron
  • cheerio to parse PSX HTML

Local development

Requires Node 22.18 or newer.

npm install
npx convex dev            # creates/links a dev deployment and writes .env.local
npm run seed:dev          # load data/stocks.json into the dev deployment
npm run dev               # http://localhost:3000

To pull live data into your dev deployment instead of the bundled snapshot:

npx convex run psxImport:run                  # incremental refresh (what the cron runs)
npx convex run psxImport:run '{"full": true}' # re-read every constituent (slow)

Scripts

npm run data:fetch   # full scrape from your machine into data/stocks.json
npm run seed:dev     # import data/stocks.json into the Convex dev deployment
npm run seed:prod    # import data/stocks.json into the Convex prod deployment
npm run lint
npm run build

Deploying

The Convex functions and the Next.js app deploy separately:

npx convex deploy      # functions, schema and cron to the prod deployment
vercel deploy --prod   # frontend (needs NEXT_PUBLIC_CONVEX_URL set in Vercel)

Disclaimer

This is a personal project and not investment advice. Data is scraped from public PSX pages and may be incomplete, delayed or wrong. Tax treatment depends on your situation. Check with the company, PSX and a qualified adviser before making investment decisions. Not affiliated with the Pakistan Stock Exchange.

About

Dividend yields for Shariah-compliant KMI All Share (KMIALLSHR) stocks on the Pakistan Stock Exchange, refreshed daily from PSX. Next.js + Convex.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages