No description
Find a file
2025-06-02 08:15:20 -04:00
apps initial setup 2025-06-02 08:15:20 -04:00
database/postgres/init initial setup 2025-06-02 08:15:20 -04:00
docs initial setup 2025-06-02 08:15:20 -04:00
monitoring initial setup 2025-06-02 08:15:20 -04:00
packages initial setup 2025-06-02 08:15:20 -04:00
scripts initial setup 2025-06-02 08:15:20 -04:00
.dockerignore initial setup 2025-06-02 08:15:20 -04:00
.env.example initial setup 2025-06-02 08:15:20 -04:00
.gitignore initial setup 2025-06-02 08:15:20 -04:00
bun.lock initial setup 2025-06-02 08:15:20 -04:00
docker-compose.dev.yml initial setup 2025-06-02 08:15:20 -04:00
docker-compose.yml initial setup 2025-06-02 08:15:20 -04:00
DOCKER.md initial setup 2025-06-02 08:15:20 -04:00
package.json initial setup 2025-06-02 08:15:20 -04:00
README.md initial setup 2025-06-02 08:15:20 -04:00
SETUP-COMPLETE.md initial setup 2025-06-02 08:15:20 -04:00
turbo.json initial setup 2025-06-02 08:15:20 -04:00

🤖 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

  1. Open the project in VS Code
  2. Press Ctrl+Shift+P (or Cmd+Shift+P on Mac)
  3. Type "Tasks: Run Task" and select it
  4. 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

📊 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

  1. Market Data: Live prices, volume, bid/ask spreads
  2. Portfolio: Holdings allocation and performance
  3. Charts: Price and volume analysis
  4. 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

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Tremor UI for beautiful financial components
  • Bun for fast runtime and package management
  • Turborepo for monorepo tooling