# Credit risk & IFRS 9 macro scenarios

IFRS 9 expected-credit-loss models need **forward-looking macroeconomic variables**, and a clean history to fit them on. PakDataHub gives Pakistani lenders, microfinance banks and auditors those variables from official sources, in one consistent format.

## Typical macro variable set

| Variable | Series | Frequency |
|---|---|---|
| Real GDP growth | `gdp.growth_rate_real_gross_domestic_product_4` | quarterly |
| Inflation | `inflation.cpi.national.yoy` | monthly |
| Policy rate | `rates.policy_target` | on change |
| Lending benchmark | `banking.six_months_karachi_interbank_offer` | daily (2005 ->) |
| Exchange rate | `fx.rate.avg.usd` (use `transform=yoy` for depreciation) | monthly |
| Industrial activity | `industry.lsm.qim` | monthly |
| Remittances (household income proxy) | `remittances.total` | monthly |
| Sector NPL history | `banking.npl.*`, `sme.npl_ratio` | quarterly |

## Build a quarterly model frame

```python
import pandas as pd
KEY = "pk_live_xxx"
def s(sid, **p):
    q = "&".join(f"{k}={v}" for k, v in {"format": "csv", "sort": "asc", "limit": 10000, **p}.items())
    x = pd.read_csv(f"https://api.pakdatahub.com/v1/series/{sid}?{q}&api_key={KEY}", parse_dates=["date"])
    return x.set_index("date")["value"].rename(sid)

frame = pd.concat([
    s("inflation.cpi.national.yoy"),
    s("fx.rate.avg.usd", transform="yoy"),
    s("banking.six_months_karachi_interbank_offer"),
    s("industry.lsm.qim", transform="yoy"),
], axis=1).resample("QE").mean()
```

## Audit trail

- **Sourcing:** every series carries its official source (`meta.source`, `source_url` in the [catalog](https://pakdatahub.com/docs/api-catalog.md)), so auditors can trace each input.
- **Vintages:** with [revision vintages](https://pakdatahub.com/docs/api-vintages.md) (Pro) you can rebuild the exact dataset used at a past reporting date, even after SBP or PBS revise the numbers.
- **Stable ids:** series ids don't change, so model code keeps working between reporting cycles.

See also [Banks, treasury & ALM](https://pakdatahub.com/docs/use-case-banks-treasury.md) and [For macro researchers](https://pakdatahub.com/docs/for-macro-researchers.md).

---
Source: https://pakdatahub.com/docs/use-case-credit-risk-ifrs9 - PakDataHub docs index: https://pakdatahub.com/docs/llms.txt
