pypsx
Programmatic, API-first access to the Pakistan Stock Exchange (PSX). The official Python SDK for pyPSX.
pyPSX is the trading platform for PSX, and it is API-first: everything is available programmatically over a REST and WebSocket API, through this Python SDK, and in a point-and-click web terminal. This is not just a library. The platform gives you free market data, backtesting on 10+ years of history, a paper-trading sandbox, live real-money trading, a live market feed, and an AI Strategy Copilot. This package is the authenticated Python SDK that ties into all of it.
- Website and product: https://pypsx.com
- Web terminal and dashboard: https://markets.pypsx.com
- Documentation: https://docs.pypsx.com
- Free data library:
pypsx-toolkit - X: https://x.com/pyPSXofficial · LinkedIn: https://www.linkedin.com/company/pypsx/ · Reddit: https://www.reddit.com/r/pypsx/
What this package does
pypsx is the authenticated Trading SDK. With one free API key it gives you:
- Historical and intraday PSX market data.
- Backtesting on 10+ years of history, with realistic commission and slippage.
- A free paper-trading sandbox with a real fill engine and FIFO lot accounting.
- Live real-money trading on your own account after standard KYC onboarding.
- A live market feed over WebSocket.
- Strategy Copilot configs that turn plain English into a runnable bot.
The same capabilities are available over REST and WebSocket, and inside the pyPSX web terminal, so you can work in code or point-and-click, whichever fits.
Install
pip install pypsx # add [jupyter] for Colab and notebooks
Get a free key from the dashboard at https://markets.pypsx.com (keys start with PK_), then:
import pypsx
df = pypsx.download("OGDC", period="10y") # 10 years of daily bars
result = pypsx.backtest("rsi_momentum", ["OGDC"], start="2016-01-01", end="2026-01-01")
client = pypsx.TradingClient.from_env(paper=True) # free paper sandbox
client.place_order(symbol="OGDC", side="BUY", quantity=100, order_type="MARKET")
About pyPSX
pyPSX is the developer platform and company for the Pakistan Stock Exchange. It is distinct from the PSX exchange itself. Building investing into your own product? See the Broker API at https://pypsx.com/broker.
Proprietary license. Full documentation at https://docs.pypsx.com.
Metadata
Release files for pypsx 2.6.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pypsx-2.6.3.tar.gz | 40.3 kB | Details |
Built distributions (wheels)
Total release size: 157.5 MB
Release files / pypsx-2.6.3.tar.gz
| Download URL | pypsx-2.6.3.tar.gz |
|---|---|
| Size | 40.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23c075d85a73ae413995094ce354dafee990e25b43a52779a2a60d0690269135
|
|
BLAKE2b-256 checksum How to use checksums |
81478bf22652f8e16f366333abbdfd7d145b19eb24f1c1dfef1be995faebb3a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / pypsx-2.6.3-cp314-cp314-win_amd64.whl
| Download URL | pypsx-2.6.3-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
10e466e7e02c2152c139f5e8bb4a98dd1a525e94e5d55708531ac4987a4d0936
|
|
BLAKE2b-256 checksum How to use checksums |
ac854ecd69eb81c455fc81c5e022305a9d5771a9c8110e2d978f7a5c6ef55552
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / pypsx-2.6.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pypsx-2.6.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 28.5 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2e7de3a8dedafa3af7e9b75e66d5f08fd1654a4884cac1a807baf989ea2608a6
|
|
BLAKE2b-256 checksum How to use checksums |
cbd1b30d19998f03487c7dd19810eff3006a11712a7d36b1bd8b91b9ca9fa3b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / pypsx-2.6.3-cp313-cp313-win_amd64.whl
| Download URL | pypsx-2.6.3-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 3.9 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
cec8e45c6394be3a4d49f4aadb2ba10a39cc6475ac52b08be1a1030334dca0a0
|
|
BLAKE2b-256 checksum How to use checksums |
231286ae8642211e167b1a36f2efd962c23345e02d7e2e803c36cec4cb52dbca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / pypsx-2.6.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pypsx-2.6.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 28.9 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
683eece0ba957c6388f6d06ed2af5185e0f7ddd18d790e1b0a64d310a2fd9143
|
|
BLAKE2b-256 checksum How to use checksums |
d23f25b798d959d358d34e96498abc5b8a33401323309c3f20486cd947b25a11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / pypsx-2.6.3-cp312-cp312-win_amd64.whl
| Download URL | pypsx-2.6.3-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0195aa359aa98d233251370a8007ec2348b95e4178a18af0e9fd61a27f6931fd
|
|
BLAKE2b-256 checksum How to use checksums |
46fd66c1942474710432feccc5eab0703d0e873702127ea79de61772eac32cb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / pypsx-2.6.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pypsx-2.6.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 29.0 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a72b637357266a06a60129110f2b381eb0a8ffd79e731efec6f25170e9fad797
|
|
BLAKE2b-256 checksum How to use checksums |
9bfb457b26737becebeff03ef259edf26250bed6666bb095d6d74638cf1eb7c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / pypsx-2.6.3-cp311-cp311-win_amd64.whl
| Download URL | pypsx-2.6.3-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1da4394348a0236c4ba05b4fa7f88f8000c691f9d76f82d94cdcc360c7a12d6a
|
|
BLAKE2b-256 checksum How to use checksums |
ed64fd4cb60355910e4f25df3e9489bfae8a7fedd4adcc714f215be6ae0afb89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / pypsx-2.6.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pypsx-2.6.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 26.0 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
6dcd6469289da3fc8b72c7a5e6d3cca54ec09c10dec65fcd2c02e3985e03d358
|
|
BLAKE2b-256 checksum How to use checksums |
7ddb09dd6d4e20aafcd5dbd2f244eddb3be098be254fb7737884311ad2c3eb72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / pypsx-2.6.3-cp310-cp310-win_amd64.whl
| Download URL | pypsx-2.6.3-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 4.1 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
af4d98d082f2c1f4ab867f166ab1b985c3869aad36edae411e315356d08e9a12
|
|
BLAKE2b-256 checksum How to use checksums |
1266cd0993e23e5ed206b3ed6cfe8cb6f1fbd7c05234cebbd3d2d201ae520111
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / pypsx-2.6.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pypsx-2.6.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 25.1 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
fe3e826a63ea33e5e12346c20ecd992b743fd2b219142057daef1b61b9bad0da
|
|
BLAKE2b-256 checksum How to use checksums |
4352e8e0e3c5fadca9d2b81cc3fd34543eeddfecb5b8dd0a69a6867df115c053
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|