Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Keep calm and optimize.

Project Description


[![Build Status](](
[![Coverage Status](](
[![Code Health](](
[![Requirements Status](](
[![Gitter chat](](

> [Zipline][1] compatible extension of Portfolio, with analytics superpowers.
> Inspired by [PortfolioAnalytics][6] R package.

The project provides several portfolio optimizations that compute optimal
assets allocation regarding a various set of factors and constraints. Currently
you will get the following implementations :

* [General optimization problem with solvers][7]
* [Global Minimum Variance][8]
* [Kelly criterion][9]

To learn more about the API, check [the full documentation][3].

This project is currently part of the **intuition project**, signup for [the
private beta][2] and/or [clone your own hedge fund][4].

Finally, the whole thing is compatible with [zipline backtester][1].


$ # Before I setup a package on pypi, yo can get it from source
$ git clone
$ cd portfolio && make
... blablabla it compiles a lot of maths ...

A taste of it

# Download some historical data
from import get_data_google
ohlc_data = get_data_google(['adsk', 'ctxs', 'fb', 'nflx', 'qcom'], start='2013/01/01', end='2013/12/01')
data = ohlc_data['Close']

# Now let's optimize our portfolio weights
from portfolio.optimizations.solvers import SolverPortfolio
import portfolio.objectives as objective
import portfolio.constraints as constraint

portfolio = SolverPortfolio(objective.risk)
# Forbid short positions
# Invest every cent of our cash

# Get optimal weights in %
pf.optimize(['ctxs', 'fb', 'nflx', 'qcom', 'adsk'], data)
{'adsk': 0.49,
'ctxs': 0.04,
'fb': 0.17,
'nflx': 0.0,
'qcom': 0.29}


Contributors are happily welcome, [here is a place to start][10].


Copyright 2014 Xavier Bruhiere.

*Portfolio* is available under the [Apache License, Version 2.0][5].


Release History

This version
History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(6.2 kB) Copy SHA256 Hash SHA256
Source None Aug 3, 2014

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers