Skip to content

Commit 4ab4b09

Browse files
committed
chore: symbol argument must be Optional in Portfolio
1 parent df4fa8f commit 4ab4b09

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

okama/portfolio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Portfolio(make_asset_list.ListMaker):
6767
-abs_deviation: the absolute deviation allowed for the assets weights in the portfolio.
6868
-rel_deviation: the relative deviation allowed for the assets weights in the portfolio.
6969
70-
symbol : str
70+
symbol : str, optional
7171
Text symbol of portfolio. It is similar to tickers but have a namespace information.
7272
Portfolio symbol must end with .PF (all_weather_portfolio.PF).
7373
If not defined a random symbol is generated (portfolio_7802.PF).
@@ -83,7 +83,7 @@ def __init__(
8383
inflation: bool = True,
8484
weights: Optional[List[float]] = None,
8585
rebalancing_strategy: Rebalance = Rebalance(period="month"),
86-
symbol: str,
86+
symbol: str = None,
8787
):
8888
super().__init__(
8989
assets,

tests/test_frontier_reb.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_ef_points_reb(init_efficient_frontier_reb):
107107
"target_cagr_1": 0.060973018282528796,
108108
"expected_risk_1": 0.13878,
109109
"target_cagr_2": 0.1035764996098511,
110-
"expected_risk_2": 0.13428,
110+
"expected_risk_2": 0.11948,
111111
},
112112
}
113113

@@ -130,10 +130,10 @@ def test_minimize_risk_without_bounds(init_frontier_without_bounds):
130130
params = test_params["without_bounds"]
131131

132132
result = init_frontier_without_bounds.minimize_risk(params["target_cagr_1"])
133-
assert np.isclose(result["Risk"], params["expected_risk_1"], rtol=1e-2)
133+
assert np.isclose(result["Risk"], params["expected_risk_1"], atol=1e-1)
134134

135135
result = init_frontier_without_bounds.minimize_risk(params["target_cagr_2"])
136-
assert np.isclose(result["Risk"], params["expected_risk_2"], rtol=1e-2)
136+
assert np.isclose(result["Risk"], params["expected_risk_2"], atol=1e-1)
137137

138138

139139
@mark.rebalance

0 commit comments

Comments
 (0)