institutional-trader/README/START_SERVICE.md

1.6 KiB

Starting the Python Service

Quick Start

cd backend/python_service
uvicorn main:app --reload --port 8010

If you want to use a virtual environment (recommended for isolation):

# Create virtual environment
cd backend/python_service
python -m venv venv

# Activate (Windows)
venv\Scripts\activate

# Activate (macOS/Linux)
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Start service
uvicorn main:app --reload --port 8010

Verify Service is Running

Once started, you should see:

INFO:     Uvicorn running on http://127.0.0.1:8010
INFO:     Application startup complete.

Test the health endpoint:

curl http://localhost:8010/health

Expected response:

{
  "status": "healthy",
  "service": "options-flow-processor"
}

Troubleshooting

ModuleNotFoundError

  • Make sure you've run: pip install -r requirements.txt
  • If using venv, make sure it's activated
  • Check Python version: python --version (should be 3.11+)

Port Already in Use

  • Change port: uvicorn main:app --reload --port 8001
  • Update PYTHON_SERVICE_URL in Node.js .env to match

Database Connection Error

  • Check .env file has correct database credentials
  • Verify PostgreSQL is running
  • Test connection: psql -h localhost -U postgres -d institutional_trader

Next Steps

Once the Python service is running:

  1. Start Node.js backend: cd backend && npm run dev
  2. Node.js will automatically detect and use Python service
  3. Check logs to confirm: ✅ Using Python service