File size: 12,508 Bytes
56fca64 1c53196 9c5db59 56fca64 9e68166 56fca64 1c53196 56fca64 1c53196 9e68166 ceb4a50 376b347 ceb4a50 9e68166 4f9f1c6 1c53196 9e68166 63bcb95 87f7b68 9e68166 63bcb95 9e68166 63bcb95 9e68166 63bcb95 ff350c8 63bcb95 ff350c8 63bcb95 ceb4a50 63bcb95 9e68166 56fca64 9e68166 56fca64 9e68166 56fca64 9e68166 56fca64 9e68166 56fca64 9e68166 56fca64 9e68166 56fca64 9e68166 56fca64 9e68166 56fca64 9e68166 56fca64 9e68166 56fca64 9e68166 56fca64 9e68166 56fca64 9e68166 dceb5f1 56fca64 4a5a37e 9e68166 160a9d0 4a5a37e 56fca64 9e68166 cbba859 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
---
base_model: EleutherAI/gpt-neo-125M
library_name: peft
license: mit
metrics:
- accuracy
- precision
- recall
- f1
- Pattern Detection Rate
- Cross-Entropy Loss
tags:
- finance, IndianStocks, Technical Analysis, Chartless Trading
language:
- en
pipeline_tag: text-generation
---
---
base_model: EleutherAI/gpt-neo-125M
library_name: peft
---
# Model Description
**IndicFinGPT** is a specialized transformer model, re-engineered from **EleutherAI's GPT-Neo-125M** architecture, which is a GPT-3 class architecture, designed specifically for the **Indian financial market**. The model has undergone **retraining on its top layers** to enhance its performance in providing insights into the **top 100 companies listed in the NIFTY50 Index, BSE, and NSE exchanges**.
The primary objective of this model is to **serve the unique needs of Indian stock markets** and **investors engaged in chartless trading**. IndicFinGPT aims to provide insights that could **minimize capital loss and drawdowns** while **maximizing financial ratios** such as the **Sharpe, Sortino, Calmar, Omega, and Treynor Ratios**. Additionally, the model is designed to help in **reducing maximum drawdowns** in financial portfolios, offering a robust AI solution tailored to **India’s dynamic financial landscape**.
## First Indic-Stock Small Language Model Focused Top 100 Companies Listed in NSE and BSE Stock Exchanges
<p align="center">
<img src="https://huggingface.co/bhaskartripathi/GPT_Neo_Market_Analysis/resolve/main/indicBull.JPG" alt="IndicFinGPT Logo" width="400" height="300">
<strong>भारतीय बाजार की शीर्ष 100 कंपनियों का वित्तीय विश्लेषण करने वाला पहला Small Language Model</strong>
</p>
## Training Data and Procedure
**IndicFinGPT 125M** utilizes the **Pile dataset** created by EleutherAI and includes the **top 100 tickers** (by volume and liquidity) from Indian stock markets, covering data from **January 1, 2018, to October 30, 2024**. This dataset encompasses diverse market periods, including **pre-COVID-19 (stable), COVID-19 (volatile), and post-COVID-19 (recovery phase)**. Such comprehensive data exposure allows the model to recognize **problem-solution patterns across various bull and bear runs**.
The training data also incorporates **local influences** such as cultural factors and **market-specific volatility**, enhancing its ability to perform **automated technical analysis** for chartless trading. Key capabilities include identifying **classical chart patterns** using technical analysis, conducting **earnings analysis**, interpreting **market sentiment** from multiple sources, and **assessing risks**, all aimed at **improving decision-making for Indian investors**.
This model weights were obtained after **310 billion tokens over 692,380 steps**. It utilized 4-bit Quantized Low-Rank Adoption (PEFT) method on top of the masked autoregressive language model architecture of Neo, utilizing cross-entropy loss, F1, Accuracy, Precision, recall,Pattern Detection Rate, and Cross-Entropy Loss as performance metrics.
## Key Highlights
1. Trading Patterns: Specialized in recognizing BSE/NSE-specific patterns and cycles
2. Market Sentiment: Built-in understanding of Indian market sentiment and cultural influences
3. Macro-Economic Indicators: Adapted to domestic economic and financial metrics
4. Indian Economic Influences: Awareness of timing, festival impacts, and market-specific volatility
## Implementation
### Quick Start
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("bhaskartripathi/GPT_Neo_Market_Analysis")
tokenizer = AutoTokenizer.from_pretrained("bhaskartripathi/GPT_Neo_Market_Analysis")
input_text = '''[INST] Given the following stock market data and technical analysis:
Stock: EXAMPLE
Date: 2024-01-01
Technical Analysis:
Current Price: ₹100
Daily Range: ₹98 - ₹102
Trading Volume: 1,000,000
RSI: 55
MACD: Bullish
Based on this technical analysis, what is the likely price movement for tomorrow and why? [/INST]'''
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=50)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
```
## Training Details
### Dataset and Fine-tuning
- **Dataset**: Comprehensive dataset featuring 6 years of Indian market data.
- **Method**: Fine-tuned using QLoRA (4-bit quantization) for optimal efficiency.
- **Training Infrastructure**: Utilized an Nvidia T4 GPU, trained for ~6 hours with PEFT framework version 0.13.2.
## Performance Metrics
- **Pattern Recognition**: High accuracy in classical and advanced pattern detection in Indian markets.
- **Sentiment Correlation**: Strong alignment with local market movements.
- **Risk & Volatility Handling**: Reliable risk analysis in volatile market conditions.
## Market Understanding
### Technical Analysis Expertise
The model is adept at identifying crucial market formations including:
- **Classical Patterns**: Head & Shoulders, Double Top/Bottom, Triangle, Flag, Wedge, Cup and Handle.
- **Advanced Techniques**: Local support and resistance levels, volume analysis, and momentum indicators specifically tailored to Indian volatility.
### Market Intelligence
IndicFinGPT includes:
- **Comprehensive Financial Reports**: Analysis of quarterly and annual earnings.
- **Risk Metrics**: Indian-adapted VaR, Beta, and volatility models.
### Cultural Context in Trading
Culturally aware strategies include:
- **Indian Market Timing**: Recommendations tailored to pre-market, regular, and post-market phases.
- **Festival & Cultural Factors**: Insights into events like Diwali (Muhurat Trading), budget announcements, and investor sentiment.
- **FII/DII Flow and Retail Behavior**: Specific guidance considering both institutional and retail dynamics.
## Social Impact
IndicFinGPT democratizes sophisticated AI-based financial analysis for the Indian stock market, providing affordable and accessible tools for both seasoned investors and new traders.
## Core Capabilities
#### Automated Q&A based Technical Analysis for chartless Trading:
Investors, Traders, Economists, Econometricians and Researchers can ask any types of questions related to the below areas:
- **Head and Shoulders patterns**
- What are the implications of a Head and Shoulders pattern forming for Tata Consultancy Services (TCS) in the upcoming week?
- How does the identification of a Head and Shoulders pattern for Reliance Industries influence its potential price movement?
- **Double Top/Bottom patterns**
- What is the expected market behavior for Infosys if a Double Top pattern has formed over the last two weeks?
- How does a Double Bottom pattern in Tata Steel indicate a possible upward trend?
- **Triangle formations**
- What trading opportunities are indicated by a symmetrical triangle formation in Hindustan Unilever?
- How could an ascending triangle in Tata Motors impact its price performance in the coming days?
- **Flag patterns**
- What are the implications of a bullish flag pattern for the stock of Infosys in the short term?
- How can a flag pattern formation in Reliance Industries affect trading strategies for the next three days?
- **Wedge patterns**
- How does a rising wedge pattern in Tata Steel signal a potential market reversal?
- What are the likely outcomes of a falling wedge pattern detected in Tata Consultancy Services (TCS)?
- **Cup and Handle patterns**
- Can you provide an analysis of a Cup and Handle pattern formation in Hindustan Unilever?
- How could a Cup and Handle pattern affect the price movement of Reliance Industries in the coming week?
Earnings Analysis:
- **Key metrics extraction**
- What are the key earnings metrics extracted for Infosys for the latest quarter?
- How do the extracted financial metrics for Tata Motors compare to previous earnings?
- **Historical comparisons**
- How does the historical earnings performance of Tata Consultancy Services (TCS) compare to the current quarter?
- What insights can be gained by comparing historical earnings of Hindustan Unilever over the last three years?
- **Red flag identification**
- Are there any red flags in the latest earnings report of Reliance Industries?
- What potential risks are identified in Tata Steel's financial report?
- **Positive indicator detection**
- What are the positive financial indicators in the latest earnings of Tata Motors?
- How do the positive indicators for Infosys reflect its market position?
Market Sentiment Interpretation:
- **Price-based sentiment analysis**
- How does the recent price movement of Reliance Industries reflect market sentiment?
- What sentiment indicators can be derived from the price fluctuations of Tata Steel?
- **News sentiment analysis**
- How might recent news regarding Tata Consultancy Services (TCS) impact its stock price in the next few days?
- What is the sentiment derived from the latest business news about Hindustan Unilever?
- **Social media sentiment analysis**
- How is social media sentiment trending for Infosys, and what impact could this have on its stock price?
- What does the current social media sentiment indicate about Tata Motors in the upcoming week?
- **Sentiment divergence calculation**
- How does the divergence between price-based sentiment and news sentiment impact the outlook for Tata Consultancy Services (TCS)?
- What are the implications of a sentiment divergence for Reliance Industries over the next few days?
Risk Assessment:
- **Volatility analysis**
- What does the volatility analysis indicate for Tata Steel over the next week?
- How volatile is the stock of Hindustan Unilever in the current market scenario?
- **Beta calculation**
- How does the beta of Tata Motors compare to other companies in the Nifty 50 index?
- What does the beta calculation imply about the risk associated with Infosys?
- **Value at Risk (VaR) computation**
- What is the VaR for Reliance Industries, considering the current market conditions?
- How does the VaR for Tata Consultancy Services (TCS) help in understanding the potential risk in the next three days?
- **Risk rating determination**
- How is the risk rating for Hindustan Unilever determined based on current data?
- What is the risk rating for Tata Steel, and how could it influence trading strategies?
Trading Strategy Recommendations:
- **Pattern-based analysis**
- What are the potential trading opportunities for Reliance Industries based on recent flag or wedge pattern formations in the next week?
- How does the Double Top pattern for Tata Steel indicate a possible trend reversal in the coming days?
- **Sentiment-driven insights**
- How might recent news and social media sentiment affect the stock price of Infosys over the next three days?
- What is the current sentiment regarding Tata Consultancy Services (TCS), and how could it impact its performance over the next week?
- **Risk-adjusted recommendations**
- What are the risk-adjusted trading strategies for Infosys in light of current market volatility?
- Based on beta calculations and current market sentiment, what are the recommended actions for Tata Steel in the coming days?
- **Historical context integration**
- How have similar market conditions in the past affected the performance of Hindustan Unilever, and what can be expected this week?
- Considering past Diwali trading patterns, what is the expected impact on Reliance Industries this year?
## Evaluation Results
#WandB Report: https://wandb.ai/bhaskar-tripathi-indian-institute-of-foreign-trade/indian-market-analysis-system/workspace
<p align="center">
<img src="https://huggingface.co/bhaskartripathi/GPT_Neo_Market_Analysis/resolve/main/eval_results.JPG" alt="IndicFinGPT Logo" width="1024" height="800">
</p>
## Citation
```bibtex
@misc{tripathi2024indicfin,
title={IndicFinGPT: Market Analysis Model for Indian Stocks},
author={Bhaskar Tripathi},
year={2024},
url={https://huggingface.co/bhaskartripathi/GPT_Neo_Market_Analysis}
}
```
## Contact
- **Email**: bhaskar.tripathi@volkswagen.co.in
- **HuggingFace**: [@bhaskartripathi](https://huggingface.co/bhaskartripathi)
- **Google Scholar**: [Profile](https://scholar.google.com/citations?user=SCHOLAR_ID)
- **Github**: [Click Here](https://github.com/bhaskatripathi) |