- Utilize MPT with added ML features
- Automatically select the best portfolio from a market
- Generate HTML reports detailing portfolios
NeoPortfolio extends Modern Portfolio Theory (MPT) with NLP and ML features. The package is geared to reduce the friction in portfolio selection and management by maintaining simplicity in its user-facing interface. Optimize a pre-determined portfolio or let the package automatically select the best portfolio; either way, the results are one function call away!
For now, just me! Güney Kıymaç. A finance student and a self-taught data science enthusiast. Contributions and suggestions are always welcome.
As mentioned, the package is designed for simple use. Define your investment preferences on class declaration, and make a single function call to get the results.
from NeoPortfolio import nCrOptimize
opt = nCrOptimize(
market="^GSPC", # S&P 500
n=5, # Number of assets in the portfolio
target_return=0.1,
horizon=21,
lookback=252,
max_pool_size=100, # Maximum number of portfolios to consider
api_key_path="path/to/your/api/key.env", # NewsAPI key (has free tier)
api_var_name="YOU_KEY_VAR"
)
opt.optimize_space(bounds=(0.05, 0.7))
NeoPortfolio is available on PyPI, so you can access it with pip
. Python 3.12+ is required for NeoPortfolio.
python -m pip install NeoPortfolio
Dependencies will be installed during the pip installation process but PyTorch can cause errors depending on your system and
environment. If you encounter any issues, please refer to the PyTorch installation guide.
You only the CPU compute platform and torchvision
or torchaudio
are not required for this package.
(The commands copied from the guide will install all 3 packages unless you remove them.)
Feel free to use the Discussions and Issues tabs for feedback and suggestions. As NeoPortfolio is a small scale project, there aren't guidelines for contributing. Shoot your suggestions and we'll work on them!