Skip to content

Commit

Permalink
Fixed some testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Divasco committed May 30, 2024
1 parent c7860b8 commit ec74acc
Show file tree
Hide file tree
Showing 32 changed files with 236 additions and 100 deletions.
2 changes: 1 addition & 1 deletion .header-template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# Copyright (c) 2021, 2022, 2023, 2024, Diego Gimenez, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE
1 change: 0 additions & 1 deletion 1 archivos sin guardar

This file was deleted.

5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
include LICENSE
include README.md
include pyproject.toml

recursive-include garpar *.csv

exclude tox.ini
exclude pyproject.toml
exclude .header-template
exclude requirements.txt

recursive-exclude tests *
recursive-exclude draft *
recursive-exclude tools *

recursive-exclude res *
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,18 @@
> _Generación y análisis de retornos de portafolios artificiales y reales_
>
> Generation and analysis of artificial and real portfolio returns
-------------------------------------------
## Pasos para correr el proyecto

`git clone git@github.com:quatrope/garpar.git`

Luego de clonar el repositorio:

```
pip install build
python -m build
pip install dist/garpar-0.1-py3-none-any.whl
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 7 additions & 1 deletion garpar/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
from .portfolio import Portfolio, GARPAR_METADATA_KEY
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE

from .portfolio import GARPAR_METADATA_KEY, Portfolio
6 changes: 6 additions & 0 deletions garpar/core/_mixins.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE

import numpy as np

import pandas as pd
Expand Down
8 changes: 6 additions & 2 deletions garpar/core/covcorr_acc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import attr
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE

import numpy as np
import attr

from pypfopt import risk_models

Expand Down
8 changes: 7 additions & 1 deletion garpar/core/div_acc.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE

import attr

import numpy as np

import scipy.stats
# import scipy.stats

from sklearn.decomposition import PCA

Expand Down
8 changes: 7 additions & 1 deletion garpar/core/ereturns_acc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE

import attr

from pypfopt import expected_returns, objective_functions
from pypfopt import expected_returns

from ..utils import accabc

Expand Down
2 changes: 1 addition & 1 deletion garpar/core/plot_acc.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _ddf(self, returns):
def _wdf(self):
# proxy to access the dataframe with the weights
return self._pf.weights.to_frame(), "Weights"

def _edf(self):
return self._pf.entropy.to_frame(), "Entropy"

Expand Down
4 changes: 2 additions & 2 deletions garpar/core/portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

from . import (
covcorr_acc,
div_acc,
ereturns_acc,
plot_acc,
prices_acc,
risk_acc,
utilities_acc,
div_acc,
)
from ..utils import df_temporal_header, Bunch, entropy, scalers
from ..utils import Bunch, df_temporal_header, entropy, scalers

# =============================================================================
# CONSTANTS
Expand Down
10 changes: 6 additions & 4 deletions garpar/core/risk_acc.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE

import attr

import numpy as np

import pandas as pd

from pypfopt import expected_returns, objective_functions

import scipy.stats

from . import _mixins
from ..utils import accabc

Expand Down
6 changes: 6 additions & 0 deletions garpar/core/utilities_acc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE

import attr

from pypfopt import objective_functions
Expand Down
6 changes: 3 additions & 3 deletions garpar/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

from .base import PortfolioMakerABC, RandomEntropyPortfolioMakerABC
from .data import load_MERVAL
from .multisector import MultiSector, make_multisector
from .risso import (
RissoLevyStable,
RissoNormal,
RissoUniform,
make_risso_uniform,
make_risso_normal,
make_risso_levy_stable,
make_risso_normal,
make_risso_uniform,
)
from .multisector import MultiSector, make_multisector

__all__ = [
"PortfolioMakerABC",
Expand Down
11 changes: 9 additions & 2 deletions garpar/datasets/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import datetime as dt
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE

import os
import pathlib

Expand All @@ -10,7 +15,9 @@


def load_MERVAL(imputation="ffill", first=None, last=None):
"""Argentine stock market prices (MERVAL). Unlisted shares were eliminated."""
"""
Argentine stock market prices (MERVAL). Unlisted shares were eliminated.
"""
df = pd.read_csv(DATA_PATH / "merval.csv", index_col="Days")
df.index = pd.to_datetime(df.index)
df.sort_index(inplace=True)
Expand Down
13 changes: 9 additions & 4 deletions garpar/datasets/multisector.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE

import numpy as np
import pandas as pd

import pandas as pd

from .base import PortfolioMakerABC

from ..core.portfolio import Portfolio
from ..utils import mabc, Bunch, unique_names
from ..utils import Bunch, mabc, unique_names


class MultiSector(PortfolioMakerABC):
Expand All @@ -14,7 +19,7 @@ class MultiSector(PortfolioMakerABC):
@makers.validator
def _makers_validator(self, attribute, value):
if len(value) < 2:
raise ValueError(f"You must provide at least 2 makers")
raise ValueError("You must provide at least 2 makers")
for maker_name, maker in value:
if not isinstance(maker, PortfolioMakerABC):
cls_name = PortfolioMakerABC.__name__
Expand Down
4 changes: 2 additions & 2 deletions garpar/datasets/risso.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ def get_value(self, sign, refresher, random):


class RissoLevyStable(RissoABC):
alpha = mabc.hparam(default=1.6411, converter=float)
beta = mabc.hparam(default=-0.0126, converter=float)
alpha = mabc.hparam(default=1.6411, converter=float) # shape
beta = mabc.hparam(default=-0.0126, converter=float) # scale
mu = mabc.hparam(default=0.0005, converter=float) # loc
sigma = mabc.hparam(default=0.005, converter=float) # scale

Expand Down
2 changes: 1 addition & 1 deletion garpar/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import pandas as pd

from . import __version__ as VERSION
from .core import Portfolio, GARPAR_METADATA_KEY
from .core import GARPAR_METADATA_KEY, Portfolio

# =============================================================================
# CONSTANTS
Expand Down
6 changes: 6 additions & 0 deletions garpar/utils/entropy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE

from scipy import stats

import warnings
Expand Down
6 changes: 5 additions & 1 deletion garpar/utils/mabc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
"""MABC module."""
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE

import attr

Expand Down
6 changes: 6 additions & 0 deletions garpar/utils/scalers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This file is part of the
# Garpar Project (https://github.com/quatrope/garpar).
# Copyright (c) 2021, 2022, Nadia Luczywo, Juan Cabral and QuatroPe
# License: MIT
# Full Text: https://github.com/quatrope/garpar/blob/master/LICENSE

import numpy as np


Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[tool.black]
line-length = 79
target-version = ['py39']
line-length = 80
target-version = ['py38', 'py39', 'py310', 'py311']
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

57 changes: 57 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
attrs==23.2.0
black==24.4.2
build==1.2.1
cachetools==5.3.3
chardet==5.2.0
clarabel==0.8.1
click==8.1.7
colorama==0.4.6
contourpy==1.2.1
custom-inherit==2.4.1
cvxpy==1.5.1
cycler==0.12.1
Deprecated==1.2.14
distlib==0.3.8
ecos==2.0.13
filelock==3.14.0
fonttools==4.52.4
garpar @ file:///home/divasco/Documents/Tesina/garpar/dist/garpar-0.1-py3-none-any.whl#sha256=9f23544e68e8833ad6f84cb5fa3eb1ea5d538ea1e11a496572bc426ec99d8438
h5py==3.11.0
importlib_metadata==7.1.0
Jinja2==3.1.4
joblib==1.4.2
kiwisolver==1.4.5
MarkupSafe==2.1.5
matplotlib==3.8.4
methodtools==0.4.7
mypy-extensions==1.0.0
numpy==1.26.4
osqp==0.6.7
packaging==24.0
pandas==2.2.2
pathspec==0.12.1
pillow==10.3.0
platformdirs==4.2.2
pluggy==1.5.0
PuLP==2.8.0
pyparsing==3.1.2
pyportfolioopt==1.5.5
pyproject-api==1.6.1
pyproject_hooks==1.1.0
python-dateutil==2.9.0.post0
pytz==2024.1
qdldl==0.1.7.post2
scikit-criteria==0.8.7
scikit-learn==1.3.2
scipy==1.13.1
scs==3.2.4.post1
seaborn==0.13.2
setuptools==69.5.1
six==1.16.0
threadpoolctl==3.5.0
tox==4.15.0
tzdata==2024.1
virtualenv==20.26.2
wirerope==0.4.7
wrapt==1.16.0
zipp==3.19.0
Loading

0 comments on commit ec74acc

Please sign in to comment.