Skip to main content

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.

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.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypsx 2.7.0
File Size Uploaded Provenance Actions
pypsx-2.7.0.tar.gz 41.1 kB Without provenance Details for pypsx-2.7.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pypsx 2.7.0
File Actions
pypsx-2.7.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for pypsx-2.7.0-cp314-cp314-win_amd64.whl
pypsx-2.7.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pypsx-2.7.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pypsx-2.7.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for pypsx-2.7.0-cp313-cp313-win_amd64.whl
pypsx-2.7.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pypsx-2.7.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pypsx-2.7.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for pypsx-2.7.0-cp312-cp312-win_amd64.whl
pypsx-2.7.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pypsx-2.7.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pypsx-2.7.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for pypsx-2.7.0-cp311-cp311-win_amd64.whl
pypsx-2.7.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pypsx-2.7.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pypsx-2.7.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for pypsx-2.7.0-cp310-cp310-win_amd64.whl
pypsx-2.7.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pypsx-2.7.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Total release size: 164.1 MB

Release files / pypsx-2.7.0.tar.gz

Download URL pypsx-2.7.0.tar.gz
Size 41.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dcaf0c62e3ed8be88537ef5d15d10b83c1172276b9ca064141802351cf340528
BLAKE2b-256 checksum
How to use checksums
1027e18a362561fa1a333447193895cfd3b67c63551331d0a6388b8049dda291
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / pypsx-2.7.0-cp314-cp314-win_amd64.whl

Download URL pypsx-2.7.0-cp314-cp314-win_amd64.whl
Size 4.2 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
0679850a3272ca27ab9a0867c8c197bf924557740091b7f3ccefdaf65e113924
BLAKE2b-256 checksum
How to use checksums
fb95eeb7c4783db0216df91c1c8b14ed9cc057420038fcbf998809f4d9a03369
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / pypsx-2.7.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pypsx-2.7.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 29.7 MB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2cb3e08859e56f2de0095b79e86ee34cd2534eb9858a429190dca4b0548a488e
BLAKE2b-256 checksum
How to use checksums
80a43b5c33747ad2b40099d60f8c4e87ad19d3cc8f5f3ab455a6715aebcb2aef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / pypsx-2.7.0-cp313-cp313-win_amd64.whl

Download URL pypsx-2.7.0-cp313-cp313-win_amd64.whl
Size 4.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
10869ef2fc1690e792f5a6d694bf52763dddeeb6e4461c8afc0f18e19705fc5b
BLAKE2b-256 checksum
How to use checksums
cdcad83fa713557ed448a14ec69ca477254e9bfe5b43a84410e022b3aa41fe22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / pypsx-2.7.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pypsx-2.7.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 30.1 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8b2d25a50f490e1956a2312d001d6f913415d01d812b0abcffbc9afbd84f45d1
BLAKE2b-256 checksum
How to use checksums
dc543f3516bfa1ba859a3304b07c9592b3c8f6925d363c8774e8a3ea995f40f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / pypsx-2.7.0-cp312-cp312-win_amd64.whl

Download URL pypsx-2.7.0-cp312-cp312-win_amd64.whl
Size 4.1 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
75f8cdcc86145584386cbed4025bcf42c314db9884b591d97d0ba43dae143ea4
BLAKE2b-256 checksum
How to use checksums
e1c5bbf39f9db3a389d1ca5ae8663601fc4f51f276d8d5570b2dc0314ac0573c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / pypsx-2.7.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pypsx-2.7.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 30.2 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
3fd60846585885aa6c0f7d953e3741edaf060d11e8b65e8341e2db1d708925a7
BLAKE2b-256 checksum
How to use checksums
2b98787896dc0f16c55533f21a82012b973aa92a849077775ae1eaae4d69549b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / pypsx-2.7.0-cp311-cp311-win_amd64.whl

Download URL pypsx-2.7.0-cp311-cp311-win_amd64.whl
Size 4.2 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
398a88d4acb5b5af73bb7091282d2ee511225c84593e21318abf557b922cea89
BLAKE2b-256 checksum
How to use checksums
e161806a9cc87d7a1cc0ca28b86ebe6e8d13f45dc4d5bc43ec2cc6cd57db912f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / pypsx-2.7.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pypsx-2.7.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 27.1 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
313121a8b331fbfc8bcbe1bc3f05187440a144347cb749a8011f12e17d071b1d
BLAKE2b-256 checksum
How to use checksums
4012d04502660f6192cfae061aacaa15647f65f8d877a3c380f97452cc5ec731
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / pypsx-2.7.0-cp310-cp310-win_amd64.whl

Download URL pypsx-2.7.0-cp310-cp310-win_amd64.whl
Size 4.2 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
747b07faad968eefdff800e3cbd086bb4b9690455b9b2bbc3f4577830bfa966a
BLAKE2b-256 checksum
How to use checksums
18f0fd6354a93b923fdb4ccc5aa5327c231ff47cc2d5641eb1724b277d668233
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.18

Release files / pypsx-2.7.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pypsx-2.7.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 26.2 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f31b9e6bb6582a52bdcae01721174b5e97ca3373693a90e4be8d3dd50da750ce
BLAKE2b-256 checksum
How to use checksums
59625f8e8d621b122ac75d4e337de834de3799a2dd2a666d884ebb872cea81d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.18

Security for pypsx 2.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page