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