PSX Investor: A FastAPI Tool for Disciplined Stock Investing on the Pakistan Stock Exchange
说明与用途
PSX Investor 自动化计算巴基斯坦证券交易所的目标权重和股票购买,消除手动错误并节省时间。
问题
Manual arithmetic for target‑weight investing on the Pakistan Stock Exchange is error‑prone and time‑consuming, especially when dealing with whole‑share constraints, live intraday prices, multiple holdings, and monthly tracking.
结果
The tool reduces monthly investment preparation time from minutes of spreadsheet work to a single button click, ensures accurate whole‑share calculations, and keeps all personal data local, enhancing privacy and reliability.
工作流
- Enter investment amount in the web UI
- FastAPI backend loads portfolio weights from local JSON
- Backend concurrently fetches live prices from dps.psx.com.pk using async HTTP requests
- Backend calculates target PKR per holding, floors to whole shares, computes cost and actual weight
- Backend returns JSON plan to frontend
- Frontend renders plan table for user review
- User records actual purchases via API
- Backend aggregates transaction history to compute average cost, market value, and unrealized P/L
- User reviews updated positions each month
证据
PSX Investor is the local tool I built to automate that workflow. It is a FastAPI backend plus a single self-contained HTML page: enter an amount, get a buy plan with live prices, record what you actually purchased, and track positions at cost and market value.
The hard part of disciplined investing is not picking stocks — it is doing the same correct arithmetic every month without letting friction erode the habit.
- 记录日期: 2026-09-05T15:31:59.503Z