From fffb37852bcb8a0cc2421f9e6a0a72753c2e142d Mon Sep 17 00:00:00 2001 From: azul Date: Fri, 4 Jul 2025 15:55:11 -0700 Subject: [PATCH] feat: allow more frequencies --- src/timesfm/timesfm_base.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/timesfm/timesfm_base.py b/src/timesfm/timesfm_base.py index b0a622a..73b1495 100644 --- a/src/timesfm/timesfm_base.py +++ b/src/timesfm/timesfm_base.py @@ -57,9 +57,18 @@ def freq_map(freq: str): return 1 elif freq.endswith(("H", "T", "MIN", "D", "B", "U", "S")): return 0 - elif freq.endswith(("W", "M")): + elif ( + freq.endswith(("W", "M")) + or freq.startswith("W-") + or (freq.startswith("M") and len(freq) == 2) + ): return 1 - elif freq.endswith(("Y", "Q", "A")): + elif ( + freq.endswith(("Y", "Q", "A")) + or freq.startswith("Y-") + or freq.startswith("Q-") + or freq.startswith("A-") + ): return 2 else: raise ValueError(f"Invalid frequency: {freq}")