Skip to main content
Portfolio
=========

[![Build Status](https://api.shippable.com/projects/53ce99a67c72335f045a19bb/badge/master)](https://www.shippable.com/projects/53ce99a67c72335f045a19bb)
[![Coverage Status](https://img.shields.io/coveralls/intuition-io/portfolio.svg)](https://coveralls.io/r/intuition-io/portfolio)
[![Code Health](https://landscape.io/github/intuition-io/portfolio/master/landscape.png)](https://landscape.io/github/intuition-io/portfolio/master)
[![Requirements Status](https://requires.io/github/intuition-io/portfolio/requirements.png?branch=master)](https://requires.io/github/intuition-io/portfolio/requirements/?branch=master)
[![License](https://pypip.in/license/intuition/badge.png)](https://pypi.python.org/pypi/intuition/)
[![Gitter chat](https://badges.gitter.im/intuition-io.png)](https://gitter.im/intuition-io)

> [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].


Install
-------

```
$ # Before I setup a package on pypi, yo can get it from source
$ git clone https://github.com/intuition-io/portfolio
$ cd portfolio && make
... blablabla it compiles a lot of maths ...
```

A taste of it
-------------

```python
# Download some historical data
from pandas.io.data 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
portfolio.add_constraint(constraint.long_only())
# Invest every cent of our cash
portfolio.add_constraint(constraint.full_investment())

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

Contributing
------------

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


License
-------

Copyright 2014 Xavier Bruhiere.

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


[1]: https://github.com/quantopian/zipline
[2]: http://intuition.io
[3]: http://doc.intuition.io
[4]: https://github.com/intuition-io/intuition
[5]: http://www.apache.org/licenses/LICENSE-2.0.html
[6]: https://r-forge.r-project.org/R/?group_id=579
[7]: http://docs.scipy.org/doc/scipy/reference/optimize.html
[8]: http://www.investopedia.com/terms/p/portfolio-variance.asp
[9]: http://www.investopedia.com/articles/trading/04/091504.asp
[10]: http://doc.intuition.io/articles/contributors.html

Metadata

Release files for portfolio-analytics 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for portfolio-analytics 0.0.1
File Size Uploaded Provenance Actions
portfolio-analytics-0.0.1.tar.gz 6.2 kB Without provenance Details for portfolio-analytics-0.0.1.tar.gz

Release files / portfolio-analytics-0.0.1.tar.gz

Download URL portfolio-analytics-0.0.1.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6aad9cfaf15d79a19a5d4e6d2144a78d6037e65e2274b1701a9f0f720b8dbfc4
BLAKE2b-256 checksum
How to use checksums
3f03eb19350bc9a87ecccfc5d234344532fe4b1e8b7c8b4f67620ea0c63a403e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for portfolio-analytics 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page