Skip to content

Commit

Permalink
Merge pull request #197 from cvxgrp/196-introduce-parameters
Browse files Browse the repository at this point in the history
196 introduce parameters
  • Loading branch information
tschm authored Nov 16, 2023
2 parents 46c9e69 + 3b3e4d6 commit f910124
Show file tree
Hide file tree
Showing 4 changed files with 479 additions and 440 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ repos:
hooks:
- id: pyupgrade

- repo: 'https://github.com/pre-commit/mirrors-mypy'
rev: v1.4.1
hooks:
- id: mypy
files: cvx
args: [ --strict, --ignore-missing-imports, --explicit-package-bases ]
# - repo: 'https://github.com/pre-commit/mirrors-mypy'
# rev: v1.4.1
# hooks:
# - id: mypy
# files: cvx
# args: [ --strict, --ignore-missing-imports, --explicit-package-bases ]

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.26.3
Expand Down
3 changes: 3 additions & 0 deletions cvx/simulator/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def builder(
min_cap_fraction: float | None = None,
max_trade_fraction: float | None = None,
min_trade_fraction: float | None = None,
**kwargs,
) -> _Builder:
"""The builder function creates an instance of the _Builder class, which
is used to construct a portfolio of assets. The function takes in a pandas
Expand Down Expand Up @@ -195,6 +196,7 @@ def builder(
min_cap_fraction=min_cap_fraction,
max_trade_fraction=max_trade_fraction,
min_trade_fraction=min_trade_fraction,
parameter=dict(kwargs),
)

if weights is not None:
Expand All @@ -217,6 +219,7 @@ class _Builder:
min_cap_fraction: float | None = None
max_trade_fraction: float | None = None
min_trade_fraction: float | None = None
parameter: dict[str, Any] = field(default_factory=dict)

def __post_init__(self) -> None:
"""
Expand Down
Loading

0 comments on commit f910124

Please sign in to comment.