Real-time economic analysis, LSTM forecasting, multilingual news sentiment, and macro simulation โ all in one dashboard.
India's economic data is fragmented across dozens of sources โ stock indices on one platform, inflation data on another, state-level indicators buried in government PDFs, and news scattered across hundreds of portals. Existing platforms like Bloomberg or Moneycontrol display numbers but offer no explanation, no prediction, and no simulation.
BharatLens solves this by aggregating real-time data from multiple sources, applying AI to analyze and forecast it, and presenting everything in a single interactive dashboard โ in both Hindi and English.
| Module | Description |
|---|---|
| Market Pulse | Live NIFTY, SENSEX, Gold, Crude Oil, USD/INR with % change |
| NIFTY Forecast | LSTM neural network trained on 3 years of data with uncertainty bands |
| News Sentiment | FinBERT-powered sentiment analysis on Hindi and English financial news |
| State Health | Economic health score for 15 Indian states |
| What-If Lab | Simulate impact of RBI rate changes, crude oil prices, FDI, and currency shifts |
BharatLens/
โ
โโโ app.py # Main Streamlit dashboard
โ
โโโ modules/
โ โโโ data_fetch.py # Data ingestion (Yahoo Finance, World Bank, RSS)
โ โโโ sentiment.py # FinBERT sentiment analysis (Hindi + English)
โ โโโ whatif.py # What-If econometric simulator
โ
โโโ models/
โ โโโ lstm_model.py # LSTM architecture, training, forecasting
โ
โโโ requirements.txt
Data Sources Processing Output
โโโโโโโโโโโโ โโโโโโโโโโ โโโโโโ
Yahoo Finance โ MinMax Scaling โ LSTM Forecast
World Bank API โ Feature Engineering โ Macro Dashboard
RSS News Feeds โ Hindi Translation โ Sentiment Score
FinBERT Inference โ Market Mood
Static State Data โ Weighted Scoring โ State Health Map
User Sliders โ Econometric Model โ Sector Impact
- Architecture: 2-layer LSTM โ Linear(64 โ 32) โ Linear(32 โ 1)
- Input: Last 60 trading days of NIFTY 50 closing prices
- Preprocessing: MinMaxScaler normalization to [0, 1]
- Split: 85% training / 15% validation
- Loss Function: Mean Squared Error (MSE)
- Output: Next N days forecast with ยฑ1.5% uncertainty bands
- Why LSTM: Stock prices are sequential โ LSTM's memory cell captures long-term dependencies that standard feedforward networks miss
- Model: ProsusAI/finbert โ BERT fine-tuned on financial text
- Labels: Positive / Negative / Neutral
- Hindi Support: Devanagari text is auto-detected, translated to English via GoogleTranslator, then passed to FinBERT
- Why FinBERT over BERT: Domain-specific training on financial corpora makes it understand terms like "rate hike", "market rally", and "FII outflow" accurately
Elasticity coefficients derived from historical Indian market behavior:
- RBI rate hike of 25 bps โ NIFTY approximately -1.2%
- Crude oil +$5/barrel โ NIFTY approximately -0.4%
- INR depreciation of Rs 1 โ IT sector +0.8%, NIFTY -0.3%
- FDI inflow of +$1B โ NIFTY approximately +0.6%
- Python 3.8 or above
- Active internet connection for live data fetching
# Clone the repository
cd BharatLens
# Create a virtual environment (recommended)
python -m venv deepv
deepv\Scripts\activate # Windows
source deepv/bin/activate # Mac/Linux
# Install dependencies
pip install -r requirements.txt
# Run the app
streamlit run app.pyThe app will open at http://localhost:8501
Note: FinBERT model (~500MB) downloads automatically on first use of the News Sentiment tab. This is a one-time download.
| Layer | Technology |
|---|---|
| Dashboard | Streamlit |
| Neural Network | PyTorch |
| NLP Model | HuggingFace Transformers (FinBERT) |
| Market Data | yfinance โ Yahoo Finance |
| Macro Data | World Bank Open API |
| News | feedparser โ ET, MoneyControl, NDTV Profit RSS |
| Translation | deep-translator โ Google Translate |
| Visualization | Plotly |
| Data Processing | Pandas, NumPy, Scikit-learn |
| Source | Data Provided |
|---|---|
| Yahoo Finance | NIFTY 50, SENSEX, NIFTY Bank, NIFTY IT, USD/INR, Gold, Crude Oil |
| World Bank API | GDP Growth, Inflation (CPI), Unemployment, FDI Inflows |
| Economic Times RSS | Financial news headlines |
| MoneyControl RSS | Economy news |
| NDTV Profit RSS | Market updates |
Why LSTM over simple regression? Economic time series have long-range temporal dependencies. Linear regression predicting tomorrow's NIFTY from today's price misses patterns like weekly cycles, quarterly earnings effects, and macro shock aftereffects. LSTM's gated memory architecture is designed specifically for this.
Why FinBERT over standard BERT? General-purpose BERT was trained on Wikipedia and BookCorpus โ it does not understand financial jargon. FinBERT was fine-tuned on financial news and earnings call transcripts, making it significantly more accurate on domain-specific terms.
Why translate Hindi instead of using a multilingual model? Multilingual models like mBERT perform poorly on financial Hindi and Hinglish text because labeled training data for this domain in Hindi is scarce. Translating to English first and using the domain-expert FinBERT gives more reliable results.
- Add FII/DII flow data from NSE
- Integrate RBI monetary policy calendar
- Add portfolio risk calculator
- Add alert system for high-risk economic signals
- Expand state coverage to all 28 states and 8 Union Territories
MIT License โ free to use, modify, and distribute.