Skip to main content

How to use the free PSX data API with Python

psxdata is a free, open-source Python library that gives you programmatic access to Pakistan Stock Exchange (PSX) data — no API key, no subscription, no browser.

What data is available?

Install

How it works

psxdata scrapes the public PSX website (dps.psx.com.pk) using requests and BeautifulSoup. All endpoints are plain HTTP — no JavaScript rendering, no Selenium, no Playwright. Data is returned as pandas DataFrames. Results are cached locally at ~/.psxdata/cache/ in parquet format. Historical data never re-downloads. Today’s prices refresh every 15 minutes.

Example: portfolio snapshot

Next steps