Skip to main content

ModFin

python version   pypi version   MIT license  

The ModFin project aims to provide users with the necessary tools for modeling and analyzing individual assets and portfolios. This package contains various modules that provide a variety of useful functions and algorithms. Here is a table of the implemented modules:

Note: Modules to be fully implemented on live libraries.

  • Analysis of Time Series
  • Bet Sizing
  • Data Structures
  • Online Portfolio
  • Option Pricing

 

Installation

Requirements

ModFin requires Python 3.8 or later and C++ build tools.

If needed, you can install the C++ build tools on Visual Studio.

Methods

The project is available on PyPI, and can be installed with pip package manager with the following command:

$ pip install modfin

Alternatively, install the package from the source using the following command:

git clone https://github.com/GabrielAbra/modfin
python setup.py install

 

Asset Screening

The AssetScreening module offers functions for screening assets based on a predetermined set of metrics. One fundamental approach is to screen assets based on smart betas (Style factors), when a given a combination of traits, are likely to be of interest to a specific investor. The ready to use functions groups are:

Metrics

This submodule provides bundles of functions that can be used to screen assets. Some of the metrics are:

  • Risk Metrics

    • Beta, Downside Beta, Beta Quotient
    • RSquaredScore
    • LPM
    • ...
  • Return Metrics

    • Annualized Return
    • Exponencial Returns
    • Log Returns
    • ...
  • Ratio Metrics

    • Omega Ratio
    • Sortino Ratio
    • Tail Ratio
    • ...

Screening

This submodule provides functions that can be used to screen assets. Some of the screening functions are:

  • Z-Score Screening

  • Sequential Screening

  • Quantile Screening

 

Risk Matrix

The RiskMatrix module provides multiple functions for analyzing time series data and generating risk matrices. There are three different types of algorithms that can be distinguished as:

  • Sample

    • Covariance
    • Semicovariance
  • Estimator

    • Empirical Covariance
    • Minimum Covariance Determinant
  • Shrinkage

    • Shrinkage (Basic Shrinkage)
    • LedoitWolf (Ledoit-Wolf Shrinkage Method)
    • Oracle (Oracle Approximating Shrinkage)

 

Portfolio Optimization

The PortfolioOpt module provides algorithms for optimization of an a asset portfolios. The algorithms live implemented algorithms are:

  • Risk Parity

    The RiskParity algorithm is a simple algorithm that optimizes a portfolio based on the risk parity weighting.

  • Hierarchical Risk Parity

    The HierarchicalRiskParity (HRP) algorithm, implements the allocation based on the book:

    De Prado, Marcos Lopez. Advances in financial machine learning. John Wiley & Sons, 2018.

    The algorithm is a risk based optimisation, which has been shown to generate diversified portfolios with robust out-of-sample properties.

  • Inverse Variance

    The InverseVariance algorithm is a simple algorithm that optimizes a portfolio based on the provided risk matrix (usually the covariance matrix).

  • Efficient Frontier

    The EfficientFrontier algorithm provide a portfolio allocation based on the modern portfolio theory (MPT). The algoritms was first proposed by Harry Markowitz in the paper:

    Markowitz, H.M.. Portfolio Selection. The Journal of Finance, 1952.

 

License

ModFin is released under the MIT license, so the code is open source and can be used in any project, provided that the original author is credited.

Metadata

Release files for modfin 0.1.5

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

Source distribution (sdist)

Source distribution for modfin 0.1.5
File Size Uploaded
modfin-0.1.5.tar.gz 22.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for modfin 0.1.5
File Interpreter ABI Platform
modfin-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 49.1 kB

Release files / modfin-0.1.5.tar.gz

Download URL modfin-0.1.5.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7218cff22f1f3b05569db2fe267d7b8aeef4eeb5c20dc6f20bc39500e9406264
BLAKE2b-256 checksum
How to use checksums
6ff1ace536331eb02e619aa67cd2b042b56127dce23fc2d42f082d5e4186a60d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release files / modfin-0.1.5-py3-none-any.whl

Download URL modfin-0.1.5-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cdfb0ed0d89a54325d292965b10f72f6067684a653ae79fb37dacf1fd953679
BLAKE2b-256 checksum
How to use checksums
1f6ce701f66b4c0864aec68e27109127435c8417c83013cb989d69390f333948
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

1 release file

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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