Skip to content

Commit e7d2c8e

Browse files
committed
added smart portfolio
1 parent 9a078cd commit e7d2c8e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2192
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
concurrency:
13+
group: 'pages'
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Set up Node
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 20
26+
cache: 'npm'
27+
- name: Install dependencies
28+
run: npm ci
29+
- name: Build
30+
run: npm run build
31+
- name: Upload artifact
32+
uses: actions/upload-pages-artifact@v3
33+
with:
34+
path: ./dist
35+
36+
deploy:
37+
environment:
38+
name: github-pages
39+
url: ${{ steps.deployment.outputs.page_url }}
40+
runs-on: ubuntu-latest
41+
needs: build
42+
steps:
43+
- name: Deploy to GitHub Pages
44+
id: deployment
45+
uses: actions/deploy-pages@v4

smart-portfolio/AGENTS.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# 🤖 AI Agent System Architecture
2+
3+
The **Smart Portfolio Council** is powered by a multi-agent system where distinct "personalities" work in tandem to optimize your portfolio. Unlike a single AI, this system mimics a real-world hedge fund investment committee.
4+
5+
## 👥 The Agents
6+
7+
### 1. Dr. Sentiment (The Analyst) 📰
8+
* **Role**: Fundamental Analysis & News Monitoring.
9+
* **Behavior**: Scans "news feeds" (simulated) for qualitative data. Excited by growth stories and innovation.
10+
* **Output**: Sentiment signals (Bullish/Bearish).
11+
12+
### 2. Quantos (The Mathematician) 📈
13+
* **Role**: Quantitative Analysis.
14+
* **Behavior**: Ignores news suitable for numbers. Looks at momentum, correlation, and standard deviation.
15+
* **Output**: Hard data metrics and probabilities.
16+
17+
### 3. Guardian (The Risk Manager) 🛡️
18+
* **Role**: Risk Control.
19+
* **Behavior**: Pessimistic by design. Always looks for the downside. Enforces Volatility and Drawdown limits.
20+
* **Output**: "Veto" or "Cap" on exposure.
21+
22+
### 4. The Boss (Portfolio Manager) ⚖️
23+
* **Role**: Decision Maker.
24+
* **Behavior**: Listens to all inputs. Weighs the Analyst's optimism against the Risk Manager's caution.
25+
* **Output**: Final execution triggers (Buy/Sell/Rebalance).
26+
27+
---
28+
29+
## 🔄 How They Work in Tandem (The Workflow)
30+
31+
When you click **"Run Analysis"** (or use Voice Control: *"Start Analysis"*), the following chain reaction occurs:
32+
33+
1. **News Trigger**: **Dr. Sentiment** picks up a market signal (e.g., "Tech sector beating earnings").
34+
2. **Data Validation**: **Quantos** cross-references this with price action. *"Is the price actually moving? Yes, 3-sigma deviation."*
35+
3. **Risk Check**: **Guardian** interrupts. *"Wait, volatility is too high. We need to hedge."*
36+
4. **Eclectic Consensus**: **The Boss** synthesizes this: *"Okay, we buy, but we keep position size small to satisfy Guardian."*
37+
5. **Execution**: The **Auto-Pilot** executes the rebalance in your portfolio.
38+
39+
## 🏆 Why This is a Winning Solution
40+
41+
### 1. The "Glass Box" Paradox
42+
* **The Problem**: Traditional "Robo-Advisors" are black boxes. Users trust them blindly or not at all.
43+
* **Our Solution**: **Transparency as a Feature**. By visualizing the *debate* between agents, we build trust. The user sees the *Reasoning*, not just the *Result*.
44+
45+
### 2. Antifragile Decision Making
46+
* **The Innovation**: Most systems optimize for one variable (e.g., Return). Our "Council" optimizes for **Survival**.
47+
* **How**: The tension between the **Analyst** (Greed) and **Risk Manager** (Fear) creates a balanced, hedge-fund-grade strategy that mimics human institutional checks and balances.
48+
49+
### 3. Event-Driven & Real-Time
50+
* **The Differentiator**: Unlike static rebalancers that run once a quarter, this system is designed to react to **News Events** in real-time (simulated for MVP). It turns Portfolio Management into an active, engaging experience.
51+
52+
## 🚀 Try the Demo
53+
54+
1. Click **"Load Demo"** to populate a sample portfolio.
55+
2. Click **"Run Analysis"** (or say *"Start Analysis"*) in the Agent Council.
56+
3. Watch the **System Audit Log** as the agents debate the best course of action in real-time!

smart-portfolio/DEPLOY.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Deploying Smart Portfolio Rebalancer 🚀
2+
3+
Congratulations on building a cutting-edge AI financial tool! Here is how to deploy it for the hackathon judges.
4+
5+
## Option 1: Vercel (Recommended - Easiest)
6+
Vercel is the creators of Next.js and offers the best Zero-Config deployment for Vite apps.
7+
8+
1. **Create a GitHub Repo**:
9+
- Go to [github.com/new](https://github.com/new).
10+
- Name it `smart-portfolio-ai`.
11+
- Do **NOT** initialize with README/gitignore (we already have them).
12+
- Click **Create repository**.
13+
14+
2. **Push Code**:
15+
Open your terminal in the `smart-portfolio` folder and run:
16+
```bash
17+
git add .
18+
git commit -m "Hackathon Final Build"
19+
git branch -M main
20+
git remote add origin https://github.com/YOUR_USERNAME/smart-portfolio-ai.git
21+
git push -u origin main
22+
```
23+
24+
3. **Deploy on Vercel**:
25+
- Go to [vercel.com/new](https://vercel.com/new).
26+
- Import your `smart-portfolio-ai` repo.
27+
- **Framework Preset**: Vite (Automatic).
28+
- Click **Deploy**.
29+
- 🎉 **Result**: You get a live URL (e.g., `smart-portfolio-ai.vercel.app`) in seconds.
30+
31+
## Option 2: GitHub Pages (Free)
32+
If you prefer to stay purely on GitHub.
33+
34+
1. **Update `vite.config.ts`**:
35+
Add `base: '/smart-portfolio-ai/'` (replace with your repo name) to the config object.
36+
37+
2. **Push Code** (same as above).
38+
39+
3. **Enable Pages**:
40+
- Go to Repo Settings > Pages.
41+
- Source: `GitHub Actions`.
42+
- Use the "Static HTML" workflow.
43+
44+
## Option 3: Manual / Local Presentation
45+
If internet fails, you can run the localized production build:
46+
47+
1. Run `npm run build`.
48+
2. Run `npm run preview`.
49+
3. Open `http://localhost:4173`.
50+
51+
This mimics a real production server locally!
52+
53+
---
54+
**Hackathon Tip**: Use `Option 1` (Vercel). It provides the fastest CDN and best performance for the "Cutting Edge" feel.

smart-portfolio/README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# React + TypeScript + Vite
2+
3+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4+
5+
Currently, two official plugins are available:
6+
7+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9+
10+
## React Compiler
11+
12+
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13+
14+
## Expanding the ESLint configuration
15+
16+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
17+
18+
```js
19+
export default defineConfig([
20+
globalIgnores(['dist']),
21+
{
22+
files: ['**/*.{ts,tsx}'],
23+
extends: [
24+
// Other configs...
25+
26+
// Remove tseslint.configs.recommended and replace with this
27+
tseslint.configs.recommendedTypeChecked,
28+
// Alternatively, use this for stricter rules
29+
tseslint.configs.strictTypeChecked,
30+
// Optionally, add this for stylistic rules
31+
tseslint.configs.stylisticTypeChecked,
32+
33+
// Other configs...
34+
],
35+
languageOptions: {
36+
parserOptions: {
37+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
38+
tsconfigRootDir: import.meta.dirname,
39+
},
40+
// other options...
41+
},
42+
},
43+
])
44+
```
45+
46+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47+
48+
```js
49+
// eslint.config.js
50+
import reactX from 'eslint-plugin-react-x'
51+
import reactDom from 'eslint-plugin-react-dom'
52+
53+
export default defineConfig([
54+
globalIgnores(['dist']),
55+
{
56+
files: ['**/*.{ts,tsx}'],
57+
extends: [
58+
// Other configs...
59+
// Enable lint rules for React
60+
reactX.configs['recommended-typescript'],
61+
// Enable lint rules for React DOM
62+
reactDom.configs.recommended,
63+
],
64+
languageOptions: {
65+
parserOptions: {
66+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
67+
tsconfigRootDir: import.meta.dirname,
68+
},
69+
// other options...
70+
},
71+
},
72+
])
73+
```

smart-portfolio/eslint.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import reactHooks from 'eslint-plugin-react-hooks'
4+
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import tseslint from 'typescript-eslint'
6+
import { defineConfig, globalIgnores } from 'eslint/config'
7+
8+
export default defineConfig([
9+
globalIgnores(['dist']),
10+
{
11+
files: ['**/*.{ts,tsx}'],
12+
extends: [
13+
js.configs.recommended,
14+
tseslint.configs.recommended,
15+
reactHooks.configs.flat.recommended,
16+
reactRefresh.configs.vite,
17+
],
18+
languageOptions: {
19+
ecmaVersion: 2020,
20+
globals: globals.browser,
21+
},
22+
},
23+
])

smart-portfolio/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<link rel="preconnect" href="https://fonts.googleapis.com">
7+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
8+
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap" rel="stylesheet">
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
10+
<title>Smart Portfolio AI</title>
11+
</head>
12+
<body>
13+
<div id="root"></div>
14+
<script type="module" src="/src/main.tsx"></script>
15+
</body>
16+
</html>

smart-portfolio/package.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "smart-portfolio",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc -b && vite build",
9+
"lint": "eslint .",
10+
"preview": "vite preview",
11+
"test": "vitest"
12+
},
13+
"dependencies": {
14+
"clsx": "^2.1.1",
15+
"framer-motion": "^12.34.0",
16+
"lucide-react": "^0.564.0",
17+
"react": "^19.2.0",
18+
"react-dom": "^19.2.0",
19+
"react-resizable-panels": "^4.6.4",
20+
"recharts": "^3.7.0",
21+
"sonner": "^2.0.7",
22+
"tailwind-merge": "^3.4.0",
23+
"zustand": "^5.0.11"
24+
},
25+
"devDependencies": {
26+
"@eslint/js": "^9.39.1",
27+
"@testing-library/dom": "^10.4.1",
28+
"@testing-library/jest-dom": "^6.9.1",
29+
"@testing-library/react": "^16.3.2",
30+
"@types/node": "^24.10.1",
31+
"@types/react": "^19.2.7",
32+
"@types/react-dom": "^19.2.3",
33+
"@vitejs/plugin-react": "^5.1.1",
34+
"autoprefixer": "^10.4.24",
35+
"eslint": "^9.39.1",
36+
"eslint-plugin-react-hooks": "^7.0.1",
37+
"eslint-plugin-react-refresh": "^0.4.24",
38+
"globals": "^16.5.0",
39+
"jsdom": "^28.1.0",
40+
"postcss": "^8.5.6",
41+
"tailwindcss": "^3.4.17",
42+
"typescript": "~5.9.3",
43+
"typescript-eslint": "^8.48.0",
44+
"vite": "^7.3.1",
45+
"vitest": "^4.0.18"
46+
}
47+
}

smart-portfolio/postcss.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}

smart-portfolio/public/vite.svg

Lines changed: 1 addition & 0 deletions
Loading

smart-portfolio/src/App.css

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#root {
2+
max-width: 1280px;
3+
margin: 0 auto;
4+
padding: 2rem;
5+
text-align: center;
6+
}
7+
8+
.logo {
9+
height: 6em;
10+
padding: 1.5em;
11+
will-change: filter;
12+
transition: filter 300ms;
13+
}
14+
.logo:hover {
15+
filter: drop-shadow(0 0 2em #646cffaa);
16+
}
17+
.logo.react:hover {
18+
filter: drop-shadow(0 0 2em #61dafbaa);
19+
}
20+
21+
@keyframes logo-spin {
22+
from {
23+
transform: rotate(0deg);
24+
}
25+
to {
26+
transform: rotate(360deg);
27+
}
28+
}
29+
30+
@media (prefers-reduced-motion: no-preference) {
31+
a:nth-of-type(2) .logo {
32+
animation: logo-spin infinite 20s linear;
33+
}
34+
}
35+
36+
.card {
37+
padding: 2em;
38+
}
39+
40+
.read-the-docs {
41+
color: #888;
42+
}

0 commit comments

Comments
 (0)