From ca694950710a9bed887976e4206c76f5b9cd77bf Mon Sep 17 00:00:00 2001 From: Sam Fredrickson Date: Sun, 17 Nov 2024 15:53:14 -0800 Subject: [PATCH] it's an error not to provide halving dates --- model.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/model.py b/model.py index ecd9039..480ee13 100644 --- a/model.py +++ b/model.py @@ -28,6 +28,9 @@ def get_cycle_position(date, halving_dates): Calculate position in halving cycle (0 to 1) for a given date. 0 represents a halving event, 1 represents just before the next halving. """ + if len(halving_dates) == 0: + raise Exception("halving dates cannot be empty") + # Convert date to datetime if it's not already date = pd.to_datetime(date)