garpar package¶
Generation and analysis of artificial and real portfolio returns.
A comprehensive toolset for analyzing and managing financial portfolios/markets through the StocksSet class. Provides functionality for portfolio/market optimization, risk assessment, and performance analysis.
- Key Features:
Portfolio/market construction and rebalancing
Risk metrics calculation (variance, VaR, etc.)
Expected returns estimation
Correlation and covariance analysis
Diversification metrics
Portfolio/market visualization tools
Market data handling and validation
Entropy-based analysis
Subpackages¶
garpar.corepackage- Submodules
garpar.core.stocks_setmoduleStocksSetStocksSet.as_prices()StocksSet.as_returns()StocksSet.copy()StocksSet.delistedStocksSet.delisted_prune()StocksSet.dprune()StocksSet.entropyStocksSet.from_prices()StocksSet.ilocStocksSet.locStocksSet.metadataStocksSet.refresh_entropy()StocksSet.scale_weights()StocksSet.shapeStocksSet.stocksStocksSet.stocks_numberStocksSet.to_dataframe()StocksSet.to_hdf5()StocksSet.weightsStocksSet.weights_prune()StocksSet.window_sizeStocksSet.wprune()
mkss()
garpar.core.coercer_mixinmodulegarpar.core.covcorr_accmodulegarpar.core.div_accmodulegarpar.core.ereturns_accmodulegarpar.core.plot_accmoduleStocksSetPlotterAccessorStocksSetPlotterAccessor.box()StocksSetPlotterAccessor.heatmap()StocksSetPlotterAccessor.hist()StocksSetPlotterAccessor.kde()StocksSetPlotterAccessor.line()StocksSetPlotterAccessor.ogive()StocksSetPlotterAccessor.wbox()StocksSetPlotterAccessor.wheatmap()StocksSetPlotterAccessor.whist()StocksSetPlotterAccessor.wkde()
garpar.core.prices_accmodulegarpar.core.risk_accmodulegarpar.core.utilities_accmodule
garpar.datasetspackagegarpar.optimizepackagegarpar.utilspackage
Submodules¶
garpar.constants module¶
Constants used in Garpar project.
- garpar.constants.EPSILON = 1e-09¶
Tolerance value for numerical operations
- garpar.constants.GARPAR_METADATA_KEY = '__garpar_metadata__'¶
Key used to store metadata in a
garpar.StocksSet
- garpar.constants.VERSION = '1.6.0'¶
Version of the package
garpar.garpar_io module¶
Utilities to dump and load stocks sets into hdf5.
This module provides functions to dump and load stocks sets into HDF5 files.
Example
>>> from garpar import mkss
>>> from garpar.garpar_io import to_hdf5, read_hdf5
>>> ss = mkss(prices=[...])
>>> to_hdf5("path/to/file.hdf5", ss)
>>> ss2 = read_hdf5("path/to/file.hdf5")
- garpar.garpar_io.read_hdf5(path_or_stream, group='stocks set')¶
HDF5 file reader.
- Parameters:
path_to_stream (String) – Path to hdf5 stream
group (String) – The value to look inside hdf5 file
- Returns:
A StocksSet instance
- Return type:
- garpar.garpar_io.to_hdf5(path_or_stream, ss, group='stocks set', **kwargs)¶
HDF5 file writer.
It is responsible for storing a stocks set in HDF5 format.
- Parameters:
path_or_stream (str or file-like.) – Path or file like objet to the h5 to store the stocks set.
ss (garpar.stocks_set.StocksSet) – The stocks set to store.
group (str (default="stocks set")) – The name of the group where the stocks set will be stored.
kwargs – Extra arguments to the function
h5py.File.create_dataset.