https://github.com/sujith-da279/quant_financial_analytics
An in-depth analysis of stock market behaviour for major tech companies (Apple, Google, and NVIDIA) to identify opportunities for trading strategies around earnings announcements
https://github.com/sujith-da279/quant_financial_analytics
data-pipeline financial-data-extraction financial-data-visualization finbert nlp python quantitative-analysis random-forest scikitlearn-machine-learning sentiment-classification stock-data-extraction trading-strategies
Last synced: 10 months ago
JSON representation
An in-depth analysis of stock market behaviour for major tech companies (Apple, Google, and NVIDIA) to identify opportunities for trading strategies around earnings announcements
- Host: GitHub
- URL: https://github.com/sujith-da279/quant_financial_analytics
- Owner: Sujith-DA279
- Created: 2025-03-21T19:28:35.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-03-21T20:00:01.000Z (10 months ago)
- Last Synced: 2025-03-21T20:33:22.827Z (10 months ago)
- Topics: data-pipeline, financial-data-extraction, financial-data-visualization, finbert, nlp, python, quantitative-analysis, random-forest, scikitlearn-machine-learning, sentiment-classification, stock-data-extraction, trading-strategies
- Homepage:
- Size: 1.61 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Quantitative Financial Analytics: Decoding Stock Returns Through Earnings, Macro, and Sentiment Analysis
### 📋 Project Brief
This project conducted an in-depth analysis of stock market behaviour for major tech companies (Apple, Google, and NVIDIA) to identify opportunities for trading strategies around earnings announcements. Using Python, advanced statistical methods, and machine learning, our team delivered actionable insights that can drive enhanced trading decision-making by understanding the relationships between stock price movements, earnings announcements, macroeconomic conditions, and news sentiment.
### 🎯 Business Objectives
The analysis addressed key business needs:
- Understanding stock price movements before and after earnings announcements
- Identifying the impact of key financial metrics on stock performance
- Analysing macroeconomic influences on earnings outcomes and stock prices
- Determining the role of news sentiment in market reactions
### Project Overview:
⏱️ Duration
🏆 Grade
🛠️ Tools
📊 Datasets
6 Weeks
80% (Distinction)
20+ years of stock data
5 macroeconomic indicators
1,423 news articles
### 🔍 Analytical Methodology
#### Data Sources and Collection
| Data Category | Source | Time Period | Key Metrics |
|---------------|--------|-------------|------------|
| Stock Price Data | Yahoo Finance API | 2000-2024 | OHLCV (Open, High, Low, Close, Volume) |
| Financial Metrics | Financial Modeling Prep (FMP API) | 2000-2024 | Earnings, Revenue, Key Financial Ratios |
| Macroeconomic Indicators | Federal Reserve Economic Data (FRED API) | 2000-2024 | GDP, Inflation, Unemployment, Federal Debt, Treasury Yields |
| News Sentiment | NY Times Articles (Client provided Data) | 2019-2024 | 1,423 articles after cleanup |
Data Ingestion from Different Opensource APIs
#### Feature Engineering
We created 90+ derived features across the following categories:
| Feature Category | Examples |
|------------------|----------|
| Stock Metrics | Daily Returns, Balance of Power (BOP), Pre/Post Announcement Returns, Price Coefficient of Variation |
| Financial Indicators | EPS Surprise, Revenue Surprise, Standardized Surprise Scores, Profit Margins, ROE, ROA |
| Macro Indicators | GDP Growth Rates (QoQ/YoY), Federal Debt Change, CPI Changes, Treasury Yield Movements |
| Temporal Features | TTM Metrics, QoQ Changes, YoY Growth Rates |
| Sentiment Scores | FinBERT Composite Scores, Company/Macro Sentiment Classification |
#### Analysis Components
| Analysis Type | Key Methodologies | Analytical Techniques | Outcomes |
|---------------|-------------------|------------------------|----------|
| **Earnings Event Analysis** | • Event study framework
• Multiple return windows (1-5 days)
• Cross-sectional surprise analysis | • Winsorization of extreme values
• Segmentation by surprise direction
• Temporal decomposition (2000-2024) | • **2-3 day** optimal reaction window
• **~0.3** correlation between EPS surprise and returns
• Surprise threshold identification |
| **Macroeconomic Factor Analysis** | • Correlation heatmaps
• Time-series decomposition
• Multi-factor regression
• Company-specific correlations | • Rate-of-change calculations (QoQ, YoY)
• Rolling window correlations
• Comparative macro sensitivity analysis | • Unique company-macro sensitivity maps
• Identified key indicators by company
• Quantified revenue vs. macro impact |
| **News Sentiment Analysis** | • NLP-based sentiment extraction
• Rule-based article classification
• **5-day** pre/post-publication windows | • **FinBERT** financial sentiment scoring
• Publishing date Event-study • Sentiment-return correlation analysis | • Company-specific sentiment responses
• Negative news recovery patterns
• **Pre/post-earnings** sentiment **drift detection** |
| **Trading Strategy Development** | • Signal classification (Buy/Sell/Hold)
• Random Forest ensemble modeling
• Multi-factor integration
• Backtesting framework | • Company-specific thresholds
• Hyperparameter optimization
• Feature importance ranking
• Performance metrics calculation | • **6.5-12.7% average return** per trade
• **83-95%** signal precision
• Realized cumulative returns **>20x**
• Feature importance hierarchies |
### 🗝️ Key Insights and Results
#### Earnings Analysis
- EPS Surprise positively correlates with post-announcement returns (correlation ~0.3)
- Market reaction to surprises **strongest within 2-3 days** after announcement
- **Pre-announcement momentum** (BOP) shows positive correlation with post-announcement returns
EPS Surprise vs Post announcement 2-day returns
#### Macroeconomic Analysis
Each company showed unique macro sensitivity profiles:
| Company | Primary Macro Correlations |
|---------|----------------------------|
| **Apple** | Federal Debt, Real GDP |
| **Google** | Real GDP, CPI, Treasury Yields |
| **Nvidia** | Real GDP, Treasury Yields, Unemployment |
**Revenue growth** consistently showed **stronger impact** on returns *than* **macroeconomic factors** for these high-growth tech companies.
Combined Correlation Heatmap - Returns vs Revenue and Macro factors
#### Sentiment Analysis
News sentiment analysis revealed distinct patterns:
| Company | Sentiment Response Pattern |
|---------|----------------------------|
| **Apple** | Recovers from negative news within 3 days; positive drift otherwise (~1% in 5 days) |
| **Google** | Most stable to sentiment (returns within 1% window); acts as safe-haven during macro uncertainty |
| **Nvidia** | Highest sentiment sensitivity (±2-3% fluctuations); strong positive reaction to macro negativity |
Pre-earnings sentiment shows consistent optimistic bias with post-announcement sentiment typically declining.
Example of Event Study Analysis chart - Apple for Stock sentiment
Sentiment and Stock-price Trend around Earnings Announcements
#### Trading Strategy Performance
| Company | Avg. Return per Deal | Max Drawdown | Cumulative Return | Precision |
|---------|---------------------|--------------|-------------------|-----------|
| AAPL | 6.5% | -14.8% | >20x (51 periods) | 83.3% |
| GOOGL | 8.0% | 0.0% | >20x (39 periods) | 95.0% |
| NVDA | 12.7% | -6.9% | ~700% (39 periods)| 88.9% |
### 🛠️ Technical Implementation
The analysis was implemented using:
- **Data Processing**: Pandas, NumPy
- **Machine Learning**: Scikit-learn,StatsModels,
- **ML Models**: RandomForest, OLS, Binary and Multinomial Logistic Regression
- **NLP**: FinBERT, TextBlob
- **Visualization**: Matplotlib, Seaborn
### 📊 Recommendations
#### Trading Strategy Recommendations
1. **Implement Stock-Specific Models**: Different threshold parameters for each stock (±2% for AAPL, ±5% for GOOGL/NVDA)
2. **Focus on Key Indicators**:
- EPS and Revenue Surprises (all stocks)
- Pre-announcement BOP momentum
- Company-specific financial metrics (profitability metrics for B2B stocks)
3. **Time-Window Optimization**: 2-day trading window for GOOGL/NVDA, 5-day for AAPL
4. **Risk Management**: Set tighter stop-loss for NVDA due to higher volatility
5. **Sentiment Integration**: Use as supplementary signal, particularly for NVDA
#### Technical Recommendations
1. **Model Validation**: Implement out-of-sample testing across diverse market conditions
2. **Ensemble Approaches**: Test combining multiple models for signal generation
3. **Feature Refinement**: Further customize feature importance by stock
4. **Continuous Learning**: Establish monitoring system to adapt to evolving market dynamics
### 👥 Team
Project by Insight Alchemists Team:
- Hemalatha Nagaraj
- Manasa Chilakapati
- Sagar Varma
- Sujith Kumaar K C
- Yuliya Pauzunova