NeuraTrade provides commands to check system status, service health, and connectivity.
System Status
Show overall system status:
Example Output (Healthy)
NeuraTrade System Status
=======================
Version: v1.0.0
Status: healthy
Connected Services:
- Backend API: Connected ✓
- Database: Connected ✓
- Redis: Connected ✓
- Telegram: Ready ✓
- AI Providers: Configured ✓
Checked at: 2026-03-03T10:30:00Z
Example Output (Backend Unreachable)
NeuraTrade System Status
=======================
Version: v1.0.0
⚠️ Warning: Could not reach API at http://localhost:8080
Ensure the backend is running: neuratrade gateway start
Simulated status (backend may not be running):
Status: Unknown (API unreachable)
How It Works
- Determines backend URL from config or environment
- Calls
/health endpoint on backend API
- Displays service status and connectivity
- Falls back to local status if API is unreachable
Environment Variables
| Variable | Description | Default |
|---|
NEURATRADE_API_BASE_URL | Backend API base URL | http://localhost:8080 |
NEURATRADE_API_KEY | API authentication key | From config |
SERVER_PORT | Backend port | 8080 |
Health Check
Perform detailed health checks:
Example Output (Healthy)
Health Check Results
===================
✓ Backend API: healthy
Service Health:
✓ database: healthy
✓ redis: healthy
✓ ccxt_service: healthy
✓ telegram_service: healthy
✓ exchange_binance: healthy
✓ exchange_bybit: healthy
Checked at: 2026-03-03T10:30:00Z
Example Output (Degraded)
Health Check Results
===================
⚠️ Backend API: degraded
Service Health:
✓ database: healthy
✓ redis: healthy
⚠️ ccxt_service: connection_timeout
✓ telegram_service: healthy
⚠️ exchange_binance: rate_limited
✓ exchange_bybit: healthy
Checked at: 2026-03-03T10:30:00Z
Example Output (Backend Down)
Health Check Results
===================
❌ Error: Could not reach API at http://localhost:8080
Ensure the backend is running: neuratrade gateway start
Backend API unreachable
Health Check Components
The backend /health endpoint checks:
- Database - SQLite/PostgreSQL connectivity and query execution
- Redis - Connection and command execution
- CCXT Service - Exchange data bridge availability
- Telegram Service - Bot service connectivity
- Exchange Connections - Individual exchange API health (if configured)
- AI Providers - LLM provider connectivity (if configured)
Backend URL Resolution
The CLI determines the backend URL in this order:
- Environment Variable -
NEURATRADE_API_BASE_URL
- Config File -
telegram.api_base_url (if not api.telegram.org)
- Port from Environment - Uses
SERVER_PORT, PORT, or BACKEND_HOST_PORT
- Config Port -
server.port from config.json
- Default -
http://localhost:8080
The CLI skips telegram.api_base_url if it contains api.telegram.org to avoid accidentally using the Telegram public API endpoint as the backend URL.
The backend returns health status in JSON:
{
"status": "healthy",
"timestamp": "2026-03-03T10:30:00Z",
"services": {
"database": "healthy",
"redis": "healthy",
"ccxt_service": "healthy",
"telegram_service": "healthy"
}
}
Status Values
- healthy / ok - Service fully operational
- degraded - Service operational but with issues
- unhealthy - Service experiencing failures
- down - Service not responding
PID Status
Check running processes via PID files:
./bin/neuratrade gateway status
See Gateway Commands for details.
Continuous Monitoring
Monitor health in a loop:
watch -n 5 './bin/neuratrade health'
This runs the health check every 5 seconds.
Exit Codes
Commands return standard exit codes:
- 0 - Success (healthy)
- 1 - Error (unhealthy or unreachable)
Example in Scripts
if ./bin/neuratrade health; then
echo "System is healthy"
else
echo "System is unhealthy"
# Send alert, restart services, etc.
fi
Troubleshooting
”Could not reach API”
Ensure the backend is running:
./bin/neuratrade gateway start
Check the backend port:
Verify the backend URL:
echo $NEURATRADE_API_BASE_URL
“Invalid API response”
Check backend logs:
tail -50 ~/.neuratrade/logs/backend.log
Verify the /health endpoint manually:
curl http://localhost:8080/health
Health Check Timeout
The CLI uses a 5-second timeout for health checks. Slow responses may indicate:
- Database connection issues
- Exchange API latency
- High system load
Check individual service logs for details.
Health Metrics in Gateway State
The gateway monitors health continuously and writes to:
~/.neuratrade/pids/gateway-state.json
View the current state:
cat ~/.neuratrade/pids/gateway-state.json | jq .
Example:
{
"mode": "healthy",
"supervised": false,
"updated_at": "2026-03-03T10:30:15Z",
"health_timeout_seconds": 90,
"services": {
"backend": {
"status": "healthy",
"detail": "Backend API reachable (200)",
"endpoint": "http://127.0.0.1:8080/health"
},
"telegram": {
"status": "healthy",
"detail": "Telegram Service reachable (200)",
"endpoint": "http://127.0.0.1:3002/health"
},
"ccxt": {
"status": "healthy",
"detail": "process started",
"endpoint": "http://127.0.0.1:3001/health"
}
}
}
The gateway updates this file every 15 seconds while running.