Sign inSign up

sudhan/openalgo

By sudhan

•Updated 12 months ago

Open Algorithmic Trading platform from: https://github.com/marketcalls/openalgo/

Image
Machine learning & AI
Web servers
0

1.2K

sudhan/openalgo repository overview

⁠UNOFFICIAL - OpenAlgo Docker Image

Checkout the original repo etc. @ https://github.com/marketcalls/openalgo/⁠

This document provides instructions for building, configuring, and running the OpenAlgo Docker image. It covers the essential information typically found on DockerHub image pages.


⁠Quick Start

  1. Clone the repository:

    git clone https://github.com/p2c2e/openalgo.git
    cd openalgo
    
  2. Create your environment file:

    cp .sample.env .env
    

    Edit .env and set the required values (see below).

  3. Build and run with Docker Compose:

    docker-compose up --build
    

    Or, to run in detached mode:

    docker-compose up -d
    

⁠Building the Image Manually

To build the Docker image yourself (without Compose):

docker build -t openalgo:latest .

⁠Running the Image

With Docker Compose (recommended):

docker-compose up

With Docker CLI:

docker run -d \
  --name openalgo-web \
  --env-file .env \
  -p 5000:5000 \
  -p 8765:8765 \
  -v $(pwd)/db:/app/db \
  -v $(pwd)/logs:/app/logs \
  -v $(pwd)/.env:/app/.env:ro \
  openalgo:latest

⁠Configuration

⁠Environment Variables
  • All configuration is managed via environment variables in the .env file.
  • Use .sample.env as a template and copy to .env.
  • At minimum, set:
    • BROKER_API_KEY
    • BROKER_API_SECRET
    • APP_KEY
    • API_KEY_PEPPER
    • DATABASE_URL
  • Other variables can be left as defaults or customized as needed.
⁠Volumes
  • ./db:/app/db — SQLite database and persistent data
  • ./logs:/app/logs — Application logs
  • ./.env:/app/.env:ro — Environment configuration (read-only)
⁠Ports
  • 5000 — Main web application (Flask)
  • 8765 — WebSocket server

⁠Entrypoint

  • The container starts with /app/start.sh (included in the image).
  • The default user is appuser (non-root).

⁠Example docker-compose.yaml

services:
  openalgo:
    image: openalgo:latest
    build:
      context: .
      dockerfile: Dockerfile
    container_name: openalgo-web
    ports:
      - "${FLASK_PORT:-5000}:5000"
      - "${WEBSOCKET_PORT:-8765}:8765"
    volumes:
      - ./db:/app/db
      - ./logs:/app/logs
      - ./.env:/app/.env:ro
    environment:
      - FLASK_ENV=${FLASK_ENV:-production}
      - FLASK_DEBUG=${FLASK_DEBUG:-0}
    restart: unless-stopped

⁠Common Commands

# Build and start (foreground)
docker-compose up --build

# Start in detached mode
docker-compose up -d

# View logs
docker-compose logs -f

# Stop containers
docker-compose down

# Rebuild after changes
docker-compose up --build

# Enter container shell
docker-compose exec openalgo-web bash

# Check container status
docker-compose ps

⁠Troubleshooting

  • Port already in use:
    Check what's using the port and stop it, or change the port mapping in .env and docker-compose.yaml.

  • Database or log permission issues:
    Ensure db/ and logs/ directories exist and are writable by Docker.

  • Container won't start:
    Check logs with docker-compose logs and verify your .env file is correct.

  • Package installation issues:
    Rebuild the image without cache:

    docker-compose build --no-cache
    docker-compose up
    

⁠Directory Structure

openalgo/
├── Dockerfile
├── docker-compose.yaml
├── .env
├── .sample.env
├── app.py
├── db/
├── logs/
└── ...

⁠License

See the original OpenAlgo repo @ https://github.com/marketcalls/openalgo/⁠

Tag summary

Content type

Image

Digest

sha256:4fe5c70e4…

Size

184.4 MB

Last updated

12 months ago

docker pull sudhan/openalgo