🧾 Originally implemented as a startup concept (Summer 2019 – Winter 2020) and restructured for commercial deployment with improved modularity, business-driven modeling, and production-ready engineering practices.
A commercial AI-driven platform for real-time and end-of-day forecasting of all Tehran Stock Exchange symbols in the name of DeepTSE.
Built in collaboration with industry partners and academic advisors, it integrates automated data-ingestion pipelines, deep-learning LSTM models, smart feature extraction (technical indicators & news sentiment), and rolling 40-minute predictions.
🧠 Pioneering Deep Learning in Iranian Fintech
This project represents one of the earliest commercial startup initiatives in Iran to apply deep learning for short-term forecasting in financial markets.
⚠️ This repository contains a small demo subset of the original DeepTSE platform, intended for public display only.
This end-to-end platform ingests real-time and end-of-day trading data from all Tehran Stock Exchange symbols, performs smart feature extraction (technical indicators & news sentiment), trains deep-learning LSTM models, and delivers rolling forecasts every 40 minutes.
Developed solo (CTO, researcher & full-stack engineer) over 1.5 years under the supervision of K. N. Toosi University and commercial stakeholders. Cancelled due to a 90 % market downturn, it remains the first Iranian knowledge-based startup to apply deep learning across all TSE symbols.
In early testing, the deep learning model (LSTM-RNN) achieved over 70% prediction accuracy, using a hybrid input of market data and curated news signals.
-
Automated Data Pipeline
• Intraday (second-level) & end-of-day CSV extraction
• One-click export to Google Drive & Colab integration -
Smart Symbol Analysis
• Excel-based filters for liquidity & volume
• Four custom heuristics drive model inputs -
News Aggregation Module
• Real-time crawl of financial news from trusted sources
• Direct storage into Colab for sentiment analysis -
Timeframe & Volume Tuning
• Python scripts to benchmark 5–210 min intervals
• Selection of optimal 40 min window -
Data Sufficiency Tests
• Evaluate minimum historical horizon (4 years) for best-case accuracy -
Deep Learning Model (LSTM RNN)
• Over 2 000 lines of Python for architecture, optimization & evaluation
• Combines technical & news-sentiment inputs -
Web App & Dashboard
• Custom PHP backend & lightweight frontend
• Live forecast display, recommendation hall, and user-ranked insights -
News-Driven Signal Processing
• Keyword-based confidence matching
• Historical impact lookup feeds model corrections -
End-to-End Deployment
• Colab → production server integration
• Automated pipelines & logging for continuous operation -
Simulation Engine
• Virtual buy/sell execution by the model on historical data
• Daily tracking of simulated profit/loss
• Feedback loop for identifying weaknesses and improving model accuracy
• Used to iteratively refine strategies and validate real-world performance
This repository includes a modular architecture for stock forecasting and portfolio optimization.
The following subsystems are integrated into the overall design:
- Executes trades based on technical and fundamental signals
- Uses algorithmic trading strategies
- Manages risk and capital allocation
- Logs and tracks executed trades
- Evaluates trade performance and improves strategies
- Selects stocks using fundamental, technical, and financial criteria
- Applies decision-making models for optimal selection
- Compares performance across multiple stocks
- Prioritizes high-growth, low-risk assets
- Updates selected stock list based on market changes
- Analyzes current portfolio performance
- Identifies strengths and weaknesses
- Suggests adjustments for better results
- Implements proposed changes
- Continuously evaluates and improves portfolio composition
- Defines timeframes for data analysis
- Schedules trading execution windows
- Sets evaluation intervals for system performance
- Updates scheduling based on market dynamics
🗂️ Portfolio updates are performed on a weekly or monthly basis.
📌 The full system flowchart is available below (Diagram created by Ehsan Lesani):
All rights reserved. Do not redistribute without permission.
Every 40 minutes, the system generates a numeric forecast for each symbol based on:
- Technical indicators (price, volume, volatility)
- News sentiment (positive, negative, neutral)
- Historical impact of similar news events
The model outputs a predicted price and confidence score, which feeds into the recommendation engine.
The following charts illustrate key components of DeepTSE’s simulation and forecasting logic.
All visualizations are generated by the platform’s internal model and are used for demonstration purposes only.
© All rights reserved by Ehsan Lesani and BesparWeb.
These two charts represent a simulated trading session for a single symbol during one trading day.
The orange line shows the actual market price, while the blue line reflects the forecast generated by the primary model.
Green upward-pointing triangles and red downward-pointing triangles mark the optimal buy and sell points, respectively—selected to maximize profit without incurring excessive transaction costs.
This simulation engine enables the model to virtually execute trades and track profit/loss in real time.
Importantly, a secondary model was designed to learn and refine these threshold points for daily trading decisions, based on the forecasted price trajectory.
Together, the forecasting and threshold models form a feedback loop that helps identify weaknesses, improve strategy, and enhance overall accuracy through iterative simulation.
This chart demonstrates DeepTSE’s hierarchical forecasting capability.
Each trading day includes 4 hours of activity, segmented into 25-minute intervals.
The model first predicts the immediate next 25-minute window, then recursively forecasts subsequent intervals with reasonable accuracy.
In the final 25-minute segment, the model successfully predicts a breakout above resistance, leading to a sharp price increase.
This type of layered forecasting is essential for short-term strategy planning and dynamic signal generation.
📌 All charts are generated by DeepTSE’s internal model and simulation engine.
No real-time trading advice is provided.
All visual content is © Ehsan Lesani – BesparWeb, 2025. Redistribution without permission is prohibited.
This repository includes two sample raw datasets used for demonstration purposes only.
These samples illustrate the structure of commercial-grade data pipelines in financial forecasting systems.
No real commercial data has been published — all values are synthetic and for illustrative use only.
| gregorian_date | time | price | volume |
|---|---|---|---|
| 11/20/2013 | 09:00:14 | 2710 | 20312 |
| 11/20/2013 | 09:00:14 | 2710 | 17500 |
| 11/20/2013 | 09:00:14 | 2710 | 10000 |
| 11/20/2013 | 09:00:14 | 2710 | 9688 |
| 11/20/2013 | 09:00:14 | 2710 | 8000 |
| 11/20/2013 | 09:00:14 | 2710 | 5000 |
| 11/20/2013 | 09:00:14 | 2710 | 2350 |
| 11/20/2013 | 09:00:14 | 2710 | 2000 |
| 11/20/2013 | 09:00:14 | 2710 | 1950 |
| 11/20/2013 | 09:00:14 | 2710 | 1255 |
| gregorian_date | create_date | create_time | number_page | category | page_failure | http_code | text_file_path |
|---|---|---|---|---|---|---|---|
| 3/19/2014 | 12/31/2020 | 22:45:05 | 2 | Economic | 0 | 200 | /news/13921228.html |
| 3/20/2014 | 12/31/2020 | 22:45:08 | 1 | Economic | 0 | 200 | /news/13921229.html |
| 3/21/2014 | 12/31/2020 | 22:45:09 | 1 | Economic | 0 | 200 | /news/13930101.html |
| 3/22/2014 | 12/31/2020 | 22:45:10 | 1 | Economic | 0 | 200 | /news/13930102.html |
| 3/23/2014 | 12/31/2020 | 22:45:10 | 1 | Economic | 0 | 200 | /news/13930103.html |
| 3/24/2014 | 12/31/2020 | 22:45:11 | 1 | Economic | 0 | 200 | /news/13930104.html |
| 3/25/2014 | 12/31/2020 | 22:45:12 | 2 | Economic | 0 | 200 | /news/13930105.html |
| 3/26/2014 | 12/31/2020 | 22:45:13 | 1 | Economic | 0 | 200 | /news/13930106.html |
| 3/27/2014 | 12/31/2020 | 22:45:14 | 1 | Economic | 0 | 200 | /news/13930107.html |
| 3/28/2014 | 12/31/2020 | 22:45:15 | 1 | Economic | 0 | 200 | /news/13930108.html |
- These are raw initial datasets used for prototyping and demonstration.
- The actual production datasets contain many more columns derived from extensive calculations.
- The technical dataset includes 61 engineered features, which require feature selection before being fed into forecasting models.
- The news dataset includes metadata only; the actual text files are referenced via
text_file_pathand used for NLP and sentiment analysis.
📌 All sample data is synthetic and used solely for documentation and demonstration.
No proprietary or commercial data has been disclosed.
The DeepTSE platform is designed to support a wide range of user-facing and backend features for intelligent stock forecasting, visualization, and decision support.
The modules listed below represent the scope of the first phase of development.
Future phases are planned to significantly expand the platform’s capabilities across more symbols, analytical layers, and user tools.
The image below shows the main interface of DeepTSE’s web platform.
On the left, a dynamic sidebar gives users access to all core modules including registration, dashboard, symbol analysis, technical and behavioral tools, and news sentiment.
The main landing page highlights DeepTSE’s positioning as the first deep learning startup for financial markets, with bold metrics for accuracy, forecasting power, and trust level.
📌 This interface is part of the production-ready web app.
- User registration ✅
- Login/logout management ✅
- User dashboard 🔄
- Password recovery ✅
- Real-time trade list by time, volume, price, and validity ✅
- Real-time box chart: last, first, min, max prices ✅
- Forecasted price chart vs. last trade price with volume (past & future window) ✅
- Real-time closing price chart with cumulative volume ✅
- Interval-based forecast accuracy, direction correctness, and suggested buy/sell prices ✅
- Real-time metadata: daily volume, float shares, legal/real trades, etc. ✅
- Daily share increase/decrease history (1+ years) ✅
- Standard daily technical charts ✅
- Interval chart of index price and volume ✅
- Group-level status of symbols by share increase/decrease 🔄
- Market graphs, 3D charts, and impact overlays 🔄
- Real-time technical charts with intra-day resolution ✅
- Cross-impact analysis: index ↔ symbols, sector ↔ symbols, news ↔ market ✅
- Parallel charts for industrial groups 🔜
- Average growth/decline metrics per group 🔜
- Daily trend tracking for group performance 🔜
- Real-time news impact analysis ✅
- Behavioral analysis of trader actions for portfolio suggestions 🔄
- Collaborative decision room with sentiment aggregation 🔄
- Real-time fundamental analysis: bubble detection, risk scoring 🔄
- Market trend analysis via multi-agent algorithms 🔜
- Prediction of buy/sell queues and volume existence probabilities 🔜
- Forecast-based volume suggestions 🔜
- MetaTrader-style basic tools 🔄
- Tools for technical, fundamental, and news-based analysis ✅
- Buy/sell access to time series, technical, fundamental, and news data ✅
- Account-level access control panel ✅
- Free preview of historical data per symbol ✅
- Purchase panel for analytical/statistical datasets ✅
- Real-time news feed by market, sector, or symbol ✅
- Peer-to-peer signal trading between analysts and users 🔜
- Signal monetization with system fee and performance tracking 🔜
- Mandatory trade result reporting for scoring and feedback 🔜
- News scraping from Fars News ✅
- Intraday data extraction per symbol (date, time, volume, last price, etc.) ✅
- Backend AI engine for statistical and predictive analysis 🔄
- Some symbols support derivative instruments (e.g. put options) which may be suggested based on forecasted trends.
- Currently focused on Foolad Mobarakeh Esfahan, expanding to 4 more symbols, and eventually to all TSE symbols.
- The system is designed to be modular and scalable across the Iranian stock market.
✅ = Implemented
🔄 = In progress
🔜 = Planned
A smart ranking system aggregates user forecasts:
-
Users with higher historical accuracy have more influence
-
The system combines model output + top user predictions to recommend:
- ✅ Buy: Strong positive signals
- ❌ Sell: Negative sentiment or technical downturn
- ⏸️ Hold: Neutral or conflicting signals
- Avoid claiming proprietary third-party trademarks as dependencies.
- Mention public dataset sources and ensure product images are licensed for commercial use.
All financial data used in this project was collected from publicly available sources for demonstration and research purposes only.
No proprietary or commercial redistribution is involved.
During the final stages of development, we planned to acquire commercial-grade APIs from the Tehran Stock Exchange to enable real-time data integration for our forecasting models.
However, due to the historic market crash and investor withdrawal, the project was halted before reaching full deployment.
The platform was approximately 80% complete at the time of cancellation.
This project is released under the MIT License.
This project was originally initiated at the direct request of Dr. Hossein Khasteh, one of the leading professors at K. N. Toosi University of Technology — one of Iran’s top engineering universities — based on Ehsan Lesani’s proven technical capabilities and prior work in AI and financial modeling.
Dr. Khasteh served as a strategic advisor and facilitator during the early stages, proposing the startup concept and supporting its initial direction.
While the collaboration included a conditional revenue-sharing agreement, the technical development and final architecture were independently executed by Ehsan Lesani.
Special thanks to Dr. Hossein Khasteh for his early vision and encouragement.
Ehsan Lesani
AI Solutions Architect | AI Engineer | Full-Stack Dev | Remote-first CTO | Fintech Innovator
🔗 Official Site
📂 Linkedin Profile
📧 Contact for Commercial Collaboration




