Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .claude/commands/doc-review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Review the documentation file in the planning folder called $ARGUMENTS and add questions, clarifications or feedback to a new section at the end, along with any opportunities to simplify.
4 changes: 3 additions & 1 deletion .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"enabledPlugins": {
"frontend-design@claude-plugins-official": true,
"context7@claude-plugins-official": true,
"playwright@claude-plugins-official": true
"playwright@claude-plugins-official": true,
"independent-reviewer@Wayne-Tools": true,
"code-simplifier@claude-plugins-official": true
}
}
11 changes: 11 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"permissions": {
"allow": [
"WebSearch",
"WebFetch(domain:polygon.io)",
"WebFetch(domain:massive.com)",
"Bash(codex exec:*)",
"Skill(update-config)"
]
}
}
78 changes: 40 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,64 @@
# FinAlly — AI Trading Workstation

A visually stunning AI-powered trading workstation that streams live market data, simulates portfolio trading, and integrates an LLM chat assistant that can analyze positions and execute trades via natural language.

Built entirely by coding agents as a capstone project for an agentic AI coding course.
A visually striking AI-powered trading workstation with live market data, simulated portfolio management, and an LLM chat assistant that can analyze positions and execute trades. Looks and feels like a Bloomberg terminal with an AI copilot.

## Features

- **Live price streaming** via SSE with green/red flash animations
- **Simulated portfolio** — $10k virtual cash, market orders, instant fills
- **Portfolio visualizations** — heatmap (treemap), P&L chart, positions table
- **AI chat assistant** — analyzes holdings, suggests and auto-executes trades
- **Watchlist management** — track tickers manually or via AI
- **Dark terminal aesthetic** — Bloomberg-inspired, data-dense layout

## Architecture

Single Docker container serving everything on port 8000:

- **Frontend**: Next.js (static export) with TypeScript and Tailwind CSS
- **Backend**: FastAPI (Python/uv) with SSE streaming
- **Database**: SQLite with lazy initialization
- **AI**: LiteLLM → OpenRouter (Cerebras inference) with structured outputs
- **Market data**: Built-in GBM simulator (default) or Massive API (optional)
- Live streaming prices with green/red flash animations
- Sparkline mini-charts built from the SSE stream
- $10,000 virtual cash to trade with (market orders, instant fill)
- Portfolio heatmap (treemap) and P&L chart
- AI chat assistant — ask questions, get analysis, execute trades via natural language

## Quick Start

```bash
# Clone and configure
# Copy and fill in your API key
cp .env.example .env
# Add your OPENROUTER_API_KEY to .env

# Run with Docker
docker build -t finally .
docker run -v finally-data:/app/db -p 8000:8000 --env-file .env finally
# Start (macOS/Linux)
./scripts/start_mac.sh

# Open http://localhost:8000
# Start (Windows PowerShell)
./scripts/start_windows.ps1
```

Open [http://localhost:8000](http://localhost:8000).

## Environment Variables

| Variable | Required | Description |
|---|---|---|
| `OPENROUTER_API_KEY` | Yes | OpenRouter API key for AI chat |
| `MASSIVE_API_KEY` | No | Massive (Polygon.io) key for real market data; omit to use simulator |
| `OPENROUTER_API_KEY` | Yes | OpenRouter key for LLM chat |
| `MASSIVE_API_KEY` | No | Polygon.io key for real market data (simulator used if absent) |
| `LLM_MOCK` | No | Set `true` for deterministic mock LLM responses (testing) |

## Project Structure
## Architecture

Single Docker container on port 8000:

- **Frontend**: Next.js (TypeScript), built as a static export, served by FastAPI
- **Backend**: FastAPI (Python/uv)
- **Database**: SQLite, volume-mounted at `db/finally.db`
- **Real-time**: Server-Sent Events (SSE) for price streaming
- **AI**: LiteLLM → OpenRouter (Cerebras inference) with structured outputs

## Development

```bash
# Backend
cd backend && uv sync --extra dev
uv run pytest -v

# Frontend
cd frontend && npm install
npm run dev
```
finally/
├── frontend/ # Next.js static export
├── backend/ # FastAPI uv project
├── planning/ # Project documentation and agent contracts
├── test/ # Playwright E2E tests
├── db/ # SQLite volume mount (runtime)
└── scripts/ # Start/stop helpers
```

## License
## Testing

E2E tests use Playwright with `LLM_MOCK=true`:

See [LICENSE](LICENSE).
```bash
cd test && docker compose -f docker-compose.test.yml up
```
5 changes: 5 additions & 0 deletions independent-reviewer/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "independent-reviewer",
"description": "Carry out an independent review of all changes since last commit",
"version": "1.0.0"
}
15 changes: 15 additions & 0 deletions independent-reviewer/hooks/hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "codex exec \"Review changes since last commit and write changes to planning/REVIEW.md\""
}
]
}
]
}
}

104 changes: 0 additions & 104 deletions planning/MARKET_DATA_SUMMARY.md

This file was deleted.

Loading