A comprehensive system for extracting financial intelligence from news sources, analyzing market impact, and generating actionable insights using NLP and knowledge graphs.
This project combines Natural Language Processing (NLP), Knowledge Graph technology, and financial data analysis to:
- Extract financial events and entities from news articles
- Perform sentiment analysis on financial news
- Build a knowledge graph of relationships between companies, events, and market impacts
- Generate market impact predictions
- Provide explainable trading signals based on news sentiment
finance-news-intelligence/
βββ backend/ # Python backend (API & Pipeline)
β βββ config.py # Configuration management
β βββ server.py # FastAPI application
β βββ pipeline.py # ETL pipeline
β βββ database.py # Database operations
β βββ datetime_utils.py # Utility functions
β β
β βββ nlp/ # NLP Module
β β βββ ner_model.py # Named Entity Recognition
β β βββ event_extractor.py # Event extraction
β β βββ aspect_sentiment.py # Aspect-based sentiment analysis
β β
β βββ intelligence/ # Intelligence Module
β β βββ knowledge_graph.py # Knowledge graph construction
β β βββ query_engine.py # Graph query engine
β β βββ signal_generator.py # Trading signal generation
β β βββ summarizer.py # Report summarization
β β
β βββ market/ # Market Analysis Module
β β βββ market_data_loader.py # Market data fetching
β β βββ price_loader.py # Price data handling
β β βββ impact_analysis.py # Market impact analysis
β β
β βββ evaluation/ # Evaluation Module
β β βββ accuracy_report.py # Accuracy metrics
β β βββ logic_tester.py # Logic validation
β β βββ visual_report.py # Report visualization
β β
β βββ data/ # Data Directory
β β βββ finance.db # SQLite database
β β βββ stocks_universe.csv # Supported stocks list
β β βββ raw/ # Raw data storage
β β βββ yfinance_cache/ # Finance data cache
β β
β βββ lib/ # Frontend libraries
β βββ vis-9.1.2/ # Vis.js network visualization
β βββ tom-select/ # Select dropdown library
β βββ bindings/ # JavaScript bindings
β
βββ frontend/ # React + Vite Frontend
β βββ src/
β β βββ components/
β β β βββ ExplainableReasoning.jsx
β β β βββ MarketNews.jsx
β β β βββ PortfolioImpact.jsx
β β β βββ RippleEffect.jsx
β β βββ pages/
β β β βββ Dashboard.jsx
β β β βββ Login.jsx
β β βββ App.jsx
β β βββ api.js
β β βββ main.jsx
β βββ public/
β βββ package.json
β βββ vite.config.js
β βββ eslint.config.js
β
βββ requirements.txt # Python dependencies
βββ README.md # This file
- Python 3.8+
- Node.js 16+
- SQLite3
- Create and activate virtual environment:
python -m venv venv
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate- Install dependencies:
pip install -r requirements.txt- Initialize database:
# Database will be initialized automatically when the server starts
python backend/server.py- Install dependencies:
cd frontend
npm install- Start development server:
npm run dev-
Run API Server:
python backend/server.py
API will be available at
http://localhost:8000 -
Run ETL Pipeline:
python backend/pipeline.py
- Development:
npm run dev
Handles natural language processing tasks:
- NER Model: Extracts named entities (companies, people, locations)
- Event Extractor: Identifies financial events from text
- Aspect Sentiment: Analyzes sentiment for specific aspects (price, risk, growth)
Generates actionable intelligence:
- Knowledge Graph: Builds relationships between entities and events
- Query Engine: Retrieves relevant information from the graph
- Signal Generator: Creates trading signals based on news impact
- Summarizer: Generates concise reports
Analyzes market data:
- Market Data Loader: Fetches real-time and historical data
- Price Loader: Manages stock price information
- Impact Analysis: Quantifies news impact on prices
Validates and reports results:
- Accuracy Report: Metrics and performance analysis
- Logic Tester: Validates business logic
- Visual Report: Generates dashboard visualizations
GET /api/news- Get latest newsPOST /api/news/analyze- Analyze news articleGET /api/sentiment/{ticker}- Get sentiment for a stock
GET /api/graph/entities- List all entitiesGET /api/graph/relations/{entity}- Get entity relationsPOST /api/graph/query- Query the knowledge graph
GET /api/signals/{ticker}- Get trading signalsGET /api/signals/portfolio- Portfolio impact analysis
GET /api/impact/{ticker}- Historical impact analysisPOST /api/impact/predict- Predict market impact
The system uses JWT-based authentication:
- Login: POST
/api/auth/login - Logout: POST
/api/auth/logout - Verify: GET
/api/auth/verify
Credentials are secured using bcrypt hashing.
- Real-time News Processing - Fetches and processes financial news
- Sentiment Analysis - Multi-aspect sentiment scoring
- Entity Recognition - Identifies companies, executives, financial terms
- Knowledge Graph - Visual representation of relationships
- Trading Signals - AI-generated buy/sell recommendations
- Portfolio Impact - Analyze impact on your portfolio
- Explainable AI - Understand reasoning behind signals
- Market Impact Analysis - Quantify news effect on prices
Run the logic tester to validate the system:
python backend/evaluation/logic_tester.pyGenerate an accuracy report:
python backend/evaluation/accuracy_report.pyfeedparser- RSS feed parsingyfinance- Stock data fetchingpandas- Data manipulationnetworkx- Graph algorithmspyvis- Graph visualizationfastapi- Web frameworkuvicorn- ASGI serverpasslib- Password hashingpython-jose- JWT handlingrequests- HTTP clientmatplotlib- Plotting
react- UI frameworkvite- Build toolaxios- HTTP client
See requirements.txt for full dependencies.
News Source
β
Feed Parser (feedparser)
β
NLP Pipeline (NER, Event Extraction, Sentiment)
β
Knowledge Graph Construction
β
Market Impact Analysis
β
Signal Generation
β
Dashboard Visualization
β
User
Edit backend/config.py to customize:
- Database path
- API port and host
- News sources
- Model parameters
- Update frequency
This project is licensed under the MIT License.