PSX API Documentation
This API provides access to Pakistan Stock Exchange (PSX) data including stock histories and index data.
Base URL: https://psx-data.boltflare.com
Endpoints
1. Stock History
GET
Description: Get historical data for a specific stock symbol.
URL:
/psx/v2/stock_history/{SYMBOL}
Parameters:
SYMBOL: The stock symbol (e.g., KEL, HBL, etc.)
page (optional): Page number for pagination (default: 1)
limit (optional): Number of records per page (default: no limit, max: 10000)
Example:
https://psx-data.boltflare.com/psx/v2/stock_history/KEL?page=1&limit=100
Response Format (JSON):
{
"symbol": "KEL",
"total_entries": 1234,
"entry": [
{
"date": "2023-12-01",
"close": 123.45,
"low": 120.00,
"high": 125.00,
"volume": 100000
},
...
]
}
2. Index Data
GET
Description: Get historical data for a specific index symbol.
URL:
/psx/v1/index/{SYMBOL}
Parameters:
SYMBOL: The index symbol (e.g., KMI30, KSE100, etc.)
page (optional): Page number for pagination (default: 1)
limit (optional): Number of records per page (default: no limit, max: 10000)
Example:
https://psx-data.boltflare.com/psx/v1/index/KMI30?page=1&limit=50
Response Format (JSON):
{
"symbol": "KMI30",
"total_entries": 567,
"entry": [
{
"date": "2023-12-01",
"close_value": 45678.90,
"volume": 5000000
},
...
]
}
Error Responses
- 400 Bad Request: When symbol is not provided
- 404 Not Found: When endpoint doesn't exist
- 500 Internal Server Error: Database or server issues
Notes
- All responses are in pretty-printed JSON format
- CORS is enabled for cross-origin requests
- Data is ordered by date descending (newest first)
- Dates are in YYYY-MM-DD format
- Numeric values are properly typed (floats for prices, integers for volumes)