Skip to content

Commit

Permalink
Moved family to top
Browse files Browse the repository at this point in the history
  • Loading branch information
Divasco committed Jul 11, 2024
1 parent e9a9bb1 commit 0910d74
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions garpar/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ def get_optimizer_family(cls):
# OPTIMIZER
# =============================================================================

class MVOptimizer(OptimizerABC):
class MeanVarianceFamilyMixin:
"""Mixin class for mean-variance family optimizers."""

family = "mean-variance"

class MVOptimizer(MeanVarianceFamilyMixin, OptimizerABC):
"""Mean Variance Optimizer."""

weight_bounds = mabc.hparam(default=(0, 1))
Expand Down Expand Up @@ -177,13 +182,7 @@ def _calculate_weights(self, pf):
else:
return self.__calculate_weights_general(pf)

class MeanVarianceFamilyMixin:
"""Mixin class for mean-variance family optimizers."""

family = "mean-variance"


class Markowitz(MeanVarianceFamilyMixin, OptimizerABC):
class Markowitz(MVOptimizer):
"""Classic Markowitz model.
This method implements the Classic Model Markowitz 1952 in Mansini, R.,
Expand Down Expand Up @@ -211,11 +210,15 @@ class Markowitz(MeanVarianceFamilyMixin, OptimizerABC):
Available optimization strategies.
"""

target_return = mabc.hparam(default=None)
target_return = mabc.hparam(default=None) # No es buena idea hacer esto. Preguntarle a Juan

weight_bounds = mabc.hparam(default=(0, 1))

market_neutral = mabc.hparam(default=False)

returns = mabc.hparam(default="mah")
returns_kw = mabc.hparam(factory=dict)

covariance = mabc.hparam(default="sample_cov")
covariance_kw = mabc.hparam(factory=dict)

Expand Down

0 comments on commit 0910d74

Please sign in to comment.