/optfolio

Portfolio Optimization Using Evolutionary Algorithms

Primary LanguagePythonApache License 2.0Apache-2.0

Optfolio

This package provides an investment portfolio optimization tool that uses NSGA-II evolutionary algorithm to approximate a Pareto optimal set of portfolio asset allocations. Returns of a particular portfolio asset distribution can be projected into the future using Monte Carlo or Markov Chain Monte Carlo methods.

Optimization

from optfolio.optimize import Optimizer

optimizer = Optimizer()
solutions, stats = optimizer.run(returns)

Solutions

Monte Carlo Projection

from optfolio.returns_projection import sample_returns

traces = sample_returns(ret, 5 * 252, n_traces = 100000)
plot_traces(traces)

MC Projection MC Distributions 12m MC Distributions 12m

MCMC Projection

from optfolio.returns_projection import mcmc_sample_returns

traces = mcmc_sample_returns(ret, 5 * 252, n_traces=100000, mc_states = 15, n_jobs=10)
plot_traces(traces)

MCMC Projection MCMC Distributions 12m MCMC Distributions 12m