Coverage for src / cvx / markowitz / names.py: 100%
33 statements
« prev ^ index » next coverage.py v7.12.0, created at 2025-12-08 13:49 +0000
« prev ^ index » next coverage.py v7.12.0, created at 2025-12-08 13:49 +0000
1# Copyright 2023 Stanford University Convex Optimization Group
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# see https://stackoverflow.com/a/54950492/1695486
16"""Centralized string constants used across the Markowitz package.
18These names index data dictionaries, model maps, constraints, and parameters.
19Keeping them in one place avoids typos and improves discoverability.
20"""
23class DataNames:
24 """Keys for data items passed into models and builders."""
26 RETURNS = "returns"
27 MU = "mu"
28 MU_UNCERTAINTY = "mu_uncertainty"
29 CHOLESKY = "chol"
30 VOLA_UNCERTAINTY = "vola_uncertainty"
31 LOWER_BOUND_ASSETS = "lower_assets"
32 LOWER_BOUND_FACTORS = "lower_factors"
33 UPPER_BOUND_ASSETS = "upper_assets"
34 UPPER_BOUND_FACTORS = "upper_factors"
35 EXPOSURE = "exposure"
36 HOLDING_COSTS = "holding_costs"
37 IDIOSYNCRATIC_VOLA = "idiosyncratic_vola"
38 IDIOSYNCRATIC_VOLA_UNCERTAINTY = "idiosyncratic_vola_uncertainty"
39 SYSTEMATIC_VOLA_UNCERTAINTY = "systematic_vola_uncertainty"
40 FACTOR_WEIGHTS = "factor_weights"
41 WEIGHTS = "weights"
42 _ABS = "_abs"
45class ModelName:
46 """Keys for model components bundled inside a builder/problem."""
48 RISK = "risk"
49 RETURN = "return"
50 BOUND_ASSETS = "bound_assets"
51 BOUND_FACTORS = "bound_factors"
54class ConstraintName:
55 """Canonical names for constraints used in builders/problems."""
57 BUDGET = "budget"
58 CONCENTRATION = "concentration"
59 LONG_ONLY = "long_only"
60 LEVERAGE = "leverage"
61 RISK = "risk"
64class ParameterName:
65 """Keys for tunable problem parameters."""
67 SIGMA_MAX = "sigma_max"
68 OMEGA = "omega"
69 SIGMA_TARGET = "sigma_target"