|
1 | 1 | ---
|
2 |
| -title: BAZAAR-AI-SAATHI| Your AI Friend in the Stock Market 🤖📈 |
3 |
| -description: Your AI Friend in the Stock Market 🤖📈 |
4 |
| -sidebar_position: 10 |
5 |
| -keywords: [StockAnalysis, AI assistant, Perplexity Sonar,Finance with Perplexity] |
| 2 | +title: BazaarAISaathi | AI-Powered Indian Stock Market Assistant |
| 3 | +description: An AI-powered platform for Indian stock market analysis, portfolio optimization, and investment strategies using Perplexity Sonar API |
| 4 | +sidebar_position: 13 |
| 5 | +keywords: [BazaarAISaathi, stock market, finance, India, portfolio analysis, investment, perplexity, sonar] |
6 | 6 | ---
|
7 | 7 |
|
8 |
| -# Bazaar-AI-Saathi(Specific to Indian Market) |
| 8 | +**BazaarAISaathi** is an AI-powered platform designed to empower investors with actionable insights into the Indian stock market. Leveraging advanced natural language processing, real-time data analytics, and expert-driven financial modeling, the app delivers personalized investment strategies, market sentiment analysis, and portfolio optimization recommendations. |
9 | 9 |
|
10 |
| -BazaarAISaathi is an AI-powered platform designed to empower investors with actionable insights into the Indian stock market. Leveraging advanced natural language processing, real-time data analytics, and expert-driven financial modeling, the app delivers personalized investment strategies, market sentiment analysis, and portfolio optimization recommendations. |
11 |
| -https://github.com/mahanteshimath/BazaarAISaathi/raw/main/src/App_Architecture.jpg |
| 10 | +## Features |
12 | 11 |
|
| 12 | +* **Financial Independence Planner (FIRE)** with personalized plans based on age, salary, and goals |
| 13 | +* **Investment Advice Tester** using EasyOCR for text extraction and AI validation |
| 14 | +* **Fundamental & Technical Analysis** with comprehensive company reports and trading strategies |
| 15 | +* **Portfolio Analysis** with multi-dimensional analysis and stock-wise recommendations |
| 16 | +* **Market Research & Competitor Benchmarking** using AI-driven industry trend analysis |
| 17 | +* **Real-Time Stock Data** with live price tracking and trend analysis |
| 18 | +* **Hypothesis Testing** using historical and real-time market data |
| 19 | +* **Investment Books Summary** with concise summaries of top 50 investment books |
13 | 20 |
|
| 21 | +## Prerequisites |
14 | 22 |
|
15 |
| -## How It Uses the Sonar API |
| 23 | +* Python 3.8+ and pip |
| 24 | +* Streamlit for web application framework |
| 25 | +* Perplexity API key (Sonar models) |
| 26 | +* Optional: EasyOCR for image text extraction |
16 | 27 |
|
17 |
| -Bazaar-AI-Saathi integrates with [Perplexity Sonar Pro](https://docs.perplexity.ai), leveraging advanced features for domain-specific search and rich responses: |
18 |
| -1. **Indian Stock Market** |
| 28 | +## Installation |
19 | 29 |
|
20 |
| - * Examples: “All Listed Stocks”, “Finance with Perplexity”, “Today’s Market” |
21 |
| - * Used for macro analysis, trend detection, market reasoning. |
22 |
| -2. **Stock Analysis** |
| 30 | +```bash |
| 31 | +# Clone the repository |
| 32 | +git clone https://github.com/mahanteshimath/BazaarAISaathi.git |
| 33 | +cd BazaarAISaathi |
23 | 34 |
|
24 |
| - * Examples: “Techno-Funda Analysis”, “Deep Research”, “Tip Tester” |
25 |
| - * LangChain agent uses these to run fundamental/technical analysis and validate tips. |
26 |
| -3. **Portfolio** |
27 |
| - |
28 |
| - * Examples: “Portfolio analysis and Optimization”, “Financial Independence” |
29 |
| - * Models help optimize user portfolios and generate FIRE plans. |
30 |
| - |
31 |
| -Each of these feeds into the **Sonar API models** to get reasoning, analysis, and predictions. |
32 |
| - |
33 |
| -#### 🔸 List of Sonar API Models: |
34 |
| - |
35 |
| -* `sonar-deep-research` |
36 |
| -* `sonar-reasoning-pro` |
37 |
| -* `sonar-reasoning` |
38 |
| -* `sonar-pro` |
39 |
| -* `sonar` |
40 |
| - |
41 |
| -# Links |
42 |
| - |
43 |
| -- Youtube:https://youtu.be/5t2ldWS3SJ8 |
44 |
| -- GitRepo:https://github.com/mahanteshimath/BazaarAISaathi |
45 |
| -- Live App: https://bazaar-ai-saathi.streamlit.app/ |
46 |
| -- Architecture:https://github.com/mahanteshimath/BazaarAISaathi/raw/main/src/App_Architecture.jpg |
47 |
| - |
48 |
| -## Flow daigram |
49 |
| - |
50 |
| -```mermaid |
51 |
| -flowchart TD |
52 |
| - %% User Interface Layer |
53 |
| - subgraph "User Interface Layer" |
54 |
| - direction TB |
55 |
| - Home["Home.py"]:::ui |
56 |
| - Architecture["Architecture.py"]:::ui |
57 |
| - DeepResearch["Deep_Research.py"]:::ui |
58 |
| - RealTimeData["Fetch_real_time_stock_data.py"]:::ui |
59 |
| - AIResearch["Finance_with_Perplexity.py"]:::ui |
60 |
| - FinancialIndependence["Financial_Independence.py"]:::ui |
61 |
| - Hypothesis["Hypothesis.py"]:::ui |
62 |
| - MarketIndicators["Market_Indicators.py"]:::ui |
63 |
| - PortfolioAnalysisPage["Portfolio_Analysis.py"]:::ui |
64 |
| - StocksList["Stocks_List.py"]:::ui |
65 |
| - TechnoFund["Techno_Fund_Analysis.py"]:::ui |
66 |
| - TipTester["Tip_Tester.py"]:::ui |
67 |
| - end |
68 |
| -
|
69 |
| - %% Business Logic Layer |
70 |
| - subgraph "Business Logic Layer" |
71 |
| - direction TB |
72 |
| - RTStock["RealTime_stock_price_analysis.py"]:::logic |
73 |
| - DeepResearchLogic["deep_research.py"]:::logic |
74 |
| - MarketInsights["get_market_insights.py"]:::logic |
75 |
| - FinanceUtils["finance_utils.py"]:::logic |
76 |
| - PortfolioLogic["portfolio_analysis.py"]:::logic |
77 |
| - FIREPlanner["fire_planner.py"]:::logic |
78 |
| - TipAnalysis["tip_analysis.py"]:::logic |
79 |
| - end |
80 |
| -
|
81 |
| - %% Data Layer |
82 |
| - subgraph "Data Layer" |
83 |
| - direction TB |
84 |
| - BSE["BSE_Equity.csv"]:::data |
85 |
| - NSE["NSE_EQUITYS.csv"]:::data |
86 |
| - Holdings["holdings.csv"]:::data |
87 |
| - Books["Top50Books.csv"]:::data |
88 |
| - ArchAsset["Architecture_app.txt"]:::data |
89 |
| - end |
90 |
| -
|
91 |
| - %% External Services |
92 |
| - subgraph "External Services" |
93 |
| - direction TB |
94 |
| - StockAPI["Stock Price API"]:::external |
95 |
| - PerplexityAI["Perplexity AI / LangChain"]:::external |
96 |
| - EasyOCR["EasyOCR / DocParser"]:::external |
97 |
| - StreamlitSecrets["Streamlit Secrets"]:::external |
98 |
| - end |
99 |
| -
|
100 |
| - %% Flows: UI to Logic |
101 |
| - Home -->|navigates to| Architecture |
102 |
| - Home -->|navigates to| DeepResearch |
103 |
| - Home -->|navigates to| RealTimeData |
104 |
| - Home -->|navigates to| AIResearch |
105 |
| - Home -->|navigates to| FinancialIndependence |
106 |
| - Home -->|navigates to| Hypothesis |
107 |
| - Home -->|navigates to| MarketIndicators |
108 |
| - Home -->|navigates to| PortfolioAnalysisPage |
109 |
| - Home -->|navigates to| StocksList |
110 |
| - Home -->|navigates to| TechnoFund |
111 |
| - Home -->|navigates to| TipTester |
112 |
| -
|
113 |
| - RealTimeData -->|calls| RTStock |
114 |
| - DeepResearch -->|calls| DeepResearchLogic |
115 |
| - AIResearch -->|calls| MarketInsights |
116 |
| - PortfolioAnalysisPage -->|calls| PortfolioLogic |
117 |
| - FinancialIndependence -->|calls| FIREPlanner |
118 |
| - Hypothesis -->|calls| FinanceUtils |
119 |
| - MarketIndicators -->|calls| FinanceUtils |
120 |
| - StocksList -->|calls| FinanceUtils |
121 |
| - TechnoFund -->|calls| FinanceUtils |
122 |
| - TipTester -->|calls| TipAnalysis |
123 |
| -
|
124 |
| - %% Logic to Data/External |
125 |
| - RTStock -->|fetches JSON| StockAPI |
126 |
| - RTStock -->|processes data| FinanceUtils |
127 |
| -
|
128 |
| - DeepResearchLogic -->|scrapes & processes| Books |
129 |
| - DeepResearchLogic -->|AI call| PerplexityAI |
130 |
| -
|
131 |
| - MarketInsights -->|sends data| PerplexityAI |
| 35 | +# Install dependencies |
| 36 | +pip install -r requirements.txt |
| 37 | +``` |
132 | 38 |
|
133 |
| - FinanceUtils -->|reads CSV| BSE |
134 |
| - FinanceUtils -->|reads CSV| NSE |
| 39 | +## Configuration |
135 | 40 |
|
136 |
| - PortfolioLogic -->|reads CSV| Holdings |
137 |
| - FIREPlanner -->|reads CSV| Holdings |
| 41 | +Create `secrets.toml` file for Streamlit secrets: |
| 42 | +```ini |
| 43 | +PERPLEXITY_API_KEY = "your_perplexity_api_key" |
| 44 | +# Add other API keys as needed |
| 45 | +``` |
138 | 46 |
|
139 |
| - TipAnalysis -->|OCR image| EasyOCR |
140 |
| - TipAnalysis -->|AI validation| PerplexityAI |
| 47 | +## Usage |
141 | 48 |
|
142 |
| - %% Return flows |
143 |
| - RTStock -->|DataFrame| RealTimeData |
144 |
| - DeepResearchLogic -->|text/DataFrame| DeepResearch |
145 |
| - MarketInsights -->|insights| AIResearch |
146 |
| - FinanceUtils -->|DataFrame| Hypothesis |
147 |
| - FinanceUtils -->|DataFrame| MarketIndicators |
148 |
| - PortfolioLogic -->|analysis| PortfolioAnalysisPage |
149 |
| - FIREPlanner -->|plan| FinancialIndependence |
150 |
| - TipAnalysis -->|result| TipTester |
| 49 | +1. **Start the Application**: |
| 50 | + ```bash |
| 51 | + streamlit run Home.py |
| 52 | + ``` |
151 | 53 |
|
152 |
| - %% Click Events |
153 |
| - click Home "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/Home.py" |
154 |
| - click Architecture "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/pages/Architecture.py" |
155 |
| - click DeepResearch "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/pages/Deep_Research.py" |
156 |
| - click RealTimeData "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/pages/Fetch_real_time_stock_data.py" |
157 |
| - click AIResearch "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/pages/Finance_with_Perplexity.py" |
158 |
| - click FinancialIndependence "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/pages/Financial_Independence.py" |
159 |
| - click Hypothesis "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/pages/Hypothesis.py" |
160 |
| - click MarketIndicators "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/pages/Market_Indicators.py" |
161 |
| - click PortfolioAnalysisPage "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/pages/Portfolio_Analysis.py" |
162 |
| - click StocksList "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/pages/Stocks_List.py" |
163 |
| - click TechnoFund "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/pages/Techno_Fund_Analysis.py" |
164 |
| - click TipTester "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/pages/Tip_Tester.py" |
165 |
| - click RTStock "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/utils/RealTime_stock_price_analysis.py" |
166 |
| - click DeepResearchLogic "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/utils/deep_research.py" |
167 |
| - click MarketInsights "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/utils/get_market_insights.py" |
168 |
| - click FinanceUtils "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/utils/finance_utils.py" |
169 |
| - click PortfolioLogic "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/utils/portfolio_analysis.py" |
170 |
| - click FIREPlanner "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/utils/fire_planner.py" |
171 |
| - click TipAnalysis "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/utils/tip_analysis.py" |
172 |
| - click BSE "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/src/BSE_Equity.csv" |
173 |
| - click NSE "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/src/NSE_EQUITYS.csv" |
174 |
| - click Holdings "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/src/holdings.csv" |
175 |
| - click Books "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/src/Top50Books.csv" |
176 |
| - click ArchAsset "https://github.com/mahanteshimath/bazaaraisaathi/blob/main/src/Architecture_app.txt" |
| 54 | +2. **Access Features**: |
| 55 | + - Navigate through different pages for specific functionality |
| 56 | + - Use the main dashboard for overview and navigation |
| 57 | + - Access specialized tools like portfolio analysis, FIRE planning, and tip testing |
177 | 58 |
|
178 |
| - %% Styles |
179 |
| - classDef ui fill:#cce5ff,stroke:#004085,color:#004085; |
180 |
| - classDef logic fill:#d4edda,stroke:#155724,color:#155724; |
181 |
| - classDef data fill:#ffeeba,stroke:#856404,color:#856404; |
182 |
| - classDef external fill:#d6d8db,stroke:#1b1e21,color:#1b1e21; |
183 |
| -``` |
| 59 | +3. **Run Specific Modules**: |
| 60 | + ```bash |
| 61 | + streamlit run pages/Financial_Independence.py |
| 62 | + streamlit run pages/Portfolio_Analysis.py |
| 63 | + streamlit run pages/Tip_Tester.py |
| 64 | + ``` |
184 | 65 |
|
| 66 | +## Code Explanation |
185 | 67 |
|
186 |
| -## 🚀 Key Features |
187 |
| -- 🧮 **Financial Independence Planner (FIRE):** Create detailed, personalized plans for financial independence using inputs like age, salary, marital status, and more. |
188 |
| -- 📝 **Investment Advice Tester:** Submit investment tips via text or image. The app extracts text (using EasyOCR) and provides AI-driven analysis and validation. |
189 |
| -- 📊 **Fundamental & Technical Analysis:** Access comprehensive reports on company fundamentals, technical indicators, market sentiment, and trading strategies. |
190 |
| -- 📈 **Portfolio Analysis:** Upload or paste your portfolio for in-depth, multi-dimensional analysis and stock-wise recommendations. |
191 |
| -- 🔍 **Market Research & Competitor Benchmarking:** Use AI-driven research to assess industry trends, compare competitors, and identify new opportunities. |
192 |
| -- 📉 **Deep Market Insights:** Stay updated with real-time indicators such as top gainers/losers, macroeconomic trends, and critical market data. |
193 |
| -- ⏱️ **Real-Time Stock Data:** Fetch and analyze live stock prices and trends for informed decision-making. |
194 |
| -- 🧪 **Hypothesis Testing:** Test investment hypotheses using historical and real-time data. |
195 |
| -- 💭 **Ask Finance Questions:** Get expert answers to any finance-related queries using advanced AI technology. |
196 |
| -- 📚 **Investment Books Summary:** Access concise summaries of top 50 investment books for quick learning and reference. |
| 68 | +* **Frontend**: Streamlit web application with interactive pages and real-time data visualization |
| 69 | +* **Backend**: Python-based business logic with Pandas for data manipulation and analysis |
| 70 | +* **AI Integration**: Perplexity Sonar API models (sonar-deep-research, sonar-reasoning-pro, sonar-pro) for financial analysis |
| 71 | +* **Data Processing**: Real-time stock data fetching, CSV data management, and market insights generation |
| 72 | +* **Text Extraction**: EasyOCR integration for processing investment tips from images |
| 73 | +* **Portfolio Management**: Comprehensive portfolio analysis with optimization recommendations |
| 74 | +* **Market Analysis**: Technical and fundamental analysis with sentiment scoring |
197 | 75 |
|
| 76 | +## Demo Video |
198 | 77 |
|
199 |
| -## 🛠️ Technologies Used |
200 |
| -- **Streamlit:** Interactive web app framework. |
201 |
| -- **Perplexity AI & LangChain:** Advanced NLP and financial forecasting. |
202 |
| -- **Pandas, Plotly, BeautifulSoup:** Data manipulation and visualization. |
203 |
| -- **EasyOCR & Docling Parse:** Text extraction from images and PDFs. |
204 |
| -- **Python Ecosystem:** Including requests, python-dotenv, and more. |
| 78 | +<iframe |
| 79 | + className="w-full aspect-video rounded-xl" |
| 80 | + src="https://www.youtube.com/embed/5t2ldWS3SJ8" |
| 81 | + title="YouTube video player" |
| 82 | + frameBorder="0" |
| 83 | + allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" |
| 84 | + allowFullScreen |
| 85 | +></iframe> |
205 | 86 |
|
206 |
| -## ⚡ Installation & Setup |
207 |
| -1. **Clone the Repository:** |
208 |
| - ```powershell |
209 |
| - git clone https://github.com/yourusername/BazaarAISaathi.git |
210 |
| - cd BazaarAISaathi |
211 |
| - ``` |
212 |
| -2. **Install Dependencies:** |
213 |
| - ```powershell |
214 |
| - pip install -r requirements.txt |
215 |
| - ``` |
216 |
| -3. **Configure API Keys:** |
217 |
| - - Set up your Streamlit secrets and API keys (Perplexity, etc.) in a `secrets.toml` file. |
218 |
| -4. **Run the App:** |
219 |
| - ```powershell |
220 |
| - streamlit run Home.py |
221 |
| - ``` |
222 |
| - - Or run any specific module from the `pages/` directory, e.g.: |
223 |
| - ```powershell |
224 |
| - streamlit run pages/Financial_Independence.py |
225 |
| - ``` |
226 |
| - |
227 |
| -## 📁 File Structure |
228 |
| -```plaintext |
229 |
| -├── Home.py |
230 |
| -├── README.md |
231 |
| -├── requirements.txt |
232 |
| -├── pages |
233 |
| -│ ├── Architecture.py |
234 |
| -│ ├── Deep_Research.py |
235 |
| -│ ├── Fetch_real_time_stock_data.py |
236 |
| -│ ├── Finance_with_Perplexity.py |
237 |
| -│ ├── Financial_Independence.py |
238 |
| -│ ├── Hypothesis.py |
239 |
| -│ ├── Market_Indicators.py |
240 |
| -│ ├── Portfolio_Analysis.py |
241 |
| -│ ├── Stocks_List.py |
242 |
| -│ ├── Techno_Fund_Analysis.py |
243 |
| -│ └── Tip_Tester.py |
244 |
| -├── src |
245 |
| -│ ├── Architecture_app.txt |
246 |
| -│ ├── BSE_Equity.csv |
247 |
| -│ ├── holdings.csv |
248 |
| -│ ├── India.jpeg |
249 |
| -│ ├── NSE_EQUITYS.csv |
250 |
| -│ └── Top50Books.csv |
251 |
| -├── utils |
252 |
| -│ ├── deep_research.py |
253 |
| -│ ├── finance_utils.py |
254 |
| -│ ├── fire_planner.py |
255 |
| -│ ├── get_market_insights.py |
256 |
| -│ ├── portfolio_analysis.py |
257 |
| -│ ├── RealTime_stock_price_analysis.py |
258 |
| -│ └── tip_analysis.py |
259 |
| -``` |
| 87 | +## Links |
260 | 88 |
|
261 |
| -## 📬 Contact |
262 |
| -For questions or support, please open an issue or contact the maintainer at < [email protected]>. |
| 89 | +- [GitHub Repository](https://github.com/mahanteshimath/BazaarAISaathi) |
| 90 | +- [Live Application](https://bazaar-ai-saathi.streamlit.app/) |
| 91 | +- [Architecture Diagram](https://github.com/mahanteshimath/BazaarAISaathi/raw/main/src/App_Architecture.jpg) |
0 commit comments