Skip to content
v0.1.0 · Implementing arXiv:2505.24831v2

Crypto portfolios, built on consensus.

A production-grade Python framework for cryptocurrency portfolio construction. Consensus Louvain clustering, Ledoit-Wolf shrinkage, and Sharpe-ascent optimisation — packaged for quant teams who ship.

Python 3.10 · 3.11 · 3.12 Stateless FastAPI surface Docker-ready
Sharpe (annualised)
live
1.84 net of costs
Stable communities
consensus
12 across 80 assets
Pipeline runtime
~3.2s per rebalance
Ingest 0.4s
Louvain consensus 1.1s
Sharpe ascent 1.7s
4 .
Forecasting methods
4 .
Data sources
20 .
Consensus runs
6 .
Risk controls
5 .
Output artefacts
3 .
Python versions

Built on the shoulders of

NumPy
pandas
PyTorch
NetworkX
statsmodels
arch
FastAPI
Uvicorn
yfinance
ccxt
pytest
ruff
mypy
Docker
NumPy
pandas
PyTorch
NetworkX
statsmodels
arch
FastAPI
Uvicorn
yfinance
ccxt
pytest
ruff
mypy
Docker
Pipeline

From price data to risk-aware portfolios.

A single, opinionated pipeline. Each stage is observable, deterministic, and independently testable.

  1. 01
    Ingest

    Wide price frames via synthetic, CSV, yfinance, or live ccxt polling.

    CSV yfinance ccxt synthetic
  2. 02
    Clean & log-returns

    Calendar alignment, missing-value handling, and log-returns computation.

    pandas NumPy
  3. 03
    Forecast

    Naive, ARIMA, GARCH (AIC), and shared multi-asset LSTM with governance drift detection.

    ARIMA GARCH LSTM
  4. 04
    Correlation networks

    Rolling correlation matrices → graph edges with NetworkX.

    NetworkX
  5. 05
    Consensus Louvain

    Stable clusters extracted across N runs with majority co-occurrence threshold τ.

    Louvain consensus
  6. 06
    Sharpe ascent

    Ledoit-Wolf shrinkage, per-asset caps, vol ceiling, transaction & slippage.

    Ledoit-Wolf constraints
  7. 07
    Artefacts

    Persistent, idempotent artefacts: trades, summary, log-returns, events, metrics.

    trades.csv events.jsonl
Features

Everything a quant pipeline needs.
Nothing it doesn't.

Designed for serious work — observable, testable, and built on the research literature.

Multi-method forecasting

Naive, ARIMA, GARCH with AIC-selected orders, and a shared multi-asset LSTM — swappable per run with a single flag.

Consensus Louvain

Stable community detection across N independent Louvain runs, with co-occurrence threshold and Jaccard stability metrics.

Sharpe-ratio optimisation

Ledoit-Wolf covariance shrinkage, per-asset caps, asset-count and volatility ceilings — all in one objective.

Risk & execution modelling

Transaction costs and slippage applied to net returns; per-rebalance turnover surfaced in every artefact.

Governance & drift

Forecast drift detection and MSE tracking over time. Pipeline emits events, metrics, and structured logs.

Pluggable & layered

Hexagonal architecture. Domain is pure Python; infrastructure is swappable. Ships CLI, REST, Docker, and ccxt poller.

Interfaces

One framework.
Four ways to use it.

CLI for scripting, Python API for notebooks and services, REST for stateless backends, and a live poller for real-time research.

Shell-first workflow.

Two scripts. One for batch runs, one for live ingestion. Flags map 1:1 to PipelineConfig — no surprises.

config-as-flags idempotent runs jsonl events
zsh

                      $ pip install crypto-portfolio-system
                    
                      
                    
                      $ crypto-portfolio \
                    
                          --source yfinance \
                    
                          --symbols BTC-USD,ETH-USD,SOL-USD,ADA-USD \
                    
                          --period 6mo \
                    
                          --forecast-method arima \
                    
                          --consensus-runs 20 \
                    
                          --weight-cap 0.35 \
                    
                          --max-volatility-annual 1.20 \
                    
                          --output-dir outputs --run-dir runs
                    
Adopt

Install in seconds. No accounts.

MIT licensed. Pay nothing. Add capabilities as you need them.

Core

The default install. Naive + ARIMA forecasting, FileArtifactStore, structured logging.

$ pip install crypto-portfolio-system
  • Naive & ARIMA forecasting
  • Consensus Louvain clustering
  • Sharpe-ascent with constraints
  • Structured JSONL logging
  • Metrics registry
PyPI

Studio

Recommended

Everything in Core, plus GARCH volatility and a multi-asset LSTM forecaster.

$ pip install crypto-portfolio-system[forecast-lstm,forecast-garch]
  • Everything in Core
  • GARCH with AIC order selection
  • Multi-asset shared LSTM
  • Forecast drift governance
  • MSE telemetry on runs
Install Studio

Live

Studio + live ccxt polling, yfinance ingest, and the FastAPI REST surface.

$ pip install crypto-portfolio-system[all]
  • Everything in Studio
  • Live ccxt poller
  • yfinance multi-asset ingestor
  • Stateless FastAPI surface
  • Docker-ready image
Install Live
All tiers ship under the MIT license. No telemetry. No accounts.
Questions

Answers,
without the fluff.

If something's missing, open an issue on GitHub. Or read the full README.

  • How is this different from off-the-shelf backtesters?
    CPS is a research-to-production pipeline, not a UI. Every stage (forecasting, Louvain consensus, optimisation, risk) is a first-class object you can compose, swap, or replace — without writing UI glue.
  • Does it ship with live trading?
    No. CPS produces deterministic, idempotent artefacts — trades, summary, log-returns. Live trading is intentionally out of scope. The ccxt poller feeds the same wide price frame the pipeline expects.
  • Why consensus Louvain instead of one Louvain pass?
    Louvain is stochastic. Running it N times and extracting co-occurring communities gives you a stability signal you can measure. The τ threshold controls how strict 'stable' is.
  • Which Python versions are supported?
    Python 3.10, 3.11, and 3.12 — tested on every push. NumPy ≥1.24, pandas ≥2.0, NetworkX ≥3.1, statsmodels ≥0.14.
  • Can I run this in Docker?
    Yes. A multi-stage Dockerfile is in the repo — small runtime image with optional extras pulled in via build args.
  • Is there a web dashboard?
    Not yet — it's a known roadmap item awaiting sponsorship. CPS is CLI + REST first; visualisation belongs to whoever consumes the artefacts.
Ready when you are

Build portfolios the research-grade way.

Install CPS, point it at any source — CSV, yfinance, or live ccxt — and ship a deterministic, risk-aware crypto portfolio.

MIT license · v0.1.0 · Tested on 3.10 / 3.11 / 3.12