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 +1 -1
- rangekeeper/duration.py +8 -8
- rangekeeper/flux.py +8 -3
- {rangekeeper-0.8.26.dist-info → rangekeeper-0.8.28.dist-info}/METADATA +1 -1
- {rangekeeper-0.8.26.dist-info → rangekeeper-0.8.28.dist-info}/RECORD +7 -7
- {rangekeeper-0.8.26.dist-info → rangekeeper-0.8.28.dist-info}/WHEEL +0 -0
- {rangekeeper-0.8.26.dist-info → rangekeeper-0.8.28.dist-info}/top_level.txt +0 -0
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
|
-
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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,
|
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.
|
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=
|
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=
|
4
|
+
rangekeeper/duration.py,sha256=_E9owP1-WfMhofLajGRMHvlhjlcAy5cqVkNeB7CyMws,20417
|
5
5
|
rangekeeper/extrapolation.py,sha256=Zfsz2KwkImxEMMCNZaF8RpiQxlIgemS1dQkSnjliYU4,2814
|
6
|
-
rangekeeper/flux.py,sha256=
|
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.
|
24
|
-
rangekeeper-0.8.
|
25
|
-
rangekeeper-0.8.
|
26
|
-
rangekeeper-0.8.
|
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,,
|
File without changes
|
File without changes
|