> ## Documentation Index
> Fetch the complete documentation index at: https://docs.psxdata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# psxdata — free PSX data for Python

> Free open-source Python library for Pakistan Stock Exchange (PSX) data — KSE-100 historical prices, live trading board, sectors, indices, stock screener.

# psxdata — free KSE-100 & PSX historical data for Python

Open-source Python library to download free PSX stock data — historical prices, live trading board, KSE-100 indices, sector summaries, and more.

```bash theme={null}
pip install psxdata
```

```python theme={null}
import psxdata

# Download ENGRO historical prices
df = psxdata.stocks("ENGRO", start="2025-01-01", end="2025-12-31")
print(df.head())
#        date    open    high     low   close   volume
# 0  2025-01-02  ...     ...     ...    ...      ...
```

## Features

| Feature | Description |
| - | - |
| **Historical data** | OHLCV prices for any PSX-listed stock, all history in one call |
| **Live snapshots** | Point-in-time trading board data via screener |
| **KSE-100 & indices** | All 18 PSX indices with constituent weights |
| **Sector summary** | 37 sector breakdowns with advance/decline counts |
| **Stock screener** | Filter all \~1,000 listed symbols |
| **Disk cache** | Parquet-backed local cache — no repeated downloads |

## Why psxdata?

* **Free.** No API key. No rate-limit paywall. Scrapes the public PSX website directly.
* **pandas-native.** Every function returns a `DataFrame` ready for analysis.
* **No browser required.** Pure `requests` + `BeautifulSoup` — fast and dependency-light.
* **Cached.** Historical data never re-downloads. Today's data refreshes every 15 minutes.

## Install

Requires Python 3.11+.

```bash theme={null}
pip install psxdata
```

## Quick example

```python theme={null}
import psxdata

# Historical prices
df = psxdata.stocks("LUCK", start="2024-01-01")

# All KSE-100 tickers
kse100 = psxdata.tickers(index="KSE100")

# Sector summary
sectors = psxdata.sectors()

# All symbols with sector names
symbols = psxdata.symbols()

# Index constituents
kse_df = psxdata.indices("KSE100")
```

Continue to [Getting started](https://docs.psxdata.org/sdk/getting-started.md) for a full walkthrough.

Working with an AI assistant instead? The [psxdata MCP server](https://docs.psxdata.org/mcp/introduction.md) lets Claude, Cursor, VS Code and other MCP clients load PSX data and analyse it with SQL.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.