Introduce V2 of current and historical functions

This commit is contained in:
2024-11-03 23:18:06 -08:00
parent 27cd98ee52
commit ff8e182336
21 changed files with 655 additions and 428 deletions

View File

@@ -0,0 +1,14 @@
class CachedRange:
_PRECOMPUTE_RANGES = ['30d', '90d', '6m', '1y', '2y', 'all']
# I despise magic strings but this is about as good as I can get without enum support
def __init__(self, _range: str):
if _range not in CachedRange._PRECOMPUTE_RANGES:
raise ValueError(f'Invalid range: {_range}')
self._range = _range
@property
def range(self):
return self._range
def __str__(self):
return self._range