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

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.5.2
File Size Uploaded
pypsx-2.5.2.tar.gz 40.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pypsx 2.5.2
File
pypsx-2.5.2-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
pypsx-2.5.2-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
pypsx-2.5.2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
pypsx-2.5.2-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
pypsx-2.5.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
pypsx-2.5.2-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
pypsx-2.5.2-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
pypsx-2.5.2-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
pypsx-2.5.2-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
pypsx-2.5.2-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

Total release size: 152.1 MB

Release files / pypsx-2.5.2.tar.gz

Download URL pypsx-2.5.2.tar.gz
Size 40.3 kB
Tags Source
SHA-256 checksum
How to use checksums
11f8447256eb69a39acdf4dbd571d90f358ef2d769e3159c6527c5db5afee97e
BLAKE2b-256 checksum
How to use checksums
686bcc1884e42f68fc3d6ce7b50e73fd6f57a2080446feda10fbae1564fa9289
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.16

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

Download URL pypsx-2.5.2-cp314-cp314-win_amd64.whl
Size 3.9 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
02761ac9a8547fe957d9a069b266657c25aaac011f15adb3f89861934000dc3b
BLAKE2b-256 checksum
How to use checksums
0a75a74f7918a98e80ffcf57233aeda7af5d19595993030fca8047ae365e5374
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.16

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

Download URL pypsx-2.5.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 27.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
d36a7f2f2399bc6e7d83b529013343bb4031fcdab513d79cfe17e9dc01c4fed2
BLAKE2b-256 checksum
How to use checksums
57d8cc4347c24d3c19f9bb7882ed158ace485af740218c7f3dd1dc4066ed4b98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.16

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

Download URL pypsx-2.5.2-cp313-cp313-win_amd64.whl
Size 3.8 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
929d88225663b8458747fc08ada9b4ecf9ef638efed53f6ed14f59fb0a82bf11
BLAKE2b-256 checksum
How to use checksums
75432bcbb0746b547962d370899be810622dfa54098e7b4b4de8cee17ab35f46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.16

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

Download URL pypsx-2.5.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 27.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
d91ea6fc57e9afdce89610d7e94338bd9f0f985dcfd972ede01b5b96b7459db7
BLAKE2b-256 checksum
How to use checksums
5543e055d25fde989d28acee7c2007cce93e732bf221612ee90b4d78a08a1da1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.16

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

Download URL pypsx-2.5.2-cp312-cp312-win_amd64.whl
Size 3.8 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
dd785a390ee2bc970f70e9f712b2717fd8197755610058ee74c1d9427e9fcfc4
BLAKE2b-256 checksum
How to use checksums
97121d0d80fb8871131545f2c32f5b4ca80bb6b265884692485a23e77a9da456
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.16

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

Download URL pypsx-2.5.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 28.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
22a6d68964d6c142b942cdde8f5716bf0da5e34cc56b75d5b0f55c78dc9e833a
BLAKE2b-256 checksum
How to use checksums
b1a9afb22a02947f428c1dd566f84b63da6bb5820505eb052780539e712e8955
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.16

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

Download URL pypsx-2.5.2-cp311-cp311-win_amd64.whl
Size 3.9 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
9498204a5bb588758235511567e734899668181e7ff960248c2c8ab4c41f79fc
BLAKE2b-256 checksum
How to use checksums
3f3f51d4d926c69b00ae203331fff69236d8cc1bae7e499b45532922a94ffb6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.16

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

Download URL pypsx-2.5.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 25.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
39886378aa11deb8bb66ae681b3b179a1e235b15591593bef608701e7d778f27
BLAKE2b-256 checksum
How to use checksums
e5008551f780ae996724837859839f00ccfc64070f039f42434ad64fabbd1525
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.16

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

Download URL pypsx-2.5.2-cp310-cp310-win_amd64.whl
Size 3.9 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
c42b761230a3dbb789f77a997d32f95b6d0031fe9e0aea5ce5edb1484364caac
BLAKE2b-256 checksum
How to use checksums
266596da2b68505a3aa6dcdc2215218dae460988ef6da486d06e0295fa57c3f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.16

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

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

Release history Release notifications | RSS feed

2.6.3

11 release files

2.6.2

11 release files

2.6.1

11 release files

This release

2.5.2 This release

11 release files

2.4.1

10 release files

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