Single Command Deployment:
# Windows
start.bat
# Linux/Mac
./start.sh
# Manual
docker compose up -dAccess the application:
- Frontend: http://localhost (simple frontend for testing only)
- API Documentation: http://localhost:8000/docs
- Health Check: http://localhost/api/health
- Unified Deployment: Single Dockerfile deployment
- Real-time WebSocket: Live stock data updates (5-second intervals)
- REST API: Complete market data with 2-minute caching
- Market Hours Awareness: Automatic polling during market hours (9:00 AM - 12:30 PM Tehran time)
- Redis Caching: fast API responses
- PostgreSQL Persistence: Historical data storage
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │ │ Backend │ │ Database │
│ (React) │◄──►│ (FastAPI) │◄──►│ (PostgreSQL) │
│ Port 80 │ │ Port 8000 │ │ Port 5432 │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Nginx │ │ Redis │ │ WebSocket │
│ (Reverse │ │ (Cache) │ │ (Real-time) │
│ Proxy) │ │ Port 6379 │ │ Updates) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
GET /api/health- Service health checkGET /api/market/status- Current market statusGET /api/market/all- Complete market dataGET /api/websocket/stats- WebSocket connection statistics
ws://localhost/market/{ins_code}/realtime- Real-time stock data
# Start services
docker compose up -d
# View logs
docker compose logs -f tsetmc-app
# Stop services
docker compose down
# Restart services
docker compose restart
# Check Redis cache
docker compose exec redis redis-cli
# Access database
docker compose exec postgres psql -U tsetmc_user -d tsetmc_marketThe Iranian stock market operates:
- Days: Sunday to Thursday (Friday and Saturday are weekends)
- Hours: 9:00 AM to 12:30 PM Tehran time
- Timezone: Asia/Tehran
- PostgreSQL:
postgres_datavolume - Redis:
redis_datavolume - Logs:
./logs/directory
DATABASE_URL: PostgreSQL connection stringREDIS_URL: Redis connection stringLOG_LEVEL: Logging level (INFO, DEBUG, ERROR)
Test real-time stock data in browser console:
const ws = new WebSocket('ws://localhost/market/778253364357513/realtime');
ws.onmessage = (event) => console.log(JSON.parse(event.data));- Logs:
./logs/directory - Health: http://localhost/api/health
- Stats: http://localhost/api/websocket/stats
- API Docs: http://localhost:8000/docs