@@ -701,15 +701,20 @@ def _target_cagr_range_left(self) -> np.ndarray:
701701 Full range of CAGR values (from min to max).
702702 """
703703 # Case 1: Left asset's CAGR is bigger than right asset's CAGR
704- if ( hasattr (self , '_min_ratio_asset_left_to_max_cagr' ) and
705- hasattr (self , '_max_ratio_asset_right_to_max_cagr' ) and
706- self . _min_ratio_asset_left_to_max_cagr and
707- self . _max_ratio_asset_right_to_max_cagr and
708- self . _min_ratio_asset_left_to_max_cagr [ 'min_asset_cagr' ] >=
709- self ._max_ratio_asset_right_to_max_cagr [ 'max_asset_cagr' ]):
704+ has_min_ratio = hasattr (self , '_min_ratio_asset_left_to_max_cagr' )
705+ has_max_ratio = hasattr (self , '_max_ratio_asset_right_to_max_cagr' )
706+
707+ if has_min_ratio and has_max_ratio :
708+ min_ratio_data = self . _min_ratio_asset_left_to_max_cagr
709+ max_ratio_data = self ._max_ratio_asset_right_to_max_cagr
710710
711- left_cagr = self ._min_ratio_asset_left_to_max_cagr ['min_asset_cagr' ]
712- return np .linspace (left_cagr , self .global_max_return_portfolio ["CAGR" ], self .n_points )
711+ if min_ratio_data is not None and max_ratio_data is not None :
712+ left_cagr = min_ratio_data .get ('min_asset_cagr' )
713+ right_cagr = max_ratio_data .get ('max_asset_cagr' )
714+
715+ if left_cagr is not None and right_cagr is not None :
716+ if left_cagr >= right_cagr :
717+ return np .linspace (left_cagr , self .global_max_return_portfolio ["CAGR" ], self .n_points )
713718
714719 # Case 2: Left asset's CAGR is less than right asset's CAGR
715720 if self .full_frontier :
@@ -735,6 +740,7 @@ def _target_cagr_range_right(self) -> Optional[np.ndarray]:
735740 number_of_points = round (self .n_points / k ) + 1 if k > 1 else self .n_points
736741 target_range = np .linspace (max_cagr , ticker_cagr , number_of_points )
737742 return target_range [1 :] # skip the first point (max cagr) as it presents in the left part of the EF
743+ return None
738744
739745 @property
740746 def target_risk_range (self ) -> np .ndarray :
0 commit comments