Welcome to the India Market Sector News Dashboard — a simple Python-powered tool that fetches and classifies daily financial news headlines by sector using the free GNews API.
You can use this dashboard to:
- Pick any date (limited to recent days based on API availability)
- Fetch sector-specific financial news headlines
- See which sectors are most active in the news that day
Click on the “Fetch News” button after selecting a date to view headlines and how they’re classified by sector based on keywords.

How it works
- The dashboard sends queries to the GNews API grouped by market sectors like Banking, IT, Energy, and Pharma.
- It uses a custom keyword mapping system to tag each news article to one or more sectors based on the article title and description.
- A summary of how many times each sector appeared in the news is displayed at the end — giving a simple news sentiment heatmap by sector.
The API currently uses a free tier, limited to 100 requests per day — so if you hit a rate limit error, it’s likely because of that 😅
What’s Next? How Can You Use This Further?
1️⃣ Sentiment Analysis Integration
In the next phase, this dashboard can be extended to:
- Perform sentiment scoring on each news article headline or description
- Classify articles as positive, negative, or neutral
- Combine the number of news hits and sentiment score per sector to create a simple market mood index.
This can help identify:
- Sectors getting bullish coverage
- Sectors under negative press
- Market shifts driven by news sentiment rather than price action
Example use case:
“Banking sector has 25 articles today, with 80% showing positive sentiment — potentially indicating a positive institutional narrative even before price moves.”
2️⃣ Midday Market Heatmap / News Scanner
The same dashboard logic can be scheduled to run:
- Every hour
- Or on-demand during market hours
This would help traders or investors quickly check:
- Which sectors are spiking in news coverage
- Correlate sudden sector-specific news activity to intraday stock/index movements
- Make tactical trading decisions based on market narrative flow
Example use case:
At 1:30 PM, “Energy” sector shows 18 fresh articles, coinciding with a sharp move in crude prices — an opportunity to adjust sectoral exposure or options strategies.
Below code is built on GNews (https://gnews.io/) API. Sign up and choose the free tier to get 100 requests.
The input is in dd-mm-yy, example 06-06-25.
import requests
from datetime import datetime, timedelta
from collections import Counter
import time
API_KEY = 'YOUR_API_KEY_HERE'
# Define sector keywords
sector_keywords = {
'Banking': ['bank', 'psu bank', 'private bank', 'banking'],
'Financial Services': ['nbfc', 'finance company', 'mutual fund', 'amc'],
'IT': ['it company', 'tech stock', 'software company', 'infosys', 'tcs'],
'Pharmaceuticals': ['pharma', 'drug maker', 'pharmaceutical', 'cipla', 'sun pharma'],
'FMCG': ['fmcg', 'consumer goods', 'hindustan unilever', 'nestle'],
'Automobile': ['automobile', 'auto stock', 'maruti', 'tata motors', 'hero moto'],
'Energy': ['oil', 'gas', 'power', 'ongc', 'reliance energy'],
'Metals': ['metal', 'steel', 'tata steel', 'hindalco'],
'Real Estate': ['real estate', 'property'],
'Telecom': ['telecom', 'airtel', 'vodafone', 'jio'],
'Infrastructure': ['infra', 'infrastructure', 'l&t', 'adani ports'],
'Capital Goods': ['capital goods', 'engineering', 'bharat forge'],
'Cement': ['cement', 'ultratech', 'shree cement'],
'Healthcare': ['healthcare', 'hospital', 'apollo'],
'Consumer Durables': ['consumer durable', 'electronic appliances'],
'Media': ['media', 'broadcast', 'news network'],
'Chemicals': ['chemical', 'pidilite', 'alkyl amines'],
'Textiles': ['textile', 'garments', 'vardhman']
}
# Split sector groups into multiple smaller queries to avoid hitting 200-char limit
sector_groups = [
'Banking OR Financial Services OR IT OR Pharmaceuticals',
'FMCG OR Automobile OR Energy OR Metals OR Real Estate',
'Telecom OR Infrastructure OR Capital Goods OR Cement',
'Healthcare OR Consumer Durables OR Media OR Chemicals OR Textiles'
]
# Prompt user for from date
from_date_input = input("Enter From Date (dd-mm-yy): ")
try:
from_date = datetime.strptime(from_date_input, '%d-%m-%y')
print(from_date)
except ValueError:
print("Invalid date format. Please use dd-mm-yy format.")
exit()
# Calculate 'to' date as next day
to_date = from_date + timedelta(days=1)
print(f"\n🔎 Fetching sector-wise news from GNews for {from_date.strftime('%Y-%m-%d')} to {to_date.strftime('%Y-%m-%d')}...\n")
# Track sector mentions
sector_hits = Counter()
seen_urls = set()
article_index = 1
for group in sector_groups:
params = {
'q': group,
'country': 'in',
'lang': 'en',
'from': from_date.strftime('%Y-%m-%dT00:00:00Z'),
'to': to_date.strftime('%Y-%m-%dT00:00:00Z'),
'sortby': 'publishedAt',
'token': API_KEY,
'max': 10
}
response = requests.get('https://gnews.io/api/v4/search', params=params)
if response.status_code == 200:
data = response.json()
articles = data.get('articles', [])
for article in articles:
if article['url'] in seen_urls:
continue # avoid duplicates
seen_urls.add(article['url'])
text = f"{article['title']} {article.get('description', '')}".lower()
matched_sectors = []
for sector, keywords in sector_keywords.items():
if any(kw in text for kw in keywords):
matched_sectors.append(sector)
sector_hits[sector] += 1
print(f"{article_index}. {article['title']}")
print(f" 📅 Published: {article['publishedAt']}")
print(f" 🔗 {article['url']}")
print(f" 🏷️ Sectors: {', '.join(matched_sectors) if matched_sectors else 'Unclassified'}\n")
article_index += 1
time.sleep(1) # avoid rate-limiting
else:
print(f"Error: {response.status_code} - {response.text}")
# Final summary
print("\n📊 Sector mentions in results:")
for sector, count in sector_hits.most_common():
print(f" {sector}: {count}")
This is the output of the above code would look like the below

