https://psxdata-api.fastapicloud.dev
Step 1: Health check
Verify that the API is reachable and operational before making data requests.- Python
- JavaScript
status of "ok" means the API is healthy and accepting requests.
Step 2: Fetch historical prices
Retrieve daily OHLCV data for a symbol over a date range. ReplaceENGRO with any PSX ticker.
- Python
- JavaScript
meta.count is the total number of trading-day records returned. is_anomaly flags data points that may be suspect due to corporate actions or data-feed issues.
Step 3: List index constituents
Fetch the current list of symbols that make up the KSE-100 index.- Python
- JavaScript
data is a list of constituents. Each row contains symbol, idx_weight (percentage), market_cap_m (millions PKR), and optional freefloat_m or shares_m depending on the index.
Step 4: Handle a 404 error
The API returns structured errors for all 4xx and 5xx responses. Requesting a symbol that does not exist produces a404.
- Python
- JavaScript
error object with status (HTTP code), code (machine-readable string), and message (human-readable description). See Introduction for the full list of error codes.
Next steps
- Introduction — rate limits, error codes, and the response envelope in detail
- API reference — endpoint-by-endpoint reference for all available resources