A Python-based system for analyzing financial news sentiment and calculating options hedging strategies using the Black-Scholes model. The project leverages AI-powered sentiment analysis (FinBERT) to classify market news as bullish or bearish signals.
This repository combines financial news analysis with quantitative options pricing to support informed hedging decisions:
- News Aggregation: Fetches real-time business news from NewsAPI
- Sentiment Analysis: Uses FinBERT (financial domain pre-trained transformer) to analyze market sentiment
- Ticker Extraction: Identifies company tickers from news articles using pattern matching and company name mapping
- Options Pricing: Black-Scholes model implementation for call/put pricing and Greeks calculation
- Delta Hedging: Automated hedge position calculation based on option deltas
- Python 3.8+
- NewsAPI key (get one at newsapi.org)
-
Clone the repository (or navigate to the project directory)
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
Create a
.envfile in the project root:NEWSAPI_KEY=your_newsapi_key_here
Execute the news sentiment analysis pipeline:
python src/pipeline/main.pyThis will:
- Fetch the latest 100 business news articles
- Analyze sentiment for each article
- Classify articles as BULLISH, BEARISH, or NEUTRAL
- Display sentiment scores and signals
- Track cumulative bullish/bearish article counts
Edit src/config/settings.py to customize:
SENTIMENT_POSITIVE_THRESHOLD: Minimum confidence for bullish signal (default: 0.7)SENTIMENT_NEGATIVE_THRESHOLD: Minimum confidence for bearish signal (default: 0.7)
This is an active project. Key areas for improvement:
- Ticker extraction accuracy (see TODO in
tickers.py) - Portfolio optimization algorithms
- Multi-asset hedging strategies
- Backtesting framework
Disclaimer: This software is for educational and research purposes only. Not financial advice. Always conduct your own research and consult with financial professionals before making investment decisions.