--- 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: question-answering --- --- 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

IndicFinGPT Logo भारतीय बाजार की शीर्ष 100 कंपनियों का वित्तीय विश्लेषण करने वाला पहला Small Language Model

## 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

IndicFinGPT Logo

## 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)