← all repositories
jankrepl/deepdow

Teaching PyTorch to allocate your assets in one forward pass

It fuses market forecasting and portfolio optimization into a single, fully differentiable PyTorch network trained by gradient descent.

1.2k stars Python Domain AppsML Frameworks
deepdow
Not currently ranked — collecting fresh signals.
star history

What it does

deepdow is a PyTorch research framework that trains neural networks to output portfolio weights directly. It treats market forecasting and asset allocation as one continuous pipeline: earlier layers extract features, the final layer allocates capital, and the entire graph is differentiable so you can optimize it with gradient descent. The output is a buy-and-hold strategy tuned against finance-specific losses like Sharpe ratio or maximum drawdown.

The interesting bit

The framework embeds differentiable convex optimization—via cvxpylayers—directly into the network. That means the model can learn both to read the market and to solve for optimal weights inside a single backpropagation loop, a pairing that usually lives in separate textbooks.

Key highlights

  • Fully differentiable layers built on torch, including clustering-based allocation algorithms.
  • Integrates cvxpylayers for differentiable convex optimization inside the network.
  • Multiple dataloading strategies (RigidDataLoader, FlexibleDataLoader) for time-series construction.
  • Callback hooks for mlflow and tensorboard tracking.
  • Loss functions tied to finance metrics (Sharpe ratio, maximum drawdown) rather than generic MSE.

Caveats

  • Strictly buy-and-hold: transaction costs and active trading are out of scope.
  • Not a reinforcement-learning framework, though individual layers can be reused elsewhere.
  • It is a toolkit for experimentation, not a single out-of-the-box algorithm.

Verdict

Researchers and quants who want to experiment with end-to-end differentiable portfolio construction in PyTorch should start here. Active traders or anyone seeking a plug-and-play trading bot will find it too narrow.

Frequently asked

What is jankrepl/deepdow?
It fuses market forecasting and portfolio optimization into a single, fully differentiable PyTorch network trained by gradient descent.
Is deepdow open source?
Yes — jankrepl/deepdow is open source, released under the Apache-2.0 license.
What language is deepdow written in?
jankrepl/deepdow is primarily written in Python.
How popular is deepdow?
jankrepl/deepdow has 1.2k stars on GitHub.
Where can I find deepdow?
jankrepl/deepdow is on GitHub at https://github.com/jankrepl/deepdow.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.