Skip to main content

Realtime market feed dashboard for L1/L2 PSX data using curses.

Project description

psx-terminal

A fast, data‑dense terminal dashboard for Pakistan Stock Exchange market feeds. This is a read‑only trading terminal focusing on realtime data visibility (L1, MBP, MBO), designed to be highly accessible right from your command line.

Highlights

  • Realtime L1 + L2: Watchlist, market depth (MBP/MBO), and movers.
  • Curses UI: Clean, high‑contrast layout designed for long sessions.
  • Keyboard‑first navigation: Tabs and symbol selection optimized for speed.
  • Resilient networking: Auto‑reconnect and safe parsing for noisy feeds.

Installation

You can install psx-terminal securely and easily using pip:

pip install psx-terminal

To update psx-terminal to the latest version, run:

pip install --upgrade psx-terminal

Quickstart

Once installed, simply type psx-terminal in your terminal to launch the interface:

psx-terminal

CLI Usage (Advanced)

psx-terminal -s HUBC,EFERT -f 4

Flags

  • -s, --symbols Comma‑separated symbols (default: loaded from your saved watchlist or EFERT if none).
  • -f, --feeds Feed mode: 1=L1, 2=MBP, 3=MBO, 4=All

Controls

  • 1, 2, 3, 4, 5 Switch main tabs
  • Left/Right Cycle main tabs
  • Up/Down Change focused symbol
  • / Add a symbol to watchlist (persisted safely to ~/.psx_terminal/)
  • X Remove selected symbol
  • Q Quit
  • In Analytics (4): Press A-D or use </> to cycle subtabs.

Programmatic Usage

For headless environments or custom integrations, you can use the library programmatically:

Using Installed Package

from psx_terminal.feed_parser import fetch_quotes, fetch_trades

# Get L1 quotes for EFERT
quotes = fetch_quotes("EFERT")
for quote in quotes[-5:]:  # Last 5 quotes
    print(f"{quote.time} bid={quote.bid} ask={quote.ask}")

# Get trade data for EFERT
trades = fetch_trades("EFERT")
for trade in trades[-5:]:  # Last 5 trades
    print(f"{trade.time} price={trade.price} vol={trade.volume}")

Example Scripts

Two example scripts are provided to demonstrate usage:

  • fetch_market_data.py - Uses local source code (for development)
  • market_data_client.py - Uses installed psx-terminal package

Both scripts provide the same functionality:

# Full market snapshot
python fetch_market_data.py EFERT

# Search for symbols
python fetch_market_data.py --search ABAN

# Get only quotes or trades
python fetch_market_data.py EFERT --quotes
python fetch_market_data.py EFERT --trades

# Limit results
python fetch_market_data.py EFERT --limit 10

Note: market_data_client.py requires pip install psx-terminal first.

Data Panels

  • Watchlist (L1): Last, change, bid/ask, volume, high/low
  • Market Depth (L2): MBP or MBO with best bid/ask + spread
  • Movers & Alerts: Market movers and circuit breaker notices
  • Analytics: Session summary, price ladder, trade flow, and intraday.

Design Goals

  • Data density without sacrificing scan‑ability
  • Clear bid/ask contrast and change emphasis
  • Safe behavior on small terminals with graceful resizing

Recent Updates

v0.1.1 - Trade Data Parsing Enhancement

  • Fixed: Improved robustness of trade volume parsing to handle edge cases where volume is returned as '0.0'
  • Improved: Added comprehensive error handling in feed_parser.py for both quote and trade data parsing
  • Enhanced field stripping to handle whitespace variations in API responses
  • Both quote and trade parsers now gracefully skip records with invalid data instead of crashing

Notes

  • Requires network access to the PSX feed host.
  • This project does not place trades. It is display‑only.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psx_terminal-0.1.3.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

psx_terminal-0.1.3-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file psx_terminal-0.1.3.tar.gz.

File metadata

  • Download URL: psx_terminal-0.1.3.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for psx_terminal-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c71d5bec731b640724fd8c57f0cd41fd8b2f52dcb5c5a44784477e26ca42a19a
MD5 bbebfc15f8c769d8336a80dfce70096b
BLAKE2b-256 3334fbe1fa5883c1ca98322ca622f47656d234ec5538d6fc1626374da139b49f

See more details on using hashes here.

File details

Details for the file psx_terminal-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: psx_terminal-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for psx_terminal-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 44bd61ed12a214ff21027917f6a68d023ff468455c11dbc30ae8fb1ef232f125
MD5 1ed2e6ec131baed78881c336ab4d76f3
BLAKE2b-256 e175e90f00aa2fb6f20055405750f5b38a6e28a636431c71eb524362a4e3608c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page