Screen PSX Stocks with Python
psxdata gives you two screening tools: tickers() to list symbols by index, and quote() to get current price and sector data for any symbol.
List all KSE-100 tickers
import psxdata
kse100 = psxdata.tickers(index="KSE100")
print(f"KSE-100 has {len(kse100)} stocks")
print(kse100[:10])
List all PSX symbols
Get a live quote
Screen all KSE-100 stocks for a metric
import psxdata
import pandas as pd
# Fetch quotes for all KSE-100 stocks
tickers = psxdata.tickers(index="KSE100")
rows = []
for t in tickers:
q = psxdata.quote(t)
if not q.empty:
rows.append(q.iloc[0])
screen = pd.DataFrame(rows).reset_index(drop=True)
print(screen.columns.tolist())
print(screen.head())
Note
Screener data refreshes every 15 minutes. psxdata caches the full screener
and serves all subsequent quote() calls from that cache — so screening
all 100 stocks costs only one network request.
See also
tickers()— parameter referencequote()— parameter reference- Historical Data guide — download prices for screened stocks