{"id":26577999,"url":"https://github.com/sujith-da279/quant_financial_analytics","last_synced_at":"2025-03-23T04:18:23.647Z","repository":{"id":283729656,"uuid":"952732125","full_name":"Sujith-DA279/Quant_Financial_Analytics","owner":"Sujith-DA279","description":"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","archived":false,"fork":false,"pushed_at":"2025-03-21T20:00:01.000Z","size":1686,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T20:33:22.827Z","etag":null,"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"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sujith-DA279.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-21T19:28:35.000Z","updated_at":"2025-03-21T20:04:26.000Z","dependencies_parsed_at":"2025-03-21T20:43:42.292Z","dependency_job_id":null,"html_url":"https://github.com/Sujith-DA279/Quant_Financial_Analytics","commit_stats":null,"previous_names":["sujith-da279/quant_financial_analytics"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sujith-DA279%2FQuant_Financial_Analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sujith-DA279%2FQuant_Financial_Analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sujith-DA279%2FQuant_Financial_Analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sujith-DA279%2FQuant_Financial_Analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sujith-DA279","download_url":"https://codeload.github.com/Sujith-DA279/Quant_Financial_Analytics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245052957,"owners_count":20553232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["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"],"created_at":"2025-03-23T04:18:22.961Z","updated_at":"2025-03-23T04:18:23.628Z","avatar_url":"https://github.com/Sujith-DA279.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quantitative Financial Analytics: Decoding Stock Returns Through Earnings, Macro, and Sentiment Analysis\n\n### 📋 Project Brief\n\nThis 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.\n\n### 🎯 Business Objectives\n\nThe analysis addressed key business needs:\n\n- Understanding stock price movements before and after earnings announcements\n- Identifying the impact of key financial metrics on stock performance\n- Analysing macroeconomic influences on earnings outcomes and stock prices\n- Determining the role of news sentiment in market reactions\n\n### Project Overview:\n\u003cdiv\u003e\n  \u003ctable\u003e\n    \u003ctr align=\"center\"\u003e\n      \u003cth align=\"center\"\u003e⏱️ Duration\u003c/th\u003e      \n      \u003cth align=\"center\"\u003e🏆 Grade\u003c/th\u003e\n      \u003cth align=\"center\"\u003e🛠️ Tools\u003c/th\u003e\n      \u003cth align=\"center\"\u003e📊 Datasets\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\"\u003e\u003cb\u003e6 Weeks\u003c/b\u003e\u003c/td\u003e\n      \u003ctd align=\"center\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Python-3776AB?style=for-the-badge\u0026logo=python\u0026logoColor=white\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Pandas-150458?style=for-the-badge\u0026logo=pandas\u0026logoColor=white\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/scikit--learn-F7931E?style=for-the-badge\u0026logo=scikit-learn\u0026logoColor=white\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/finBERT-4169E1?style=for-the-badge\u0026logo=python\u0026logoColor=white\"\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\u003cb\u003e80% (Distinction)\u003cb\u003e\u003c/td\u003e  \n      \u003ctd align=\"center\"\u003e\n         \u003cb\u003e20+ years of stock data\u003cbr\u003e\n         \u003cb\u003e5 macroeconomic indicators\u003cbr\u003e\n         \u003cb\u003e1,423\u003c/b\u003e news articles\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n\u003c/div\u003e\n\n\n### 🔍 Analytical Methodology\n\n#### Data Sources and Collection\n\n| Data Category | Source | Time Period | Key Metrics |\n|---------------|--------|-------------|------------|\n| \u003cb\u003eStock Price Data\u003c/b\u003e | Yahoo Finance API | 2000-2024 | OHLCV (Open, High, Low, Close, Volume) |\n| \u003cb\u003eFinancial Metrics\u003c/b\u003e | Financial Modeling Prep (FMP API) | 2000-2024 | Earnings, Revenue, Key Financial Ratios |\n| \u003cb\u003eMacroeconomic Indicators\u003c/b\u003e | Federal Reserve Economic Data (FRED API) | 2000-2024 | GDP, Inflation, Unemployment, Federal Debt, Treasury Yields |\n| \u003cb\u003eNews Sentiment\u003c/b\u003e | NY Times Articles (Client provided Data) | 2019-2024 | 1,423 articles after cleanup |\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/22065cf7-93c4-424f-8bd0-fd7c733a1e73\" width=\"100%\"/\u003e\n  \u003cp\u003e\u003cem\u003eData Ingestion from Different Opensource APIs\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n#### Feature Engineering\n\nWe created 90+ derived features across the following categories:\n\n| Feature Category | Examples |\n|------------------|----------|\n| \u003cb\u003eStock Metrics\u003c/b\u003e | Daily Returns, Balance of Power (BOP), Pre/Post Announcement Returns, Price Coefficient of Variation |\n| \u003cb\u003eFinancial Indicators\u003c/b\u003e | EPS Surprise, Revenue Surprise, Standardized Surprise Scores, Profit Margins, ROE, ROA |\n| \u003cb\u003eMacro Indicators\u003c/b\u003e | GDP Growth Rates (QoQ/YoY), Federal Debt Change, CPI Changes, Treasury Yield Movements |\n| \u003cb\u003eTemporal Features\u003c/b\u003e | TTM Metrics, QoQ Changes, YoY Growth Rates |\n| \u003cb\u003eSentiment Scores\u003c/b\u003e | FinBERT Composite Scores, Company/Macro Sentiment Classification |\n\n#### Analysis Components\n\n| Analysis Type | Key Methodologies | Analytical Techniques | Outcomes |\n|---------------|-------------------|------------------------|----------|\n| **Earnings Event Analysis** | • Event study framework\u003cbr\u003e• Multiple return windows (1-5 days)\u003cbr\u003e• Cross-sectional surprise analysis | • Winsorization of extreme values\u003cbr\u003e• Segmentation by surprise direction\u003cbr\u003e• Temporal decomposition (2000-2024) | • **2-3 day** optimal reaction window\u003cbr\u003e• **~0.3** correlation between EPS surprise and returns\u003cbr\u003e• Surprise threshold identification |\n| **Macroeconomic Factor Analysis** | • Correlation heatmaps\u003cbr\u003e• Time-series decomposition\u003cbr\u003e• Multi-factor regression\u003cbr\u003e• Company-specific correlations | • Rate-of-change calculations (QoQ, YoY)\u003cbr\u003e• Rolling window correlations\u003cbr\u003e• Comparative macro sensitivity analysis | • Unique company-macro sensitivity maps\u003cbr\u003e• Identified key indicators by company\u003cbr\u003e• Quantified revenue vs. macro impact |\n| **News Sentiment Analysis** | • NLP-based sentiment extraction\u003cbr\u003e• Rule-based article classification\u003cbr\u003e• **5-day** pre/post-publication windows | • **FinBERT** financial sentiment scoring\u003cbr\u003e• Publishing date Event-study • Sentiment-return correlation analysis | • Company-specific sentiment responses\u003cbr\u003e• Negative news recovery patterns\u003cbr\u003e• **Pre/post-earnings** sentiment **drift detection** |\n| **Trading Strategy Development** | • Signal classification (Buy/Sell/Hold)\u003cbr\u003e• Random Forest ensemble modeling\u003cbr\u003e• Multi-factor integration\u003cbr\u003e• Backtesting framework | • Company-specific thresholds\u003cbr\u003e• Hyperparameter optimization\u003cbr\u003e• Feature importance ranking\u003cbr\u003e• Performance metrics calculation | • **6.5-12.7% average return** per trade\u003cbr\u003e• **83-95%** signal precision\u003cbr\u003e• Realized cumulative returns **\u003e20x**\u003cbr\u003e• Feature importance hierarchies |\n\n\n### 🗝️ Key Insights and Results\n\n#### Earnings Analysis\n\n- EPS Surprise positively correlates with post-announcement returns (correlation ~0.3)\n- Market reaction to surprises **strongest within 2-3 days** after announcement\n- **Pre-announcement momentum** (BOP) shows positive correlation with post-announcement returns\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/2895f387-580a-4b58-862e-1cfa8cdfe2ac\" width=\"100%\"/\u003e\n  \u003cp\u003e\u003cem\u003eEPS Surprise vs Post announcement 2-day returns\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n#### Macroeconomic Analysis\n\nEach company showed unique macro sensitivity profiles:\n\n| Company | Primary Macro Correlations |\n|---------|----------------------------|\n| **Apple**   | Federal Debt, Real GDP     |\n| **Google**  | Real GDP, CPI, Treasury Yields |\n| **Nvidia**  | Real GDP, Treasury Yields, Unemployment |\n\n**Revenue growth** consistently showed **stronger impact** on returns *than* **macroeconomic factors** for these high-growth tech companies.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/e39cf5b8-40bc-4a7e-8eeb-88b00dc79f0f\" width=\"100%\"/\u003e\n  \u003cp\u003e\u003cem\u003eCombined Correlation Heatmap - Returns vs Revenue and Macro factors\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n#### Sentiment Analysis\n\nNews sentiment analysis revealed distinct patterns:\n\n| Company | Sentiment Response Pattern |\n|---------|----------------------------|\n| **Apple**   | Recovers from negative news within 3 days; positive drift otherwise (~1% in 5 days) |\n| **Google**  | Most stable to sentiment (returns within 1% window); acts as safe-haven during macro uncertainty |\n| **Nvidia**  | Highest sentiment sensitivity (±2-3% fluctuations); strong positive reaction to macro negativity |\n\nPre-earnings sentiment shows consistent optimistic bias with post-announcement sentiment typically declining.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/e07f3ac3-7384-4015-8b07-8a0c00556073\" width=\"100%\"/\u003e\n  \u003cp\u003e\u003cem\u003eExample of Event Study Analysis chart - Apple for Stock sentiment\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/6e251f3f-b42d-4d4f-a010-e45109d17e88\" width=\"100%\"/\u003e\n  \u003cp\u003e\u003cem\u003eSentiment and Stock-price Trend around Earnings Announcements\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n#### Trading Strategy Performance\n\n| Company | Avg. Return per Deal | Max Drawdown | Cumulative Return | Precision |\n|---------|---------------------|--------------|-------------------|-----------|\n| AAPL    | 6.5%                | -14.8%       | \u003e20x (51 periods) | 83.3%     |\n| GOOGL   | 8.0%                | 0.0%         | \u003e20x (39 periods) | 95.0%     |\n| NVDA    | 12.7%               | -6.9%        | ~700% (39 periods)| 88.9%     |\n\n\n### 🛠️ Technical Implementation\n\nThe analysis was implemented using:\n\n- **Data Processing**: Pandas, NumPy\n- **Machine Learning**: Scikit-learn,StatsModels,\n- **ML Models**: RandomForest, OLS, Binary and Multinomial Logistic Regression\n- **NLP**: FinBERT, TextBlob\n- **Visualization**: Matplotlib, Seaborn\n\n### 📊 Recommendations\n\n#### Trading Strategy Recommendations\n\n1. **Implement Stock-Specific Models**: Different threshold parameters for each stock (±2% for AAPL, ±5% for GOOGL/NVDA)\n2. **Focus on Key Indicators**: \n   - EPS and Revenue Surprises (all stocks)\n   - Pre-announcement BOP momentum\n   - Company-specific financial metrics (profitability metrics for B2B stocks)\n3. **Time-Window Optimization**: 2-day trading window for GOOGL/NVDA, 5-day for AAPL\n4. **Risk Management**: Set tighter stop-loss for NVDA due to higher volatility\n5. **Sentiment Integration**: Use as supplementary signal, particularly for NVDA\n\n#### Technical Recommendations\n\n1. **Model Validation**: Implement out-of-sample testing across diverse market conditions\n2. **Ensemble Approaches**: Test combining multiple models for signal generation\n3. **Feature Refinement**: Further customize feature importance by stock\n4. **Continuous Learning**: Establish monitoring system to adapt to evolving market dynamics\n\n### 👥 Team\n\nProject by Insight Alchemists Team:\n- Hemalatha Nagaraj\n- Manasa Chilakapati\n- Sagar Varma\n- Sujith Kumaar K C\n- Yuliya Pauzunova\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsujith-da279%2Fquant_financial_analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsujith-da279%2Fquant_financial_analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsujith-da279%2Fquant_financial_analytics/lists"}