Skip to content

Commit f4235bf

Browse files
committed
Fix: reset cache in single_period.py and multi_period.py
1 parent c29b6b3 commit f4235bf

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

okama/frontier/multi_period.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
import logging
1414

15+
import warnings
16+
warnings.simplefilter(action="ignore", category=FutureWarning)
17+
1518
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
1619
logger = logging.getLogger(__name__)
1720

@@ -41,6 +44,12 @@ class EfficientFrontierReb(asset_list.AssetList):
4144
ccy : str, default 'USD'
4245
Base currency for the list of assets. All risk metrics and returns are adjusted to the base currency.
4346
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+
4453
inflation : bool, default True
4554
Defines whether to take inflation data into account in the calculations.
4655
Including inflation could limit available data (last_date, first_date)
@@ -149,6 +158,9 @@ def bounds(self) -> Tuple[Tuple[float, ...], ...]:
149158

150159
@bounds.setter
151160
def bounds(self, bounds):
161+
162+
self._ef_points = pd.DataFrame(dtype=float)
163+
152164
if bounds:
153165
if len(bounds) != len(self.symbols):
154166
raise ValueError(
@@ -771,6 +783,7 @@ def compute_left_part_of_ef(i, target_cagr):
771783
row = self.minimize_risk(target_cagr)
772784
end_time = time.time()
773785
if self.verbose:
786+
logger.info(target_cagr)
774787
logger.info(f"left EF point #{i + 1}/{self.n_points} is done in {end_time - start_time:.2f} sec.")
775788
return row
776789

okama/frontier/single_period.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ def bounds(self) -> Tuple[Tuple[float, ...], ...]:
142142

143143
@bounds.setter
144144
def bounds(self, bounds):
145+
146+
self._ef_points = pd.DataFrame(dtype=float)
147+
145148
if bounds:
146149
if len(bounds) != len(self.symbols):
147150
raise ValueError(

0 commit comments

Comments
 (0)