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

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.6.1
File Size Uploaded
pypsx-2.6.1.tar.gz 40.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pypsx 2.6.1
File
pypsx-2.6.1-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
pypsx-2.6.1-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.6.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
pypsx-2.6.1-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.6.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
pypsx-2.6.1-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.6.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
pypsx-2.6.1-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.28+ x86-64, Linux glibc 2.17+ x86-64 Details
pypsx-2.6.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
pypsx-2.6.1-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: 156.9 MB

Release files / pypsx-2.6.1.tar.gz

Download URL pypsx-2.6.1.tar.gz
Size 40.2 kB
Tags Source
SHA-256 checksum
How to use checksums
97e0459c34341da5c667f03cc0f975b3b4b6652f2866630963213df4df991547
BLAKE2b-256 checksum
How to use checksums
32bb191b7a1900451dc38496cc50c5a99b8619c20839af855414eaf9f3505ec7
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.1-cp314-cp314-win_amd64.whl

Download URL pypsx-2.6.1-cp314-cp314-win_amd64.whl
Size 4.0 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
236aa892f18e405e02908a3980cb10f8e59327de76919dbdca63e2fd78e8f11a
BLAKE2b-256 checksum
How to use checksums
f437f2da3f5eecb00ad363adf21dacca3a9dd2b038e2056af87c14354ec3db5e
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.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pypsx-2.6.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 28.4 MB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8a05202513283553c51ec49244960f0290cfd5bc8aee4026bc4d65cd4474e7e6
BLAKE2b-256 checksum
How to use checksums
e825755fc3a18b91f674930856f1e6dc6fb5fe9710cf10ece8b9d54b1a4798f8
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.1-cp313-cp313-win_amd64.whl

Download URL pypsx-2.6.1-cp313-cp313-win_amd64.whl
Size 3.9 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
0f9fc897d84800554411c1f303b79ff21e6ac9824e4c6c7b0a536e9cf86956e6
BLAKE2b-256 checksum
How to use checksums
02db15355bca59c13401052a6fcdcd0a187300d25e10b576d9943bef59c72882
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.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pypsx-2.6.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 28.8 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
34994d3ffe67315e6a1c7e65e019027f3b0f5387bcf9819f8c981272dceffc43
BLAKE2b-256 checksum
How to use checksums
215e3aafa166ec5502c9d0c471d6609108dd09859646312c818d360e1c2f8e29
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.1-cp312-cp312-win_amd64.whl

Download URL pypsx-2.6.1-cp312-cp312-win_amd64.whl
Size 3.9 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
0be945649db5ac2f169eeb148400e8b2fd0063bcd35fd923530d88be734ef73f
BLAKE2b-256 checksum
How to use checksums
f0c228ab21d3fe8f8b143016afbd07b373e5c5b8933adbceb7521be88fa63cb8
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.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pypsx-2.6.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 28.9 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ea991d403437c7e885fa0c9d1de613bb233381a98b382546b35301c18aefafba
BLAKE2b-256 checksum
How to use checksums
dc9d6a19a50501257c87943aa4ef9db248f3d6ad672c1509320c33b98d8d2d27
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.1-cp311-cp311-win_amd64.whl

Download URL pypsx-2.6.1-cp311-cp311-win_amd64.whl
Size 4.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
acd265fff77bda71d1461671969944f683a84144aab81bcdb4588edfedff9be3
BLAKE2b-256 checksum
How to use checksums
fa2380b5c744646627e230299c7788409e42df47d56c8d8e2f9ffaa297f20e3a
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.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pypsx-2.6.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 25.9 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
d66455f9eb3411d9735627e4a0a9d3b4a3b464f28ae7c2371183cf1fdf6d8fd0
BLAKE2b-256 checksum
How to use checksums
107cf046cd15385b41df8ecd284d3710cec42ffc774666ef9be39aff74a73329
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.1-cp310-cp310-win_amd64.whl

Download URL pypsx-2.6.1-cp310-cp310-win_amd64.whl
Size 4.0 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
7ff8124d73d36714ac72634a3a60a3f04f2c0637c6b6c161c5e78ddd915bfa99
BLAKE2b-256 checksum
How to use checksums
1f67c2e918d37442ea8e368ef4e24c3cf067ec776e2df9cd111349255d540373
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.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

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

Release history Release notifications | RSS feed

2.6.3

11 release files

2.6.2

11 release files

This release

2.6.1 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