Skip to main content
GlowBack can be used as a Rust library or via Python bindings. Choose the installation method that fits your workflow.

System requirements

  • Rust: Latest stable toolchain (1.70+)
  • Python: 3.8 or higher (for Python bindings)
  • Operating systems: Linux, macOS, Windows

Rust installation

Use GlowBack as a Rust library in your Cargo project.
1

Install Rust toolchain

If you don’t have Rust installed:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Verify installation:
rustc --version
cargo --version
2

Clone the repository

git clone https://github.com/LatencyTDH/GlowBack.git
cd GlowBack
3

Build the workspace

Build all crates:
cargo build --workspace --release
This compiles all core crates:
  • gb-types - Core types, orders, portfolio, strategies
  • gb-data - Data ingestion and storage
  • gb-engine - Backtesting engine
  • gb-python - Python bindings
  • gb-risk - Risk analytics
  • gb-optimizer - Parameter optimization
4

Run tests

Verify the installation:
cargo test --workspace
You should see all tests passing:
test result: ok. 56 passed; 0 failed

Using GlowBack crates

Add GlowBack crates to your Cargo.toml:
[dependencies]
gb-types = { path = "path/to/GlowBack/crates/gb-types" }
gb-data = { path = "path/to/GlowBack/crates/gb-data" }
gb-engine = { path = "path/to/GlowBack/crates/gb-engine" }
Basic usage example:
use gb_types::{Symbol, Resolution, BacktestConfig};
use gb_data::DataManager;
use gb_engine::BacktestEngine;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create symbol
    let symbol = Symbol::equity("AAPL");
    
    // Initialize data manager
    let mut data_manager = DataManager::new().await?;
    
    // Add sample data provider
    data_manager.add_provider(Box::new(
        gb_data::SampleDataProvider::new()
    ));
    
    // Load data
    let bars = data_manager.load_data(
        &symbol,
        start_date,
        end_date,
        Resolution::Day
    ).await?;
    
    println!("Loaded {} bars", bars.len());
    Ok(())
}

Python installation

Install the Python bindings to use GlowBack from Python.
1

Install Python dependencies

GlowBack requires Python 3.8 or higher. Verify your version:
python --version
If you need to upgrade, use your system’s package manager or download from python.org.
2

Install Rust (required for building)

The Python bindings require Rust to build. If you haven’t installed it:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
3

Clone and build Python bindings

git clone https://github.com/LatencyTDH/GlowBack.git
cd GlowBack

# Build Python bindings with maturin
pip install maturin
maturin develop --release -m crates/gb-python/Cargo.toml
maturin develop builds and installs the package in development mode, making it available to import as glowback.
4

Verify installation

Test the Python bindings:
import glowback

print(f"GlowBack version: {glowback.__version__}")

# Test basic functionality
manager = glowback.PyDataManager()
manager.add_sample_provider()
print("Installation successful!")

Alternative: Using pip (when published)

GlowBack is not yet published to PyPI. Use the build-from-source method above.
When available, you’ll be able to install via pip:
pip install glowback

Docker installation

Run GlowBack services with Docker for a zero-configuration setup.
1

Install Docker

Install Docker and Docker Compose:Verify installation:
docker --version
docker compose version
2

Clone the repository

git clone https://github.com/LatencyTDH/GlowBack.git
cd GlowBack
3

Launch with Docker Compose

Build and start all services:
docker compose up --build
This starts three services:
  • Engine: Rust backtesting engine on port 8081
  • API: FastAPI gateway on port 8000
  • UI: Streamlit interface on port 8501
4

Access the services

Once running, access:

Docker configuration

Customize behavior with environment variables:
# Require API authentication
GLOWBACK_API_KEY=your-secret-key docker compose up

# Set log level
GLOWBACK_LOG_LEVEL=DEBUG docker compose up

# Configure CORS origins
GLOWBACK_CORS_ORIGINS=http://localhost:3000,https://yourdomain.com docker compose up
The docker-compose.yml configuration:
version: "3.9"

services:
  engine:
    build:
      context: .
      dockerfile: docker/engine.Dockerfile
    ports:
      - "8081:8081"
    environment:
      - GLOWBACK_ENGINE_ADDR=0.0.0.0:8081

  api:
    build:
      context: .
      dockerfile: docker/api.Dockerfile
    ports:
      - "8000:8000"
    environment:
      - GLOWBACK_ENGINE_URL=http://engine:8081
      - GLOWBACK_API_KEY=${GLOWBACK_API_KEY:-}
    depends_on:
      - engine

  ui:
    build:
      context: .
      dockerfile: docker/ui.Dockerfile
    ports:
      - "8501:8501"
    environment:
      - GLOWBACK_API_URL=http://api:8000
    depends_on:
      - api

Streamlit UI setup

Run the Streamlit interface for interactive strategy development.
1

Install Python dependencies

Navigate to the UI directory:
cd ui
Install required packages:
pip install -r requirements.txt
Required packages:
  • streamlit>=1.35.0
  • plotly>=5.17.0
  • pandas>=2.1.0
  • numpy>=1.24.0
  • python-dateutil>=2.8.2
  • requests>=2.31.0
  • streamlit-ace>=0.1.1
  • streamlit-option-menu>=0.3.6
2

Launch the UI

The easiest way to start:
python setup.py
This script:
  1. Installs dependencies if needed
  2. Checks for Rust bindings
  3. Launches Streamlit at http://localhost:8501
Alternatively, run Streamlit directly:
streamlit run app.py --server.port=8501
3

Verify the UI is running

Open http://localhost:8501 in your browser. You should see the GlowBack interface with navigation:
  1. Data Loader
  2. Strategy Editor
  3. Backtest Runner
  4. Results Dashboard
  5. Portfolio Analyzer
  6. Advanced Analytics

Running examples

GlowBack includes example code to help you get started.

Rust examples

# Basic usage example
cargo run --example basic_usage -p gb-types

# Test market simulator
cargo test -p gb-engine simulator

# Test Parquet storage
cargo test -p gb-data parquet
The basic_usage example demonstrates:
  • Creating symbols and market data
  • Using the cache system
  • Portfolio management
  • Strategy framework
  • All four built-in strategies

Python examples

Create a file example.py:
import glowback

# Initialize data manager
manager = glowback.PyDataManager()
manager.add_sample_provider()

# Check catalog stats
stats = manager.get_catalog_stats()
print(f"Catalog contains {stats.total_symbols} symbols")
print(f"Total records: {stats.total_records}")

# Run a backtest
result = glowback.run_buy_and_hold(
    symbols=["AAPL"],
    start_date="2023-01-01T00:00:00Z",
    end_date="2023-12-31T23:59:59Z",
    resolution="day",
    initial_capital=100000.0
)

print(f"Total Return: {result.total_return:.2%}")
print(f"Sharpe Ratio: {result.sharpe_ratio:.2f}")
Run the example:
python example.py

Troubleshooting

Rust build errors

If you encounter build errors:
  1. Update Rust: Ensure you have the latest stable version
    rustup update stable
    
  2. Clean build: Remove build artifacts and rebuild
    cargo clean
    cargo build --release
    
  3. Check toolchain: Verify the correct toolchain is active
    rustup show
    

Python import errors

If import glowback fails:
  1. Rebuild bindings: Ensure maturin build completed
    cd crates/gb-python
    maturin develop --release
    
  2. Check Python version: GlowBack requires Python 3.8+
    python --version
    
  3. Virtual environment: Consider using a virtual environment
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    maturin develop --release -m crates/gb-python/Cargo.toml
    

Docker issues

If Docker services fail to start:
  1. Check Docker daemon: Ensure Docker is running
    docker info
    
  2. Port conflicts: Verify ports 8000, 8081, 8501 are available
    lsof -i :8501  # macOS/Linux
    netstat -ano | findstr :8501  # Windows
    
  3. View logs: Check service logs for errors
    docker compose logs api
    docker compose logs engine
    docker compose logs ui
    

Streamlit UI issues

If the UI doesn’t load:
  1. Check dependencies: Reinstall requirements
    cd ui
    pip install -r requirements.txt --force-reinstall
    
  2. Port in use: Try a different port
    streamlit run app.py --server.port=8502
    
  3. Clear cache: Remove Streamlit cache
    streamlit cache clear
    

Development setup

For contributing or advanced development:
# Clone with all branches
git clone https://github.com/LatencyTDH/GlowBack.git
cd GlowBack

# Install development tools
rustup component add rustfmt clippy

# Run formatter
cargo fmt --all

# Run linter
cargo clippy --workspace --all-targets

# Run tests with coverage
cargo test --workspace --all-features

# Build documentation
cargo doc --workspace --no-deps --open

What’s next?

Quickstart

Run your first backtest in minutes

Core concepts

Learn the fundamentals of GlowBack

Strategy development

Create custom trading strategies

API reference

Explore the complete API

Build docs developers (and LLMs) love