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

# Getting started

> Install psxdata and fetch your first PSX stock data in under 5 minutes.

# Getting started

## Installation

Requires Python 3.11+.

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

To install inside a virtual environment (recommended):

```bash theme={null}
python -m venv .venv
source .venv/bin/activate   # Linux/macOS
.venv\Scripts\activate      # Windows
pip install psxdata
```

## Your first script

Fetch five years of ENGRO historical prices:

```python theme={null}
import psxdata

df = psxdata.stocks("ENGRO", start="2021-01-01", end="2025-12-31")
print(df.shape)       # (rows, 7)
print(df.dtypes)
print(df.head())
```

Expected output:

```text theme={null}
(1234, 7)
date         datetime64[ns]
open                float64
high                float64
low                 float64
close               float64
volume                int64
is_anomaly             bool
dtype: object

        date    open    high     low   close    volume  is_anomaly
0 2021-01-04  286.90  293.50  285.00  291.00   1200000       False
...
```

## Caching

psxdata caches all data to `~/.psxdata/cache/` using parquet format. Historical data (before today) never expires. Today's rows refresh every 15 minutes.

To bypass the cache:

```python theme={null}
df = psxdata.stocks("ENGRO", cache=False)
```

## Next steps

* [Historical stock prices guide](/sdk/guides/historical-data) — full walkthrough with pandas analysis
* [Stock screener guide](/sdk/guides/stock-screener) — filter all listed stocks
* [API reference](/sdk/reference/client) — complete function signatures and parameters
