mishrabp commited on
Commit
05e71c1
Β·
verified Β·
1 Parent(s): be601cf

Upload folder using huggingface_hub

Browse files
Files changed (5) hide show
  1. README.md +142 -54
  2. pyproject.toml +16 -0
  3. run.py +10 -0
  4. src/market-analyst/README.md +142 -54
  5. uv.lock +0 -0
README.md CHANGED
@@ -1,80 +1,168 @@
1
  ---
2
- title: Market Analyst
3
- emoji: πŸ“ˆ
4
  colorFrom: blue
5
  colorTo: gray
6
- sdk: docker
7
- app_port: 7860
8
- pinned: false
9
  license: mit
10
- short_description: Multi-Agent AI for Real-Time Stock Analysis & Strategy
 
 
 
11
  ---
12
 
13
- # πŸ“ˆ AI Market Analyst
 
 
 
 
 
 
 
 
 
 
 
14
 
15
- A sophisticated **Multi-Agent System** that performs real-time technical and sentimental analysis on stock tickers to generate actionable option trading strategies with high confidence.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  ## πŸš€ Features
18
 
19
- - **🧠 Multi-Agent Swarm**:
20
- - **Market Analyst**: Calculates technicals (SMA 20/50/200, RSI 14) and analyzes trend/momentum.
21
- - **Sentiment Analyst**: Scrapes full news articles and uses **FinBERT** to score sentiment (Bullish/Bearish).
22
- - **Strategy Advisor**: Recommends complex option spreads (Iron Condors, Vertical Spreads) with *specific* legs (Strikes/Expiry).
23
- - **Risk Manager**: Validates trades against a confidence rubric (>70% required) and volatility regime (VIX).
24
- - **πŸ•΅οΈ Deep Sentiment Engine**: Goes beyond headlines by fetching and analyzing the full text of news articles using `BeautifulSoup` and `Transformers` (FinBERT).
25
- - **⚑ High Performance**: Parallelized news fetching for rapid analysis.
26
- - **πŸ›‘οΈ Guardrails**:
27
- - **Market Hours**: Only operates during US Market Open (09:30-16:00 ET) to prevent stale data usage.
28
- - **Type Safety**: Pydantic validation for all data pipelines.
29
- - **Robustness**: Gracefully handles new IPOs or missing data.
30
 
31
- ## πŸ› οΈ Architecture
32
 
33
- ```
34
- src/market-analyst/
35
- β”œβ”€β”€ app.py # Streamlit UI (Orchestrator)
36
- β”œβ”€β”€ aagents/ # Agent Definitions
37
- β”‚ β”œβ”€β”€ market_analyst.py # Technical Analysis Agent
38
- β”‚ β”œβ”€β”€ sentiment_analyst.py# FinBERT Agent
39
- β”‚ β”œβ”€β”€ strategy_advisor.py # Option Strategist
40
- β”‚ └── risk_manager.py # Validator
41
- β”œβ”€β”€ tools/ # Capability Layer
42
- β”‚ β”œβ”€β”€ market_data.py # yfinance, pandas-ta logic (SMA, RSI, Options)
43
- β”‚ └── news_data.py # DDGS, Requests, FinBERT, Pydantic
44
- └── Dockerfile # Deployment Configuration
45
- ```
 
 
 
 
 
 
46
 
47
- ## πŸ“¦ Startup
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  ### Prerequisites
50
- - Python 3.12+
51
- - `uv` package manager (optional but recommended)
52
 
53
- ### Local Run
 
54
 
55
- 1. **Install Dependencies**:
56
- ```bash
57
- pip install -e .
58
- ```
59
 
60
- 2. **Run Application**:
61
- ```bash
62
- streamlit run src/market-analyst/app.py
63
- ```
64
- The app will open at `http://localhost:8501`.
65
 
66
- ## 🐳 Docker / Deployment
67
 
68
- The project is packaged for **Hugging Face Spaces** (Docker SDK).
69
 
70
- ```bash
71
- # Build
72
- docker build -t market-analyst -f src/market-analyst/Dockerfile .
73
 
74
- # Run
 
75
  docker run -p 7860:7860 market-analyst
76
  ```
77
 
78
- ## ⚠️ Disclaimer
 
 
 
 
 
 
 
 
 
79
 
80
- **Educational Use Only**. This tool uses AI to analyze financial data. It is not a certified financial advisor. Do not use for real-money trading.
 
 
1
  ---
2
+ app_port: 7860
 
3
  colorFrom: blue
4
  colorTo: gray
5
+ emoji: πŸ“ˆ
 
 
6
  license: mit
7
+ pinned: false
8
+ sdk: docker
9
+ short_description: Multi-agent AI that recommends stock option spreads
10
+ title: AI Market Analyst --- Real-Time Stock & Options Insights
11
  ---
12
 
13
+ # πŸ“ˆ AI Market Analyst --- From Ticker to Strategy
14
+
15
+ Enter a stock ticker and get **real-time technical analysis, news
16
+ sentiment, and AI-generated option strategies** --- all powered by a
17
+ coordinated **multi-agent system**.
18
+
19
+ Designed for **learning, demos, and research** in agentic finance
20
+ workflows.
21
+
22
+ ------------------------------------------------------------------------
23
+
24
+ ## πŸ‘‰ Try it with these tickers
25
 
26
+ - `AAPL` --- Large-cap, steady trend
27
+ - `TSLA` --- High volatility, news-driven
28
+ - `NVDA` --- Momentum + sentiment play
29
+ - `SPY` --- Market-wide signal
30
+
31
+ ⬆️ Start with one ticker and explore how different agents reason
32
+ together.
33
+
34
+ ------------------------------------------------------------------------
35
+
36
+ ## ✨ Why this Space is different
37
+
38
+ Most market tools show charts.\
39
+ This one **explains the reasoning** behind a strategy.
40
+
41
+ βœ”οΈ Multiple specialized AI agents (not one monolithic model)\
42
+ βœ”οΈ Combines **technicals + sentiment + volatility**\
43
+ βœ”οΈ Generates **structured option strategies**, not vague advice\
44
+ βœ”οΈ Built with strong guardrails to avoid misleading outputs
45
+
46
+ This Space is a **reference implementation** for agentic AI in finance.
47
+
48
+ ------------------------------------------------------------------------
49
 
50
  ## πŸš€ Features
51
 
52
+ ### 🧠 Multi-Agent Swarm
 
 
 
 
 
 
 
 
 
 
53
 
54
+ Each agent has a single responsibility:
55
 
56
+ - **Market Analyst Agent**
57
+ - Computes SMA (20 / 50 / 200), RSI (14)
58
+ - Detects trend, momentum, and regime
59
+ - **Sentiment Analyst Agent**
60
+ - Scrapes full news articles (not just headlines)
61
+ - Uses **FinBERT** to classify sentiment as Bullish / Bearish /
62
+ Neutral
63
+ - **Strategy Advisor Agent**
64
+ - Proposes **option spreads** (Iron Condors, Vertical Spreads)
65
+ - Includes concrete legs: strikes, expiry, and structure
66
+ - **Risk Manager Agent**
67
+ - Validates strategies against:
68
+ - Confidence score (\>70% required)
69
+ - Market volatility (VIX regime)
70
+ - Data completeness
71
+
72
+ ------------------------------------------------------------------------
73
+
74
+ ### πŸ•΅οΈ Deep Sentiment Engine
75
 
76
+ - Fetches **full article text** using `requests` + `BeautifulSoup`
77
+ - Runs transformer-based sentiment analysis (FinBERT)
78
+ - Aggregates sentiment across multiple sources
79
+
80
+ ------------------------------------------------------------------------
81
+
82
+ ### πŸ›‘οΈ Built-in Guardrails
83
+
84
+ - ⏰ **Market Hours Aware**\
85
+ Runs only during US market hours (09:30--16:00 ET)
86
+
87
+ - 🧾 **Type Safety**\
88
+ End-to-end Pydantic validation
89
+
90
+ - 🧯 **Robust by Design**\
91
+ Handles missing data, low-liquidity tickers, and new IPOs gracefully
92
+
93
+ ------------------------------------------------------------------------
94
+
95
+ ## πŸ” How it works (high level)
96
+
97
+ 1. You enter a stock ticker
98
+ 2. Market data is fetched and technical indicators are computed
99
+ 3. News articles are scraped and sentiment-scored
100
+ 4. Strategy Advisor proposes an option structure
101
+ 5. Risk Manager validates or rejects the strategy
102
+ 6. Final output includes **analysis + rationale**
103
+
104
+ ------------------------------------------------------------------------
105
+
106
+ ## πŸ§ͺ Example use cases
107
+
108
+ - Learning **options strategy design**
109
+ - Demonstrating **multi-agent coordination**
110
+ - Building agentic finance prototypes
111
+ - Educational demos (no real-money trading)
112
+
113
+ ------------------------------------------------------------------------
114
+
115
+ ## πŸ”§ Under the hood (for developers)
116
+
117
+ src/market-analyst/
118
+ β”œβ”€β”€ app.py # Streamlit UI (Agent Orchestrator)
119
+ β”œβ”€β”€ aagents/ # Agent definitions
120
+ β”‚ β”œβ”€β”€ market_analyst.py # Technical indicators & trends
121
+ β”‚ β”œβ”€β”€ sentiment_analyst.py# FinBERT sentiment engine
122
+ β”‚ β”œβ”€β”€ strategy_advisor.py # Options strategist
123
+ β”‚ └── risk_manager.py # Trade validator
124
+ β”œβ”€β”€ tools/ # Capability layer
125
+ β”‚ β”œβ”€β”€ market_data.py # yfinance, pandas-ta, options chains
126
+ β”‚ └── news_data.py # DDGS, requests, FinBERT, Pydantic
127
+ └── Dockerfile # HF Spaces deployment
128
+
129
+ ------------------------------------------------------------------------
130
+
131
+ ## ▢️ Run locally
132
 
133
  ### Prerequisites
 
 
134
 
135
+ - Python 3.12+
136
+ - Virtual environment recommended
137
 
138
+ ### Install & run
 
 
 
139
 
140
+ ``` bash
141
+ pip install -e .
142
+ streamlit run src/market-analyst/app.py
143
+ ```
 
144
 
145
+ App runs at: `http://localhost:8501`
146
 
147
+ ------------------------------------------------------------------------
148
 
149
+ ## 🐳 Docker / Hugging Face Spaces
 
 
150
 
151
+ ``` bash
152
+ docker build -t market-analyst -f src/market-analyst/Dockerfile .
153
  docker run -p 7860:7860 market-analyst
154
  ```
155
 
156
+ ------------------------------------------------------------------------
157
+
158
+ ## ⚠️ Financial Disclaimer
159
+
160
+ **Educational use only.**\
161
+ This tool is **not** a financial advisor and does **not** provide
162
+ investment advice.\
163
+ Do **not** use for real-money trading.
164
+
165
+ ------------------------------------------------------------------------
166
 
167
+ πŸ’‘ Like this Space?\
168
+ ⭐ Give it a like Β· πŸ” Duplicate it Β· πŸ’¬ Share feedback
pyproject.toml CHANGED
@@ -33,6 +33,16 @@ dependencies = [
33
  "html2text>=2025.4.15",
34
  "traceloop-sdk>=0.33.0",
35
 
 
 
 
 
 
 
 
 
 
 
36
  # =======================
37
  # VECTOR DB / INDEXING
38
  # =======================
@@ -93,6 +103,12 @@ dependencies = [
93
  "streamlit>=1.51.0",
94
  "reportlab>=4.4.5",
95
  "fastapi",
 
 
 
 
 
 
96
 
97
  # =======================
98
  # AUDIO / VIDEO
 
33
  "html2text>=2025.4.15",
34
  "traceloop-sdk>=0.33.0",
35
 
36
+ # =======================
37
+ # MICROSOFT AGENT FRAMEWORK
38
+ # =======================
39
+ #"agent-framework==1.0.0b251204",
40
+ #"agent-framework-azure-ai==1.0.0b251204",
41
+ #"azure-ai-projects",
42
+ #"azure-ai-agents",
43
+ #"azure-ai-agents>=1.2.0b5",
44
+ #"agent-framework-azure-ai",
45
+
46
  # =======================
47
  # VECTOR DB / INDEXING
48
  # =======================
 
103
  "streamlit>=1.51.0",
104
  "reportlab>=4.4.5",
105
  "fastapi",
106
+ "Pillow",
107
+ "python-docx",
108
+ "matplotlib",
109
+ "fpdf",
110
+ "extra-streamlit-components",
111
+ "nest_asyncio",
112
 
113
  # =======================
114
  # AUDIO / VIDEO
run.py CHANGED
@@ -72,6 +72,16 @@ APP_REGISTRY: Dict[str, Dict[str, str]] = {
72
  "path": "src/market-analyst",
73
  "entry": "app.py",
74
  "description": "Market Analyst - Multi-agent market analysis tool"
 
 
 
 
 
 
 
 
 
 
75
  }
76
  }
77
 
 
72
  "path": "src/market-analyst",
73
  "entry": "app.py",
74
  "description": "Market Analyst - Multi-agent market analysis tool"
75
+ },
76
+ "image": {
77
+ "path": "src/image-generator",
78
+ "entry": "app.py",
79
+ "description": "Image Generator - Multi-agent image generation tool"
80
+ },
81
+ "interview-assistant": {
82
+ "path": "src/interview-assistant",
83
+ "entry": "app.py",
84
+ "description": "Interview Assistant - Multi-agent interview tool"
85
  }
86
  }
87
 
src/market-analyst/README.md CHANGED
@@ -1,80 +1,168 @@
1
  ---
2
- title: Market Analyst
3
- emoji: πŸ“ˆ
4
  colorFrom: blue
5
  colorTo: gray
6
- sdk: docker
7
- app_port: 7860
8
- pinned: false
9
  license: mit
10
- short_description: Multi-Agent AI for Real-Time Stock Analysis & Strategy
 
 
 
11
  ---
12
 
13
- # πŸ“ˆ AI Market Analyst
 
 
 
 
 
 
 
 
 
 
 
14
 
15
- A sophisticated **Multi-Agent System** that performs real-time technical and sentimental analysis on stock tickers to generate actionable option trading strategies with high confidence.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  ## πŸš€ Features
18
 
19
- - **🧠 Multi-Agent Swarm**:
20
- - **Market Analyst**: Calculates technicals (SMA 20/50/200, RSI 14) and analyzes trend/momentum.
21
- - **Sentiment Analyst**: Scrapes full news articles and uses **FinBERT** to score sentiment (Bullish/Bearish).
22
- - **Strategy Advisor**: Recommends complex option spreads (Iron Condors, Vertical Spreads) with *specific* legs (Strikes/Expiry).
23
- - **Risk Manager**: Validates trades against a confidence rubric (>70% required) and volatility regime (VIX).
24
- - **πŸ•΅οΈ Deep Sentiment Engine**: Goes beyond headlines by fetching and analyzing the full text of news articles using `BeautifulSoup` and `Transformers` (FinBERT).
25
- - **⚑ High Performance**: Parallelized news fetching for rapid analysis.
26
- - **πŸ›‘οΈ Guardrails**:
27
- - **Market Hours**: Only operates during US Market Open (09:30-16:00 ET) to prevent stale data usage.
28
- - **Type Safety**: Pydantic validation for all data pipelines.
29
- - **Robustness**: Gracefully handles new IPOs or missing data.
30
 
31
- ## πŸ› οΈ Architecture
32
 
33
- ```
34
- src/market-analyst/
35
- β”œβ”€β”€ app.py # Streamlit UI (Orchestrator)
36
- β”œβ”€β”€ aagents/ # Agent Definitions
37
- β”‚ β”œβ”€β”€ market_analyst.py # Technical Analysis Agent
38
- β”‚ β”œβ”€β”€ sentiment_analyst.py# FinBERT Agent
39
- β”‚ β”œβ”€β”€ strategy_advisor.py # Option Strategist
40
- β”‚ └── risk_manager.py # Validator
41
- β”œβ”€β”€ tools/ # Capability Layer
42
- β”‚ β”œβ”€β”€ market_data.py # yfinance, pandas-ta logic (SMA, RSI, Options)
43
- β”‚ └── news_data.py # DDGS, Requests, FinBERT, Pydantic
44
- └── Dockerfile # Deployment Configuration
45
- ```
 
 
 
 
 
 
46
 
47
- ## πŸ“¦ Startup
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  ### Prerequisites
50
- - Python 3.12+
51
- - `uv` package manager (optional but recommended)
52
 
53
- ### Local Run
 
54
 
55
- 1. **Install Dependencies**:
56
- ```bash
57
- pip install -e .
58
- ```
59
 
60
- 2. **Run Application**:
61
- ```bash
62
- streamlit run src/market-analyst/app.py
63
- ```
64
- The app will open at `http://localhost:8501`.
65
 
66
- ## 🐳 Docker / Deployment
67
 
68
- The project is packaged for **Hugging Face Spaces** (Docker SDK).
69
 
70
- ```bash
71
- # Build
72
- docker build -t market-analyst -f src/market-analyst/Dockerfile .
73
 
74
- # Run
 
75
  docker run -p 7860:7860 market-analyst
76
  ```
77
 
78
- ## ⚠️ Disclaimer
 
 
 
 
 
 
 
 
 
79
 
80
- **Educational Use Only**. This tool uses AI to analyze financial data. It is not a certified financial advisor. Do not use for real-money trading.
 
 
1
  ---
2
+ app_port: 7860
 
3
  colorFrom: blue
4
  colorTo: gray
5
+ emoji: πŸ“ˆ
 
 
6
  license: mit
7
+ pinned: false
8
+ sdk: docker
9
+ short_description: Multi-agent AI that recommends stock option spreads
10
+ title: AI Market Analyst --- Real-Time Stock & Options Insights
11
  ---
12
 
13
+ # πŸ“ˆ AI Market Analyst --- From Ticker to Strategy
14
+
15
+ Enter a stock ticker and get **real-time technical analysis, news
16
+ sentiment, and AI-generated option strategies** --- all powered by a
17
+ coordinated **multi-agent system**.
18
+
19
+ Designed for **learning, demos, and research** in agentic finance
20
+ workflows.
21
+
22
+ ------------------------------------------------------------------------
23
+
24
+ ## πŸ‘‰ Try it with these tickers
25
 
26
+ - `AAPL` --- Large-cap, steady trend
27
+ - `TSLA` --- High volatility, news-driven
28
+ - `NVDA` --- Momentum + sentiment play
29
+ - `SPY` --- Market-wide signal
30
+
31
+ ⬆️ Start with one ticker and explore how different agents reason
32
+ together.
33
+
34
+ ------------------------------------------------------------------------
35
+
36
+ ## ✨ Why this Space is different
37
+
38
+ Most market tools show charts.\
39
+ This one **explains the reasoning** behind a strategy.
40
+
41
+ βœ”οΈ Multiple specialized AI agents (not one monolithic model)\
42
+ βœ”οΈ Combines **technicals + sentiment + volatility**\
43
+ βœ”οΈ Generates **structured option strategies**, not vague advice\
44
+ βœ”οΈ Built with strong guardrails to avoid misleading outputs
45
+
46
+ This Space is a **reference implementation** for agentic AI in finance.
47
+
48
+ ------------------------------------------------------------------------
49
 
50
  ## πŸš€ Features
51
 
52
+ ### 🧠 Multi-Agent Swarm
 
 
 
 
 
 
 
 
 
 
53
 
54
+ Each agent has a single responsibility:
55
 
56
+ - **Market Analyst Agent**
57
+ - Computes SMA (20 / 50 / 200), RSI (14)
58
+ - Detects trend, momentum, and regime
59
+ - **Sentiment Analyst Agent**
60
+ - Scrapes full news articles (not just headlines)
61
+ - Uses **FinBERT** to classify sentiment as Bullish / Bearish /
62
+ Neutral
63
+ - **Strategy Advisor Agent**
64
+ - Proposes **option spreads** (Iron Condors, Vertical Spreads)
65
+ - Includes concrete legs: strikes, expiry, and structure
66
+ - **Risk Manager Agent**
67
+ - Validates strategies against:
68
+ - Confidence score (\>70% required)
69
+ - Market volatility (VIX regime)
70
+ - Data completeness
71
+
72
+ ------------------------------------------------------------------------
73
+
74
+ ### πŸ•΅οΈ Deep Sentiment Engine
75
 
76
+ - Fetches **full article text** using `requests` + `BeautifulSoup`
77
+ - Runs transformer-based sentiment analysis (FinBERT)
78
+ - Aggregates sentiment across multiple sources
79
+
80
+ ------------------------------------------------------------------------
81
+
82
+ ### πŸ›‘οΈ Built-in Guardrails
83
+
84
+ - ⏰ **Market Hours Aware**\
85
+ Runs only during US market hours (09:30--16:00 ET)
86
+
87
+ - 🧾 **Type Safety**\
88
+ End-to-end Pydantic validation
89
+
90
+ - 🧯 **Robust by Design**\
91
+ Handles missing data, low-liquidity tickers, and new IPOs gracefully
92
+
93
+ ------------------------------------------------------------------------
94
+
95
+ ## πŸ” How it works (high level)
96
+
97
+ 1. You enter a stock ticker
98
+ 2. Market data is fetched and technical indicators are computed
99
+ 3. News articles are scraped and sentiment-scored
100
+ 4. Strategy Advisor proposes an option structure
101
+ 5. Risk Manager validates or rejects the strategy
102
+ 6. Final output includes **analysis + rationale**
103
+
104
+ ------------------------------------------------------------------------
105
+
106
+ ## πŸ§ͺ Example use cases
107
+
108
+ - Learning **options strategy design**
109
+ - Demonstrating **multi-agent coordination**
110
+ - Building agentic finance prototypes
111
+ - Educational demos (no real-money trading)
112
+
113
+ ------------------------------------------------------------------------
114
+
115
+ ## πŸ”§ Under the hood (for developers)
116
+
117
+ src/market-analyst/
118
+ β”œβ”€β”€ app.py # Streamlit UI (Agent Orchestrator)
119
+ β”œβ”€β”€ aagents/ # Agent definitions
120
+ β”‚ β”œβ”€β”€ market_analyst.py # Technical indicators & trends
121
+ β”‚ β”œβ”€β”€ sentiment_analyst.py# FinBERT sentiment engine
122
+ β”‚ β”œβ”€β”€ strategy_advisor.py # Options strategist
123
+ β”‚ └── risk_manager.py # Trade validator
124
+ β”œβ”€β”€ tools/ # Capability layer
125
+ β”‚ β”œβ”€β”€ market_data.py # yfinance, pandas-ta, options chains
126
+ β”‚ └── news_data.py # DDGS, requests, FinBERT, Pydantic
127
+ └── Dockerfile # HF Spaces deployment
128
+
129
+ ------------------------------------------------------------------------
130
+
131
+ ## ▢️ Run locally
132
 
133
  ### Prerequisites
 
 
134
 
135
+ - Python 3.12+
136
+ - Virtual environment recommended
137
 
138
+ ### Install & run
 
 
 
139
 
140
+ ``` bash
141
+ pip install -e .
142
+ streamlit run src/market-analyst/app.py
143
+ ```
 
144
 
145
+ App runs at: `http://localhost:8501`
146
 
147
+ ------------------------------------------------------------------------
148
 
149
+ ## 🐳 Docker / Hugging Face Spaces
 
 
150
 
151
+ ``` bash
152
+ docker build -t market-analyst -f src/market-analyst/Dockerfile .
153
  docker run -p 7860:7860 market-analyst
154
  ```
155
 
156
+ ------------------------------------------------------------------------
157
+
158
+ ## ⚠️ Financial Disclaimer
159
+
160
+ **Educational use only.**\
161
+ This tool is **not** a financial advisor and does **not** provide
162
+ investment advice.\
163
+ Do **not** use for real-money trading.
164
+
165
+ ------------------------------------------------------------------------
166
 
167
+ πŸ’‘ Like this Space?\
168
+ ⭐ Give it a like Β· πŸ” Duplicate it Β· πŸ’¬ Share feedback
uv.lock CHANGED
The diff for this file is too large to render. See raw diff