PSX ExpertAdvisor is a rule-based AI expert system that provides transparent, logic-driven trading signals for the Pakistan Stock Exchange. It encodes financial heuristics to transform market data into actionable Buy, Sell, and Hold recommendations.
Course: Artificial Intelligence
This project implements a Knowledge-Based System (KBS); a branch of Artificial Intelligence that mimics the decision-making ability of a human expert. The AI logic is divided into:
- Fact Base: Current market price, trading volume, and calculated technical indicators.
- Rule Base: A collection of "IF-THEN" statements derived from technical analysis strategies.
- Inference Engine: The core logic that matches current market "Facts" against the "Rules" to generate actionable insights.
- Real-time & historical PSX data via
yfinance - Market scanner to identify trading opportunities
- Technical stock analysis (MA crossovers, RSI, volume)
- Rule-based Buy/Sell/Hold signal generation
- Portfolio builder for risk-aware investment tracking
- Interactive Dashboard
- Explainable AI with transparent, rule-backed decisions
- Input: User enters a PSX Ticker symbol (e.g., SYS, LUCK, ENGRO).
- Fetch: The system pulls the latest historical data for that specific ticker.
- Analyze: The Rule-Engine calculates technical heuristics (RSI, MAs, etc.).
- Decision: The Inference Engine checks which rules are met.
- Output: The dashboard displays the final signal (Buy/Sell/Hold) along with the reasoning.
- Language: Python
- Framework: Flask
- Data Analysis: pandas, numpy
- Market Data: yfinance (Yahoo Finance API)
- Web Scraping & Feeds: feedparser, requests
- Core: Vanilla JavaScript (ES6+), HTML5, CSS3
- Data Visualization: Chart.js with chartjs-chart-financial for candlestick charts
- Networking: Axios for API communication
- Python >= 3.10.
- Git installed.
git clone https://github.com/ajawad06/PSX-IntelliTrade.git
cd PSX-IntelliTradepython -m venv venv
# Activate on Windows:
.\venv\Scripts\activate
# Activate on Mac/Linux:
source venv/bin/activatepip install -r requirements.txtstreamlit run app.py