Skip to content

About

Master's thesis developing a reinforcement learning framework for portfolio management that integrates price, technical, fundamental, and behavioral features across a dynamic equity universe.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Factor Weaver

Multi-factor deep reinforcement learning for portfolio management. Master's thesis project, work in progress.

A PPO actor-critic policy allocates a dynamic top-50 S&P 500 universe from technical, fundamental and behavioral features. Portfolios are long-only and net of transaction costs. The policy is compared in a walk-forward backtest against benchmark models, including gradient-boosted regression trees (GBRT) and Black–Litterman–Bayes (BLB).

Architecture

flowchart LR
  sources[("LSEG<br/>Yahoo<br/>MarketPsych")]

  subgraph data["data"]
    direction TB
    fetch["<b>fetch</b><br/>cached raw data"]
    build["<b>build</b><br/>universe · prices<br/>features · panel"]
    fetch --> build
  end

  panel[("stock-day<br/>panel")]
  market["<b>market</b><br/>point-in-time view"]
  folds["<b>walk-forward</b><br/>yearly folds"]

  subgraph models["models"]
    direction TB
    ew["<b>1/N</b><br/>equal weight"]
    mv["<b>mean-variance</b><br/>tangency portfolio"]
    gbrt["<b>GBRT</b><br/>forecasts + tangency"]
    blb["<b>BLB</b><br/>Black–Litterman–Bayes"]
    rl["<b>RL</b><br/>transformer · PPO"]
    ew ~~~ mv ~~~ gbrt ~~~ blb ~~~ rl
  end

  backtest["<b>backtest</b><br/>costs · exits · cap"]
  metrics["<b>metrics</b><br/>Sharpe · drawdown"]
  mlflow[("MLflow")]

  sources --> data --> panel --> market --> models
  folds --> models
  models -- weights --> backtest --> metrics --> mlflow

  classDef done fill:#dce8f5,stroke:#2a78d6,color:#2e3440
  classDef todo fill:#fff,stroke:#9a958c,stroke-dasharray:4 3,color:#9a958c
  classDef store fill:#f1eee8,stroke:#9a958c,color:#2e3440
  class fetch,build,market,backtest,ew,mv,gbrt,folds,metrics done
  class blb,rl todo
  class sources,panel,mlflow store
  style data fill:#fafafa,stroke:#9a958c
  style models fill:#fafafa,stroke:#9a958c
Loading

Dashed boxes are placeholders that already have their final interfaces. Every model is evaluated by the same engine.

Usage

Requires uv. Fetching raw data needs LSEG and MarketPsych credentials in .env (see .env.example). Run the commands from the repository root.

uv sync                              # install into .venv
uv run factor-weaver data            # fetch raw data and build the panel
uv run factor-weaver train [MODEL]   # fit models on each walk-forward fold
uv run factor-weaver eval [MODEL]    # backtest models through the shared engine
uv run factor-weaver report          # compare the latest eval runs

Add --help to any command for its options.

Documentation

About

Master's thesis developing a reinforcement learning framework for portfolio management that integrates price, technical, fundamental, and behavioral features across a dynamic equity universe.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages