Rangekeeper 0.8.26__py3-none-any.whl → 0.8.28__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
rangekeeper/__init__.py CHANGED
@@ -1,10 +1,10 @@
1
1
  from . import api as api
2
+ from . import measure as measure
2
3
  from . import distribution as distribution
3
4
  from . import duration as duration
4
5
  from . import extrapolation as extrapolation
5
6
  from . import flux as flux
6
7
  from . import graph as graph
7
- from . import measure as measure
8
8
  from . import policy as policy
9
9
  from . import projection as projection
10
10
  from . import segmentation as segmentation
rangekeeper/duration.py CHANGED
@@ -18,7 +18,7 @@ class Type(enum.Enum):
18
18
  SEMIYEAR = "6M"
19
19
  QUARTER = "Q"
20
20
  MONTH = "M"
21
- BIWEEKLY = "2W"
21
+ BIWEEK = "2W"
22
22
  WEEK = "W"
23
23
  DAY = "D"
24
24
 
@@ -39,7 +39,7 @@ class Type(enum.Enum):
39
39
  if value == "M":
40
40
  return Type.MONTH
41
41
  if value in ("2W", "2W-SUN"):
42
- return Type.BIWEEKLY
42
+ return Type.BIWEEK
43
43
  if value in ("W-SUN", "W"):
44
44
  return Type.WEEK
45
45
  if value == "D":
@@ -63,7 +63,7 @@ class Type(enum.Enum):
63
63
  return "Q"
64
64
  if type == Type.MONTH:
65
65
  return "M"
66
- if type == Type.BIWEEKLY:
66
+ if type == Type.BIWEEK:
67
67
  return "2W"
68
68
  if type == Type.WEEK:
69
69
  return "W"
@@ -88,7 +88,7 @@ class Type(enum.Enum):
88
88
  return "QE"
89
89
  if type == Type.MONTH:
90
90
  return "ME"
91
- if type == Type.BIWEEKLY:
91
+ if type == Type.BIWEEK:
92
92
  return "2W"
93
93
  if type == Type.WEEK:
94
94
  return "W"
@@ -129,7 +129,7 @@ def measure(
129
129
  result = (delta.years * 4) + math.floor(delta.months / 3)
130
130
  elif duration.value == Type.MONTH.value:
131
131
  result = (delta.years * 12) + delta.months
132
- elif duration.value == Type.BIWEEKLY.value:
132
+ elif duration.value == Type.BIWEEK.value:
133
133
  result = math.floor((calc_end_date - start_date).days / 14)
134
134
  elif duration.value == Type.WEEK.value:
135
135
  result = math.floor((calc_end_date - start_date).days / 7)
@@ -177,7 +177,7 @@ def offset(
177
177
  result = date + pd.offsets.MonthEnd(3 * amount)
178
178
  elif duration.value == Type.MONTH.value:
179
179
  result = date + pd.offsets.MonthEnd(amount)
180
- elif duration.value == Type.BIWEEKLY.value:
180
+ elif duration.value == Type.BIWEEK.value:
181
181
  result = date + pd.DateOffset(weeks=2 * amount)
182
182
  elif duration.value == Type.WEEK.value:
183
183
  result = date + pd.DateOffset(weeks=amount)
@@ -200,7 +200,7 @@ def offset(
200
200
  result = date + pd.DateOffset(months=3 * amount)
201
201
  elif duration.value == Type.MONTH.value:
202
202
  result = date + pd.DateOffset(months=amount)
203
- elif duration.value == Type.BIWEEKLY.value:
203
+ elif duration.value == Type.BIWEEK.value:
204
204
  result = date + pd.DateOffset(weeks=2 * amount)
205
205
  elif duration.value == Type.WEEK.value:
206
206
  result = date + pd.DateOffset(weeks=amount)
@@ -245,7 +245,7 @@ class Period:
245
245
  Type.SEMIYEAR: 2,
246
246
  Type.QUARTER: 4,
247
247
  Type.MONTH: 12,
248
- Type.BIWEEKLY: 26,
248
+ Type.BIWEEK: 26,
249
249
  Type.WEEK: 52,
250
250
  Type.DAY: 365,
251
251
  }.get(duration, None)
rangekeeper/flux.py CHANGED
@@ -1,9 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import datetime
4
- import itertools
5
4
  import json
6
- import locale
7
5
  import os
8
6
  from typing import Dict, Union, Optional, Tuple, List
9
7
 
@@ -325,12 +323,19 @@ class Flow:
325
323
  )
326
324
 
327
325
  def xirr(
328
- self, registry: pint.UnitRegistry = rk.measure.Index.registry
326
+ self,
327
+ registry: pint.UnitRegistry = None,
329
328
  ) -> pint.Quantity:
330
329
  """
331
330
  Returns the XIRR (Extended Internal Rate of Return) of the Flow's movements.
332
331
  Formats the result as a percentage in the specified registry's units.
333
332
  """
333
+ # Lazy import to avoid circular dependency
334
+ if registry is None:
335
+ from rangekeeper.measure import Index
336
+
337
+ registry = Index.registry
338
+
334
339
  result = pyxirr.xirr(
335
340
  dates=list(self.movements.index.array),
336
341
  amounts=self.movements.to_list(),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Rangekeeper
3
- Version: 0.8.26
3
+ Version: 0.8.28
4
4
  Summary: A Python library assisting financial modelling in real estate asset & development planning, decision-making, cashflow forecasting, and scenario analysis.
5
5
  Author-email: Daniel Fink <danfink@mit.edu>
6
6
  License-Expression: MPL-2.0
@@ -1,9 +1,9 @@
1
- rangekeeper/__init__.py,sha256=3ed6dqjrwb0_Z1le9oItyOFHFrAtP0XJIVhZG07iqZ0,1731
1
+ rangekeeper/__init__.py,sha256=8q0KF90SLgIfptpFGuI66FOCqe3K9UgIzTHFL1pwP4Y,1731
2
2
  rangekeeper/api.py,sha256=3nuG7C2IQjpumcn79MvYDTa7ADWPAos7VfVM-3pL4n4,4798
3
3
  rangekeeper/distribution.py,sha256=2C3jhi1rLJUs0seBztdQb196hNhc00sKJEGMkFiDpYs,8961
4
- rangekeeper/duration.py,sha256=9GU6dcZTL_OAOgEHLGkCVxjG16_Po1IMEU29K5g4iRM,20433
4
+ rangekeeper/duration.py,sha256=_E9owP1-WfMhofLajGRMHvlhjlcAy5cqVkNeB7CyMws,20417
5
5
  rangekeeper/extrapolation.py,sha256=Zfsz2KwkImxEMMCNZaF8RpiQxlIgemS1dQkSnjliYU4,2814
6
- rangekeeper/flux.py,sha256=R7W8GwiVcgRSw8Y1GgucrcQpWDFYS510EP2uRslRc5s,31916
6
+ rangekeeper/flux.py,sha256=25-jSnBrO9QGDXpuNahaVFUiJrHAWaiTda1uplUXFck,32043
7
7
  rangekeeper/format.py,sha256=DOfF4-LCXqWyCtE1OomwE80sJLe6LjL4gqEOAP454LQ,10796
8
8
  rangekeeper/graph.py,sha256=6oWRv-qzGsM5Z19UyJ1v3hwtWaQp_F4qQKxizvkQ_gg,28043
9
9
  rangekeeper/measure.py,sha256=eCdoTAocq1loNZBnOp3nPiPV7yIi0QTwpVHvjba1hkY,4125
@@ -20,7 +20,7 @@ rangekeeper/dynamics/trend.py,sha256=-WqrRvmmTj2mE24Pz-Dl5lXEpLXnDUMngafU__em_ac
20
20
  rangekeeper/dynamics/volatility.py,sha256=MGDLzrI1uP_C6HL-pigJwWikHg1KNbfB_0m0Akh-L2A,5162
21
21
  rangekeeper/formula/__init__.py,sha256=4OXzdJAYDBxQeOMzLR5MZvIjxxIfFOTE9aNu9zFryAE,36
22
22
  rangekeeper/formula/financial.py,sha256=oNFdhygbtdEUFjpxYFuuDnpC_P8nOO538b21FzaMtTU,14045
23
- rangekeeper-0.8.26.dist-info/METADATA,sha256=uvEDt-iGG-ofh01UcYM3srEUOUW9OxpHV-GOE5lL8PU,2212
24
- rangekeeper-0.8.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- rangekeeper-0.8.26.dist-info/top_level.txt,sha256=7ov6d70lppmzKc088MAmRWnCtCRGA2cd43G28QBSv-c,12
26
- rangekeeper-0.8.26.dist-info/RECORD,,
23
+ rangekeeper-0.8.28.dist-info/METADATA,sha256=Wo1fsizJdyibP480ZHP2AfbQjg-xn2xwwKS_X7Ac3hk,2212
24
+ rangekeeper-0.8.28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
+ rangekeeper-0.8.28.dist-info/top_level.txt,sha256=7ov6d70lppmzKc088MAmRWnCtCRGA2cd43G28QBSv-c,12
26
+ rangekeeper-0.8.28.dist-info/RECORD,,