stock-bot/apps/stock/README.md

124 lines
No EOL
2.6 KiB
Markdown

# Stock Trading Bot Application
A comprehensive stock trading bot application with multiple microservices for data ingestion, processing, and API access.
## Architecture
The stock bot consists of the following services:
- **Config**: Centralized configuration management
- **Data Ingestion**: Handles real-time and historical data collection
- **Data Pipeline**: Processes and transforms market data
- **Web API**: RESTful API for accessing stock data
- **Web App**: Frontend user interface
## Quick Start
### Prerequisites
- Node.js >= 18.0.0
- Bun >= 1.1.0
- Turbo
- PostgreSQL, MongoDB, QuestDB, and Redis/Dragonfly running locally
### Installation
```bash
# Install all dependencies
bun install
# Build the configuration package first
bun run build:config
```
### Development
```bash
# Run all services in development mode (using Turbo)
bun run dev
# Run only backend services
bun run dev:backend
# Run only frontend
bun run dev:frontend
# Run specific service
bun run dev:ingestion
bun run dev:pipeline
bun run dev:api
bun run dev:web
```
### Production
```bash
# Build all services (using Turbo)
bun run build
# Start with PM2
bun run pm2:start
# Check status
bun run pm2:status
# View logs
bun run pm2:logs
```
### Configuration
Configuration is managed centrally in the `config` package.
- Default config: `config/config/default.json`
- Environment-specific: `config/config/[environment].json`
- Environment variables: Can override any config value
### Health Checks
```bash
# Check all services health
bun run health:check
```
### Database Management
```bash
# Run migrations
bun run db:migrate
# Seed database
bun run db:seed
```
## Available Scripts
| Script | Description |
|--------|-------------|
| `dev` | Run all services in development mode |
| `build` | Build all services |
| `start` | Start all backend services |
| `test` | Run tests for all services |
| `lint` | Lint all services |
| `clean` | Clean build artifacts and dependencies |
| `docker:build` | Build Docker images |
| `pm2:start` | Start services with PM2 |
| `health:check` | Check health of all services |
## Service Ports
- Data Ingestion: 2001
- Data Pipeline: 2002
- Web API: 2003
- Web App: 3000 (or next available)
## Environment Variables
Key environment variables:
- `NODE_ENV`: development, test, or production
- `PORT`: Override default service port
- Database connection strings
- API keys for data providers
See `config/config/default.json` for full configuration options.