Skip to content

Commit

Permalink
refactor: according flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
chilango74 committed Oct 8, 2022
1 parent becc03a commit 7f57f60
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion okama/frontier/multi_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ def _max_cagr_asset(self) -> dict:

@property
def _max_cagr_asset_right_to_max_cagr(self) -> Optional[dict]:
# sourcery skip: use-named-expression
"""
The asset with max CAGR lying to the right of the global max CAGR point
(risk should be more than self.max_return['Risk']).
Expand All @@ -540,7 +541,8 @@ def _max_cagr_asset_right_to_max_cagr(self) -> Optional[dict]:
"""
tolerance = 0.01 # assets CAGR should be less than max CAGR with certain tolerance
cagr = helpers.Frame.get_cagr(self.assets_ror)
if global_max_cagr_is_not_asset := (cagr < self.global_max_return_portfolio["CAGR"] * (1 - tolerance)).all():
global_max_cagr_is_not_asset = (cagr < self.global_max_return_portfolio["CAGR"] * (1 - tolerance)).all()
if global_max_cagr_is_not_asset:
condition = self.risk_annual.values > self.global_max_return_portfolio["Risk"]
ror_selected = self.assets_ror.loc[:, condition]
if not ror_selected.empty:
Expand Down

0 comments on commit 7f57f60

Please sign in to comment.