A visually stunning trading dashboard that transforms market data into art. Built with Python, DuckDB, FastAPI, and Svelte.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Python Script │────▶│ DuckDB │◀────│ FastAPI │
│ (simulation) │ │ (storage) │ │ (REST API) │
└─────────────────┘ └─────────────────┘ └────────┬────────┘
│
▼
┌─────────────────┐
│ Svelte Frontend │
│ (visualization) │
└─────────────────┘
# Create virtual environment and install dependencies
uv venv
uv pip install -r requirements.txt
uv run python simulate_data.py
This creates trading.duckdb with:
uvicorn api:app --reload --port 8000
API available at http://localhost:8000
Available Endpoints:
| Endpoint | Description |
|----------|-------------|
| GET /symbols | List all trading symbols |
| GET /exchanges | Get exchange geospatial data |
| GET /ohlcv/{symbol} | Candlestick data for a symbol |
| GET /order-flow | Order flow with optional filters |
| GET /order-flow/aggregated | Volume aggregated by exchange |
| GET /exchange-flow | Capital flow between exchanges |
| GET /market-summary | Overall market statistics |
cd frontend
npm install
npm run dev
Dashboard available at http://localhost:5173
This dashboard embraces "data as art":
trading-dashboard/
├── simulate_data.py # Data generation with GBM price model
├── api.py # FastAPI server
├── trading.duckdb # DuckDB database (generated)
├── requirements.txt # Python dependencies
└── frontend/
├── package.json
├── vite.config.js
├── index.html
└── src/
├── main.js
├── App.svelte
└── components/
├── CandlestickChart.svelte
├── GlobeFlow.svelte
├── OrderPulse.svelte
└── MarketTicker.svelte
Edit SYMBOLS in simulate_data.py:
SYMBOLS = ["AAPL", "GOOGL", "MSFT", "AMZN", "TSLA", "NVDA", "META", "JPM", "YOUR_SYMBOL"]
Edit EXCHANGES in simulate_data.py:
EXCHANGES = [
# ... existing exchanges
{"id": "BSE", "name": "Bombay Stock Exchange", "lat": 18.9311, "lon": 72.8334, "timezone": "Asia/Kolkata", "color": "#FF9933"},
]
CSS variables are defined in App.svelte. Key colors:
#00d4aa#ff4976#0a0a0fuvicorn api:app --host 0.0.0.0 --port 8000 --workers 4
Or with Docker:
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]
cd frontend
npm run build
# Serve the dist/ folder with any static file server
MIT
Built with 🖤 for data artists