Overview of FinQuant
masterPortfolio objects from stock tickers, analyze returns, calculate moving averages (including Bollinger Bands), and perform portfolio optimisation using methods like the Efficient Frontier or Monte Carlo simulations.repository·master·Indexed 23 days ago
https://github.com/fmilthaler/finquantA financial analysis library for Python designed for portfolio management, return analysis, and mathematical optimisation. FinQuant enables users to create Portfolio objects from stock tickers, calculate technical indicators like Bollinger Bands and moving averages, and perform portfolio optimisation using the Efficient Frontier or Monte Carlo simulations. It supports data retrieval via yfinance and quandl, and provides tools for computing cumulative, percentage, and log returns.
Portfolio objects from stock tickers, analyze returns, calculate moving averages (including Bollinger Bands), and perform portfolio optimisation using methods like the Efficient Frontier or Monte Carlo simulations.FinQuant is a library for financial portfolio management, analysis, and optimisation.
Key features include:
Portfolio objects that hold stock price data and automatically compute metrics like Expected annual Return, Volatility, and Sharpe Ratio.The Monte Carlo simulation functionality is located in the finquant.monte_carlo module. It provides two primary classes for performing simulations and optimizations:
MonteCarlo: Used for running Monte Carlo simulations.MonteCarloOpt: Used for performing optimizations related to Monte Carlo methods.To use these, import them from the finquant.monte_carlo package.
finquant.returns module provides implementations for calculating and analyzing daily and historical returns. This module is the primary entry point for return-based financial calculations within the library.As an alternative to the Efficient Frontier approach, you can perform a Monte Carlo run of n trials to find optimal portfolios for:
Note: The Efficient Frontier approach is generally preferred for better computational efficiency and accuracy.
FinQuant uses custom data types defined in finquant.data_types as type hints throughout the library. When extending the library or implementing new functionality, you should use these types to ensure consistency with FinQuant's type validation system.
Key categories of custom types include:
finquant.portfolio.Portfolio object is the central hub of the library. It holds all stock prices and automatically computes common financial quantities. It acts as a unified interface to the various modules in finquant/, combining data analysis, visualization, and optimization capabilities into a single object.finquant.asset.Asset class serves as the base class for all individual financial instruments in the library. It provides the foundational structure for assets like stocks or funds.The finquant.portfolio.Portfolio class is the core abstraction of the library. It holds the prices of all stocks in a portfolio and automatically computes common financial quantities.
Key features of the Portfolio object include:
To simplify creation, use the build_portfolio function to automatically generate a Portfolio instance.
finquant.moving_average module. This module contains the implementations for various moving average techniques used in financial quantitative analysis.You can install FinQuant via PyPI or by cloning the GitHub repository.
pip install FinQuant
Clone the repository and run the setup script:
git clone https://github.com/fmilthaler/FinQuant.git
cd FinQuant
python setup.py installAlternatively, you can clone the repository and add the directory to your PYTHONPATH without performing a formal installation.
FinQuant requires the following packages:
python>=3.10numpy>=1.15pandas>=2.0matplotlib>=3.0quandl>=3.4.5yfinance>=0.1.43scipy>=1.2.0scikit-learn>=1.3.0pip install FinQuantTo install the latest development version from GitHub, clone the repository and run the setup script.
Alternatively, you can clone the repository and add the directory to your PYTHONPATH if you prefer not to perform a formal installation.
git clone https://github.com/fmilthaler/FinQuant.git
cd FinQuant
python setup.py install