|
12 | 12 |
|
13 | 13 | import logging |
14 | 14 |
|
| 15 | +import warnings |
| 16 | +warnings.simplefilter(action="ignore", category=FutureWarning) |
| 17 | + |
15 | 18 | logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') |
16 | 19 | logger = logging.getLogger(__name__) |
17 | 20 |
|
@@ -41,6 +44,12 @@ class EfficientFrontierReb(asset_list.AssetList): |
41 | 44 | ccy : str, default 'USD' |
42 | 45 | Base currency for the list of assets. All risk metrics and returns are adjusted to the base currency. |
43 | 46 |
|
| 47 | + bounds: tuple of ((float, float),...) |
| 48 | + Bounds for the assets weights. Each asset can have weights limitation from 0 to 1.0. |
| 49 | + If an asset has limitation for 10 to 20%, bounds are defined as (0.1, 0.2). |
| 50 | + bounds = ((0, .5), (0, 1)) shows that in Portfolio with two assets first one has weight limitations |
| 51 | + from 0 to 50%. The second asset has no limitations. |
| 52 | +
|
44 | 53 | inflation : bool, default True |
45 | 54 | Defines whether to take inflation data into account in the calculations. |
46 | 55 | Including inflation could limit available data (last_date, first_date) |
@@ -149,6 +158,9 @@ def bounds(self) -> Tuple[Tuple[float, ...], ...]: |
149 | 158 |
|
150 | 159 | @bounds.setter |
151 | 160 | def bounds(self, bounds): |
| 161 | + |
| 162 | + self._ef_points = pd.DataFrame(dtype=float) |
| 163 | + |
152 | 164 | if bounds: |
153 | 165 | if len(bounds) != len(self.symbols): |
154 | 166 | raise ValueError( |
@@ -771,6 +783,7 @@ def compute_left_part_of_ef(i, target_cagr): |
771 | 783 | row = self.minimize_risk(target_cagr) |
772 | 784 | end_time = time.time() |
773 | 785 | if self.verbose: |
| 786 | + logger.info(target_cagr) |
774 | 787 | logger.info(f"left EF point #{i + 1}/{self.n_points} is done in {end_time - start_time:.2f} sec.") |
775 | 788 | return row |
776 | 789 |
|
|
0 commit comments