Update README.md
Browse files
README.md
CHANGED
|
@@ -1,316 +1,11 @@
|
|
| 1 |
-
<div align="center">
|
| 2 |
-
|
| 3 |
-
<img src="docs/assets/logo.png" alt="Wallstreet-AI Logo" />
|
| 4 |
-
|
| 5 |
-
# Wallstreet-AI
|
| 6 |
-
|
| 7 |
-
**An agentic financial analysis assistant powered by legendary investor personas.**
|
| 8 |
-
|
| 9 |
-
Combine the investment philosophies of Warren Buffett, Charlie Munger, and other market legends with a structured AI pipeline β delivering SWOT analyses, technical reports, earnings breakdowns, and more, all streamed in real time.
|
| 10 |
-
|
| 11 |
-
[](https://www.python.org/)
|
| 12 |
-
[](https://fastapi.tiangolo.com/)
|
| 13 |
-
[](https://gradio.app/)
|
| 14 |
-
[](https://platform.openai.com/)
|
| 15 |
-
|
| 16 |
-
[](https://deepwiki.com/davidkim205/wallstreet-ai)
|
| 17 |
-
|
| 18 |
-
[](https://colab.research.google.com/drive/1GUbw0Ef0bJQfkddrDNCuvADXG3ujxo9H)
|
| 19 |
-
[](https://huggingface.co/spaces/davidkim205/wallstreet-ai)
|
| 20 |
-
|
| 21 |
-
<p align="center">
|
| 22 |
-
<a href="README.md">πΊπΈ English</a> |
|
| 23 |
-
<a href="README_KR.md">π°π· νκ΅μ΄</a>
|
| 24 |
-
</p>
|
| 25 |
-
</div>
|
| 26 |
-
|
| 27 |
---
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
-
|
| 38 |
-
|
| 39 |
-
---
|
| 40 |
-
|
| 41 |
-
## What is Wallstreet-AI?
|
| 42 |
-
|
| 43 |
-
Wallstreet-AI turns a plain-language question like *"What would Warren Buffett think of Apple's latest earnings?"* into a fully structured analysis pipeline:
|
| 44 |
-
|
| 45 |
-
1. **Intent parsing** β extracts ticker, analysis type, time period, and earnings quarter from your question
|
| 46 |
-
2. **Tool routing** β selects only the data sources required for that analysis type
|
| 47 |
-
3. **Data collection** β fetches prices, fundamentals, technicals, earnings, and news via `yfinance` and Google News RSS
|
| 48 |
-
4. **News enrichment** β scrapes article bodies to build real-time news context
|
| 49 |
-
5. **LLM generation** β streams a tailored report through the OpenAI Responses API
|
| 50 |
-
6. **Result storage** β saves every analysis and persona to JSONL for later review
|
| 51 |
-
|
| 52 |
-
You can apply an investor persona at any stage. The same underlying data produces a completely different report depending on whether you view it through a value-investing lens or a growth-focused one.
|
| 53 |
-
|
| 54 |
-
---
|
| 55 |
-
|
| 56 |
-
## Demo
|
| 57 |
-
|
| 58 |
-
### Streaming stock analysis
|
| 59 |
-
|
| 60 |
-

|
| 61 |
-
|
| 62 |
-
### Persona generation
|
| 63 |
-
|
| 64 |
-
)
|
| 65 |
-
|
| 66 |
-
---
|
| 67 |
-
|
| 68 |
-
## Key Features
|
| 69 |
-
|
| 70 |
-
| Feature | Details |
|
| 71 |
-
|---|---|
|
| 72 |
-
| **Natural-language intent parsing** | Extracts ticker, analysis type, period, and year/quarter automatically |
|
| 73 |
-
| **7 analysis report types** | General Β· Technical Β· Fundamental Β· Earnings Β· SWOT Β· News summary Β· Comparative |
|
| 74 |
-
| **Investor personas** | Warren Buffett, Charlie Munger, and any figure you define β tone and reasoning style adapt to the persona |
|
| 75 |
-
| **Technical indicators** | RSI, MACD, moving averages (SMA/EMA), Bollinger Bands |
|
| 76 |
-
| **Real-time news context** | Google News RSS + `trafilatura` article body extraction |
|
| 77 |
-
| **SSE streaming** | Token-by-token response streaming via FastAPI Server-Sent Events |
|
| 78 |
-
| **Three entry points** | CLI Β· FastAPI REST API Β· Gradio web UI |
|
| 79 |
-
| **JSONL logging** | All analyses and personas persisted for reproducibility |
|
| 80 |
-
|
| 81 |
-
---
|
| 82 |
-
|
| 83 |
-
## Quick Start
|
| 84 |
-
|
| 85 |
-
> Requires Python 3.10+ and an OpenAI API key.
|
| 86 |
-
|
| 87 |
-
```bash
|
| 88 |
-
# 1. Clone and enter the repo
|
| 89 |
-
git clone https://github.com/davidkim205/wallstreet-ai-ai.git
|
| 90 |
-
cd wallstreet-ai
|
| 91 |
-
|
| 92 |
-
# 2. Create a virtual environment
|
| 93 |
-
uv venv
|
| 94 |
-
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
| 95 |
-
|
| 96 |
-
# 3. Install dependencies
|
| 97 |
-
uv pip install -r requirements.txt
|
| 98 |
-
|
| 99 |
-
# 4. Set up environment variables
|
| 100 |
-
cp .env.example .env
|
| 101 |
-
# Open .env and add your LLM_MODEL_API_KEY
|
| 102 |
-
|
| 103 |
-
# 5a. Run the FastAPI server (for web UI or API access)
|
| 104 |
-
uvicorn api_server:app --reload
|
| 105 |
-
|
| 106 |
-
# 5b. In a second terminal, launch the Gradio UI
|
| 107 |
-
python gradio_app.py --api-url http://127.0.0.1:8000/analyze/
|
| 108 |
-
```
|
| 109 |
-
|
| 110 |
-
Then open your browser at `http://localhost:7860` and ask anything:
|
| 111 |
-
|
| 112 |
-
> *"Give me a Warren Buffett-style fundamental analysis of Microsoft for the last 2 years"*
|
| 113 |
-
|
| 114 |
-
To use the CLI only, skip step 5a and run `python pipeline.py` directly.
|
| 115 |
-
|
| 116 |
-
---
|
| 117 |
-
## Online Demo
|
| 118 |
-
|
| 119 |
-
You can try Wallstreet-AI instantly without installing anything.<br>
|
| 120 |
-
Click the platform name to open.
|
| 121 |
-
|
| 122 |
-
| Platform | Description |
|
| 123 |
-
|---|---|
|
| 124 |
-
| [**Google Colab**](https://colab.research.google.com/drive/1GUbw0Ef0bJQfkddrDNCuvADXG3ujxo9H) | Run the full pipeline in a hosted notebook.<br> Installs the GitHub repo and allows interactive testing. |
|
| 125 |
-
| [**HuggingFace Spaces**](https://huggingface.co/spaces/davidkim205/wallstreet-ai) | Live web demo similar to Gradio UI for quick experimentation. |
|
| 126 |
-
|
| 127 |
-
---
|
| 128 |
-
|
| 129 |
-
## Installation
|
| 130 |
-
|
| 131 |
-
### Python environment
|
| 132 |
-
|
| 133 |
-
Python 3.10 or later is recommended. Using `uv` is strongly advised for faster installs:
|
| 134 |
-
|
| 135 |
-
```bash
|
| 136 |
-
uv venv
|
| 137 |
-
source .venv/bin/activate
|
| 138 |
-
uv pip install -r requirements.txt
|
| 139 |
-
```
|
| 140 |
-
|
| 141 |
-
### Environment variables
|
| 142 |
-
|
| 143 |
-
```bash
|
| 144 |
-
cp .env.example .env
|
| 145 |
-
```
|
| 146 |
-
|
| 147 |
-
Edit `.env` with your credentials:
|
| 148 |
-
|
| 149 |
-
```env
|
| 150 |
-
LLM_MODEL_NAME=gpt-4o-mini
|
| 151 |
-
LLM_MODEL_API_KEY=<your OpenAI API key>
|
| 152 |
-
LOG_FILE=analysis_results.jsonl
|
| 153 |
-
PERSONA_FILE=persona.jsonl
|
| 154 |
-
```
|
| 155 |
-
|
| 156 |
-
| Variable | Description |
|
| 157 |
-
|---|---|
|
| 158 |
-
| `LLM_MODEL_NAME` | Model name passed to the OpenAI client |
|
| 159 |
-
| `LLM_MODEL_API_KEY` | OpenAI API key (falls back to `OPENAI_API_KEY` if unset) |
|
| 160 |
-
| `LOG_FILE` | Path for analysis result logs (JSONL) |
|
| 161 |
-
| `PERSONA_FILE` | Path for saved investor personas (JSONL) |
|
| 162 |
-
|
| 163 |
-
---
|
| 164 |
-
|
| 165 |
-
## How to Run
|
| 166 |
-
|
| 167 |
-
### CLI
|
| 168 |
-
|
| 169 |
-
```bash
|
| 170 |
-
python pipeline.py
|
| 171 |
-
```
|
| 172 |
-
|
| 173 |
-
At startup the CLI lists saved personas. Enter a persona number to apply it, or press Enter to skip. After entering your question the pipeline runs and prints the full report plus a data summary.
|
| 174 |
-
|
| 175 |
-
Exit with `exit`, `quit`, or `μ’
λ£`.
|
| 176 |
-
|
| 177 |
-
### FastAPI server
|
| 178 |
-
|
| 179 |
-
```bash
|
| 180 |
-
uvicorn api_server:app --reload
|
| 181 |
-
```
|
| 182 |
-
|
| 183 |
-
Starts at `http://127.0.0.1:8000`. Available endpoints:
|
| 184 |
-
|
| 185 |
-
| Method | Endpoint | Description |
|
| 186 |
-
|---|---|---|
|
| 187 |
-
| `POST` | `/analyze/` | Run a full analysis (streaming or batch) |
|
| 188 |
-
| `POST` | `/persona/` | Generate and save a new investor persona |
|
| 189 |
-
|
| 190 |
-
### Gradio UI
|
| 191 |
-
|
| 192 |
-
Start the FastAPI server first, then:
|
| 193 |
-
|
| 194 |
-
```bash
|
| 195 |
-
python gradio_app.py --api-url http://127.0.0.1:8000/analyze/
|
| 196 |
-
```
|
| 197 |
-
|
| 198 |
-
Default binding: `0.0.0.0:7860`
|
| 199 |
-
|
| 200 |
-
| Option | Description |
|
| 201 |
-
|---|---|
|
| 202 |
-
| `--api-url` | SSE endpoint for the analysis pipeline |
|
| 203 |
-
| `--port` | Gradio server port |
|
| 204 |
-
| `--server-name` | Binding address |
|
| 205 |
-
| `--share` | Generate a public Gradio share link |
|
| 206 |
-
|
| 207 |
-
The UI has three tabs: **Ask a Question**, **Create a Persona**, and **Investor Profile**.
|
| 208 |
-
|
| 209 |
-
---
|
| 210 |
-
|
| 211 |
-
## API Reference
|
| 212 |
-
|
| 213 |
-
### Analysis β batch mode
|
| 214 |
-
|
| 215 |
-
```bash
|
| 216 |
-
curl -X POST "http://127.0.0.1:8000/analyze/" \
|
| 217 |
-
-H "Content-Type: application/json" \
|
| 218 |
-
-d '{
|
| 219 |
-
"query": "Summarize AAPL recent earnings and key investment points",
|
| 220 |
-
"stream": false
|
| 221 |
-
}'
|
| 222 |
-
```
|
| 223 |
-
|
| 224 |
-
Response:
|
| 225 |
-
|
| 226 |
-
```json
|
| 227 |
-
{
|
| 228 |
-
"type": "result",
|
| 229 |
-
"query": "Summarize AAPL recent earnings and key investment points",
|
| 230 |
-
"ticker": "AAPL",
|
| 231 |
-
"analysis_type": "earnings",
|
| 232 |
-
"data_context": {},
|
| 233 |
-
"llm_response": "...",
|
| 234 |
-
"timestamp": "2026-03-30 10:00:00",
|
| 235 |
-
"stdout": "..."
|
| 236 |
-
}
|
| 237 |
-
```
|
| 238 |
-
|
| 239 |
-
### Analysis β streaming mode
|
| 240 |
-
|
| 241 |
-
```bash
|
| 242 |
-
curl -N -X POST "http://127.0.0.1:8000/analyze/" \
|
| 243 |
-
-H "Content-Type: application/json" \
|
| 244 |
-
-d '{"query": "Summarize AAPL recent earnings", "stream": true}'
|
| 245 |
-
```
|
| 246 |
-
|
| 247 |
-
SSE event sequence:
|
| 248 |
-
|
| 249 |
-
```
|
| 250 |
-
data: {"type":"status","message":"Parsing intent..."}
|
| 251 |
-
data: {"type":"stdout","message":"[β’] Collecting data (ticker=AAPL, period=1y)..."}
|
| 252 |
-
data: {"type":"delta","delta":"Apple's most recent quarter shows margin expansion..."}
|
| 253 |
-
data: {"type":"result","ticker":"AAPL","analysis_type":"earnings", ...}
|
| 254 |
-
data: {"type":"done"}
|
| 255 |
-
```
|
| 256 |
-
|
| 257 |
-
| Event type | Meaning |
|
| 258 |
-
|---|---|
|
| 259 |
-
| `status` | High-level pipeline progress |
|
| 260 |
-
| `stdout` | Server-side log lines |
|
| 261 |
-
| `delta` | Incremental model output tokens |
|
| 262 |
-
| `result` | Final structured payload |
|
| 263 |
-
| `done` | Stream complete |
|
| 264 |
-
|
| 265 |
-
### Analysis with a persona
|
| 266 |
-
|
| 267 |
-
```bash
|
| 268 |
-
curl -X POST "http://127.0.0.1:8000/analyze/" \
|
| 269 |
-
-H "Content-Type: application/json" \
|
| 270 |
-
-d '{
|
| 271 |
-
"query": "SWOT analysis of Samsung Electronics",
|
| 272 |
-
"stream": false,
|
| 273 |
-
"persona_name": "Warren Buffett"
|
| 274 |
-
}'
|
| 275 |
-
```
|
| 276 |
-
|
| 277 |
-
### Create a persona
|
| 278 |
-
|
| 279 |
-
```bash
|
| 280 |
-
curl -X POST "http://127.0.0.1:8000/persona/" \
|
| 281 |
-
-H "Content-Type: application/json" \
|
| 282 |
-
-d '{"info": "Warren Buffett"}'
|
| 283 |
-
```
|
| 284 |
-
|
| 285 |
-
---
|
| 286 |
-
|
| 287 |
-
## Persona System
|
| 288 |
-
|
| 289 |
-
The persona system rewrites the analysis prompt to reflect a specific investor's voice and reasoning style. When a persona is active, the model receives:
|
| 290 |
-
|
| 291 |
-
- A summary of the figure's background and track record
|
| 292 |
-
- Their core financial mindset and mental models
|
| 293 |
-
- Their preferred data analysis style (e.g. DCF-focused vs. narrative-focused)
|
| 294 |
-
- Their typical response tone and vocabulary
|
| 295 |
-
- Core investment principles
|
| 296 |
-
- Representative quotes
|
| 297 |
-
|
| 298 |
-
---
|
| 299 |
-
|
| 300 |
-
## Contributing
|
| 301 |
-
|
| 302 |
-
Contributions are welcome. Please open an issue first to discuss significant changes. For small fixes, a pull request with a clear description is sufficient.
|
| 303 |
-
|
| 304 |
-
---
|
| 305 |
-
|
| 306 |
-
## License
|
| 307 |
-
|
| 308 |
-
See [LICENSE](LICENSE) for details.
|
| 309 |
-
|
| 310 |
-
---
|
| 311 |
-
|
| 312 |
-
<div align="center">
|
| 313 |
-
|
| 314 |
-
*Ask any stock question. Get an answer that thinks like the greats.*
|
| 315 |
-
|
| 316 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Wallstreet Ai Test
|
| 3 |
+
emoji: π
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: "4.44.1"
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
short_description: test ask q
|
| 11 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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