Metadata-Version: 2.4
Name: pypsx
Version: 2.5.2
Summary: Pakistan Stock Exchange (PSX) Trading SDK for Paper Trading and Backtesting
Author: PyPSX Team
License: Proprietary
Project-URL: Homepage, https://pypsx.com
Keywords: trading,stock,psx,pakistan,simulation,backtesting,algorithmic-trading
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Office/Business :: Financial :: Investment
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pydantic>=2.0.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: sqlalchemy>=2.0.0
Requires-Dist: pandas<3.0.0,>=1.5.0
Requires-Dist: numpy<2.4.0,>=1.24.0
Requires-Dist: ta>=0.11.0
Requires-Dist: tzdata>=2024.1
Requires-Dist: fastapi>=0.110.0
Requires-Dist: uvicorn>=0.23.0
Requires-Dist: psycopg2-binary>=2.9.0
Requires-Dist: websockets>=12.0
Requires-Dist: python-dateutil>=2.8.0
Requires-Dist: requests>=2.31.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Provides-Extra: jupyter
Requires-Dist: nest-asyncio>=1.5.0; extra == "jupyter"

﻿# pypsx

**Programmatic, API-first access to the Pakistan Stock Exchange (PSX). The official Python SDK for [pyPSX](https://pypsx.com).**

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`](https://pypi.org/project/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

```bash
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:

```python
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.
