Downloads & Methodology
Data files, source code, and documentation on how everything was computed · Jan 2010 – May 2026
PSX Analyzer is a quantitative analysis tool for the Pakistan Stock Exchange. It computes standard financial metrics and presents them in an interactive web interface backed by a static historical dataset.
Support ended in June 2026. Automated delayed PSX data updates have been discontinued. PSX does not permit delayed data usage in this context (including non-commercial and educational use). We believe this restriction should apply to live licensed feeds only, but we are complying with the current policy. The site remains available with a static, historical dataset and no automatic data refresh.
| What | Status |
|---|---|
| Automated pipeline | Disabled (June 2026) |
| Scheduled refresh jobs | Disabled |
| Data mode | Static historical dataset |
| Site availability | Online for research and archival analysis |
| Data | Primary Source | Fallback |
|---|---|---|
| Company listings & sectors | PSX Data Portal (dps.psx.com.pk) | Internal PSX API Fetcher |
| Daily close & volume | PSX /timeseries/eod/{SYMBOL} | — |
| KSE-100 Index | PSX /timeseries/eod/KSE100 (2021–present) | Yahoo Finance ^KSE (2010–2021) |
| USD/PKR exchange rate | Yahoo Finance (USDPKR=X) | Bundled CSV |
| CPI / Inflation | World Bank API | FRED → Bundled CSV |
| SBP Policy Rate | FRED API | Bundled CSV |
| Fundamentals (P/E, EPS, etc.) | PSX Data Portal company pages | — |
| Metric | Definition |
|---|---|
| Total Return | (Last Close − First Close) / First Close |
| CAGR | Compound Annual Growth Rate: (Last/First)^(1/years) − 1 |
| Volatility | Std. deviation of daily log returns, annualized (× √245 trading days) |
| Max Drawdown | Largest peak-to-trough decline over the full history |
| Sharpe Ratio | (CAGR − risk-free rate) / Volatility. Risk-free rate = avg SBP policy rate |
| Beta | Cov(stock, KSE-100) / Var(KSE-100), computed from daily log returns |
| Correlation | Pearson correlation of daily log returns vs KSE-100 |
| Real CAGR | CAGR minus average annual CPI inflation |
| Volume Trend | 30-day avg volume / 90-day avg volume (above 1 = rising) |
- – Price data comes from the PSX public data portal. It may contain gaps, errors, or delays. Corporate actions (splits, bonuses) might not be adjusted where data was not properly reflected in source files.
- – This is a research and analytical tool, not financial advice. All code is open and available for download below. Verify any result independently before relying on it.
- – Macro data (CPI, policy-rate proxies) has fallback support through bundled CSVs where applicable.
- – This project was built in it's entirety using Windsurf.
master.csv
169.0 KB — 606 companies, 26 columns of summary metrics
sectors.csv
3.9 KB — 37 sectors with aggregate statistics
macro_kse100.csv
85.9 KB — KSE-100 daily close (2010–2026)
macro_usdpkr.csv
191.3 KB — USD/PKR daily rate (2010–2026)
macro_cpi.csv
0.3 KB — Annual CPI inflation (World Bank)
macro_tbill.csv
0.3 KB — SBP policy rate history
The full pipeline and application code. Read these to understand exactly how every number was computed.
config.py
3.5 KB — Configuration, paths, API endpoints, constants
fetcher.py
22.3 KB — Stock data fetching from PSX Data Portal
macro.py
11.7 KB — Macro data: KSE-100, USD/PKR, CPI, T-bill
metrics.py
8.8 KB — Per-stock metric computation (CAGR, Sharpe, beta, etc.)
sectors.py
5.3 KB — Sector-level aggregation
fundamentals.py
5.8 KB — Fundamentals scraping (P/E, EPS, dividend yield)
export.py
3.7 KB — CSV export logic
run_pipeline.py
6.4 KB — Pipeline orchestrator
app.py
36.8 KB — Flask application, routes, chart generation
freeze.py
9.5 KB — Static site generator for Netlify deployment
run.py
4.0 KB — Main entry point (CLI)