From fbed1cf3e45f04dd860be7540ca3f201d2e34566 Mon Sep 17 00:00:00 2001 From: minkyu kim Date: Sun, 25 Aug 2024 14:38:33 +0900 Subject: [PATCH 1/6] Update simple_moving_average.py Add ValueError: Ensure window size is smaller than the total length of the time series --- financial/simple_moving_average.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/financial/simple_moving_average.py b/financial/simple_moving_average.py index f5ae444fd027..d3b2ffc7e141 100644 --- a/financial/simple_moving_average.py +++ b/financial/simple_moving_average.py @@ -34,6 +34,9 @@ def simple_moving_average( if window_size < 1: raise ValueError("Window size must be a positive integer") + if window_size > len(data): + raise ValueError("Window size must be smaller than the total length of the time series") + sma: list[float | None] = [] for i in range(len(data)): From e2c5795d79f41f7b336f877a1510b5c32140917f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 25 Aug 2024 05:41:13 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- financial/simple_moving_average.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/financial/simple_moving_average.py b/financial/simple_moving_average.py index d3b2ffc7e141..92d35308c43d 100644 --- a/financial/simple_moving_average.py +++ b/financial/simple_moving_average.py @@ -35,7 +35,9 @@ def simple_moving_average( raise ValueError("Window size must be a positive integer") if window_size > len(data): - raise ValueError("Window size must be smaller than the total length of the time series") + raise ValueError( + "Window size must be smaller than the total length of the time series" + ) sma: list[float | None] = [] From 0cde301d1d2bb96dbfae0e9f469a1d93780ee5da Mon Sep 17 00:00:00 2001 From: minkyu kim Date: Sun, 25 Aug 2024 14:54:33 +0900 Subject: [PATCH 3/6] Update simple_moving_average.py Changes have been applied. --- financial/simple_moving_average.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/financial/simple_moving_average.py b/financial/simple_moving_average.py index 92d35308c43d..b945ea49736a 100644 --- a/financial/simple_moving_average.py +++ b/financial/simple_moving_average.py @@ -35,10 +35,8 @@ def simple_moving_average( raise ValueError("Window size must be a positive integer") if window_size > len(data): - raise ValueError( - "Window size must be smaller than the total length of the time series" - ) - + raise ValueError("Window size must be smaller than the total length of the time series") + sma: list[float | None] = [] for i in range(len(data)): From 0b564f8d2b26f24f0050e259190ab2c3fcd198b7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 25 Aug 2024 05:54:52 +0000 Subject: [PATCH 4/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- financial/simple_moving_average.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/financial/simple_moving_average.py b/financial/simple_moving_average.py index b945ea49736a..92d35308c43d 100644 --- a/financial/simple_moving_average.py +++ b/financial/simple_moving_average.py @@ -35,8 +35,10 @@ def simple_moving_average( raise ValueError("Window size must be a positive integer") if window_size > len(data): - raise ValueError("Window size must be smaller than the total length of the time series") - + raise ValueError( + "Window size must be smaller than the total length of the time series" + ) + sma: list[float | None] = [] for i in range(len(data)): From f1369ec2317c878a6471e382151af897237ff208 Mon Sep 17 00:00:00 2001 From: minkyu kim Date: Mon, 26 Aug 2024 09:49:15 +0900 Subject: [PATCH 5/6] Update simple_moving_average.py --- financial/simple_moving_average.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/financial/simple_moving_average.py b/financial/simple_moving_average.py index 92d35308c43d..d3b2ffc7e141 100644 --- a/financial/simple_moving_average.py +++ b/financial/simple_moving_average.py @@ -35,9 +35,7 @@ def simple_moving_average( raise ValueError("Window size must be a positive integer") if window_size > len(data): - raise ValueError( - "Window size must be smaller than the total length of the time series" - ) + raise ValueError("Window size must be smaller than the total length of the time series") sma: list[float | None] = [] From afa715df404c59d2ba8e15a41f840ead3fbaa461 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 00:49:37 +0000 Subject: [PATCH 6/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- financial/simple_moving_average.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/financial/simple_moving_average.py b/financial/simple_moving_average.py index d3b2ffc7e141..92d35308c43d 100644 --- a/financial/simple_moving_average.py +++ b/financial/simple_moving_average.py @@ -35,7 +35,9 @@ def simple_moving_average( raise ValueError("Window size must be a positive integer") if window_size > len(data): - raise ValueError("Window size must be smaller than the total length of the time series") + raise ValueError( + "Window size must be smaller than the total length of the time series" + ) sma: list[float | None] = []