Skip to content

shekhu24-bit/Indian-Stock-Market-Analysis

Repository files navigation

πŸ“ˆ Indian Stock Market Analysis Dashboard

Python Power BI pandas yfinance License

A Business Analytics project combining Python, yfinance (Real NSE Data), and Power BI to evaluate top Indian companies using historical stock prices, fundamental ratios, risk metrics, and news sentiment.


🎯 Project Objective

Analyze the performance of 10 major NSE-listed companies and generate data-driven investment insights through an interactive Power BI dashboard.

Companies Analyzed

Company NSE Ticker Sector
Reliance Industries RELIANCE.NS Energy & Retail
TCS TCS.NS Information Technology
Infosys INFY.NS Information Technology
HDFC Bank HDFCBANK.NS Banking
ICICI Bank ICICIBANK.NS Banking
SBI SBIN.NS Banking
ITC ITC.NS FMCG
Bharti Airtel BHARTIARTL.NS Telecom
Larsen & Toubro LT.NS Infrastructure
Hindustan Unilever HINDUNILVR.NS FMCG

πŸ›  Technologies Used

Category Tools
Data Collection yfinance (Real NSE/BSE Data)
Data Processing Python 3, Pandas, NumPy
Visualization Matplotlib, Power BI
Data Storage CSV Files

πŸ“Š Dashboard Preview

Investment Score Ranking

Investment Score

Sentiment Score Comparison

Sentiment Score

PE Ratio vs Dividend Yield

PE vs Dividend

Normalized Stock Price Trends

Price Trends

3-Year Returns Comparison

Returns

Volatility (Risk) Comparison

Volatility


πŸ“‚ Project Structure

Indian_Stock_Market_Analysis/
β”‚
β”œβ”€β”€ dashboard.pbix                 ← Power BI Dashboard
β”‚
β”œβ”€β”€ stock_prices.csv               ← Real NSE price data (3,650+ records)
β”œβ”€β”€ company_fundamentals.csv       ← PE, Dividend, ROE, Market Cap
β”œβ”€β”€ news_sentiment.csv             ← Sentiment scores (500+ records)
β”œβ”€β”€ investment_ranking.csv         ← Final ranking output
β”‚
β”œβ”€β”€ charts/
β”‚   β”œβ”€β”€ investment_score.png
β”‚   β”œβ”€β”€ sentiment_score.png
β”‚   β”œβ”€β”€ pe_vs_dividend.png
β”‚   β”œβ”€β”€ price_trends.png
β”‚   β”œβ”€β”€ returns_comparison.png
β”‚   └── volatility.png
β”‚
β”œβ”€β”€ generate_dataset.py            ← Fetches real data from NSE via yfinance
β”œβ”€β”€ analysis.py                    ← Core analytical logic + investment scoring
β”œβ”€β”€ charts.py                      ← Chart generation
β”‚
β”œβ”€β”€ requirements.txt
└── README.md

πŸ“Š Dashboard Pages

1️⃣ Executive Summary

  • Average Closing Price
  • Total Market Capitalization
  • Average PE Ratio
  • Overall Sentiment Score
  • Normalized Stock Price Trend

2️⃣ Fundamental Analysis

  • PE Ratio Comparison
  • Dividend Yield Analysis
  • Market Cap Distribution
  • ROE (Return on Equity) Comparison
  • Sector-wise Performance

3️⃣ Sentiment Analysis

  • Average News Sentiment Score per company
  • Positive vs Negative vs Neutral Distribution
  • Overall Market Sentiment Indicator

4️⃣ Investment Recommendation

Investment Score Formula:

Investment Score =
  (Sentiment Score Γ— 30)
+ (ROE % Γ— 0.3)              ← Profitability
+ (Dividend Yield Γ— 5)       ← Income Generation
+ (1 / PE_Ratio Γ— 10)        ← Valuation (Lower PE = Better)
- (Volatility % Γ— 0.2)       ← Risk Penalty

Companies ranked on: Sentiment + Profitability + Valuation + Income βˆ’ Risk


πŸ“ˆ Dataset Details

Dataset Columns Records
stock_prices.csv Date, Company, Ticker, Open, High, Low, Close, Volume 3,650+
company_fundamentals.csv Company, Sector, Market Cap, PE Ratio, Dividend Yield, EPS, ROE, 52W High/Low 10
news_sentiment.csv Date, Company, Headline, Sentiment Score, Sentiment 500+

Note: Stock price data is fetched in real-time from NSE via yfinance. Last 3 years of data (2022–2025).


πŸš€ How To Run

Step 1 β€” Clone the repository

git clone https://github.com/shekhu24-bit/Indian-Stock-Market-Analysis.git
cd Indian-Stock-Market-Analysis

Step 2 β€” Install dependencies

pip install -r requirements.txt

Step 3 β€” Fetch real NSE data

python generate_dataset.py

Step 4 β€” Run analysis

python analysis.py

Step 5 β€” Generate charts

python charts.py

Step 6 β€” Open Power BI Dashboard

Open dashboard.pbix β†’ Click Home β†’ Refresh


πŸ” Key Insights

  • HDFC Bank ranked #1 with highest investment score due to strong fundamentals and positive sentiment
  • Bharti Airtel leads in news sentiment positivity
  • Reliance Industries offers the best valuation (lowest PE Ratio)
  • Banking sector shows the most balanced PE and Dividend combination
  • ~61.8% of all news coverage was positive across companies
  • TCS and Infosys show lowest volatility (suitable for risk-averse investors)

πŸ’Ό Business Applications

  • πŸ“Œ Investment Research & Portfolio Evaluation
  • πŸ“Œ Financial Analytics Reporting
  • πŸ“Œ Sector Performance Benchmarking
  • πŸ“Œ MBA Business Analytics Capstone Projects
  • πŸ“Œ Power BI Dashboard Development Practice

πŸ“š Skills Demonstrated

  • Real financial data extraction (yfinance / NSE)
  • Data Cleaning and Feature Engineering
  • Financial Ratio Analysis (PE, ROE, Dividend Yield)
  • Volatility & Risk Measurement (Annualized Std Dev)
  • Sentiment Analysis (Scoring Framework)
  • Max Drawdown Calculation
  • Matplotlib Chart Generation (6 chart types)
  • Power BI KPI Design & Dashboard Development
  • Business Decision-Making from Data

πŸ† Conclusion

This project demonstrates how Python-based analytics and Power BI dashboards can transform real NSE market data into actionable investment insights. By integrating price history, company fundamentals, risk metrics, and market sentiment into a composite Investment Score, the dashboard provides a structured framework for comparing stocks across sectors.


πŸ‘€ Author

Shekhar Tanwar MBA β€” Finance & Business Analytics | Maharshi Dayanand University, Rohtak

LinkedIn GitHub

About

Python and Power BI project analyzing Indian stocks using historical prices, fundamentals, and news sentiment

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages