No description
| .vscode | ||
| apps | ||
| database/postgres/init | ||
| docs | ||
| monitoring | ||
| packages | ||
| scripts | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| bun.lock | ||
| docker-compose.dev.yml | ||
| docker-compose.yml | ||
| DOCKER.md | ||
| package.json | ||
| README.md | ||
| SETUP-COMPLETE.md | ||
| turbo.json | ||
🤖 Stock Bot Trading System
A comprehensive trading bot built with Bun and Turborepo, featuring a service-oriented architecture for real-time market data processing and strategy execution.
🚀 Quick Start
Prerequisites
- Bun runtime
- Node.js 18+ (for compatibility)
Installation
# Clone and install dependencies
git clone <your-repo-url>
cd stock-bot
bun install
Running the System
Option 1: VS Code Tasks (Recommended)
- Open the project in VS Code
- Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Type "Tasks: Run Task" and select it
- Choose "Start All Services"
Option 2: Manual Startup
# Terminal 1: Start Market Data Gateway
cd apps/core-services/market-data-gateway
bun run dev
# Terminal 2: Start Trading Dashboard
cd apps/interface-services/trading-dashboard
bun run dev
Access Points
- Trading Dashboard: http://localhost:5173
- Market Data API: http://localhost:3001
- Health Check: http://localhost:3001/health
📊 Dashboard Features
Real-time Market Data
- Live price feeds for AAPL, GOOGL, MSFT, TSLA, AMZN
- WebSocket connections for real-time updates
- Service health monitoring
Professional UI Components
- Built with Tremor UI for financial visualizations
- Interactive charts and metrics
- Responsive design for all devices
Dashboard Tabs
- Market Data: Live prices, volume, bid/ask spreads
- Portfolio: Holdings allocation and performance
- Charts: Price and volume analysis
- Performance: Trading metrics and statistics
🏗️ Architecture
Service-Oriented Design
apps/
├── core-services/
│ └── market-data-gateway/ # Market data ingestion
├── interface-services/
│ └── trading-dashboard/ # React dashboard
├── data-services/ # (Future) Data processing
├── execution-services/ # (Future) Order management
├── intelligence-services/ # (Future) Strategy engine
├── platform-services/ # (Future) Infrastructure
└── integration-services/ # (Future) External APIs
Shared Packages
packages/
├── shared-types/ # TypeScript definitions
├── config/ # Configuration management
├── database/ # (Future) Database utilities
└── trading-core/ # (Future) Core trading logic
🔧 Development
Project Structure
- Turborepo: Monorepo management
- Bun: Package manager and runtime
- TypeScript: Type safety across all services
- React + Vite: Modern frontend development
- Tremor UI: Financial dashboard components
Key Technologies
- Backend: Hono framework, WebSockets, Redis
- Frontend: React, TypeScript, Tremor UI
- Data: QuestDB (planned), PostgreSQL (planned)
- Deployment: Docker, Kubernetes (planned)
📈 Current Status
✅ Completed
- Monorepo setup with Turborepo
- Market Data Gateway service
- Real-time WebSocket connections
- Professional React dashboard
- Tremor UI integration
- TypeScript type system
- Service health monitoring
🚧 In Progress
- Strategy execution engine
- Risk management system
- Portfolio tracking
- Real broker integration
🔮 Planned
- Advanced charting
- Backtesting framework
- Machine learning signals
- Multi-broker support
- Mobile application
🛠️ API Endpoints
Market Data Gateway (Port 3001)
GET /health # Service health check
GET /api/market-data/:symbol # Current market data
GET /api/ohlcv/:symbol # Historical OHLCV data
WS ws://localhost:3001 # Real-time data stream
Data Format
interface MarketData {
symbol: string;
price: number;
bid: number;
ask: number;
volume: number;
timestamp: string;
}
🔧 Configuration
Environment variables are managed in .env:
# Database Configuration
DATABASE_URL=postgresql://...
QUESTDB_URL=http://localhost:9000
# External APIs
ALPHA_VANTAGE_API_KEY=your_key_here
ALPACA_API_KEY=your_key_here
# Service Configuration
NODE_ENV=development
LOG_LEVEL=info
🤝 Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.