From b1386449edc6829c3462dc8f9aff762b585469bc Mon Sep 17 00:00:00 2001 From: Alex Liu Date: Tue, 26 Sep 2023 14:46:55 +0800 Subject: [PATCH] Fix: Assertion when no event minute data is available (#70) --- tfmkt/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tfmkt/utils.py b/tfmkt/utils.py index 8314c36..8ba3f4e 100644 --- a/tfmkt/utils.py +++ b/tfmkt/utils.py @@ -37,6 +37,9 @@ def background_position_in_px_to_minute(px_x: int, px_y: int) -> int: for a in range(1, m) ] + if abs(px_y) > h*(m - 1 - y_offset): # no data available + return -1 + x = abs(px_x) / h assert x.is_integer() x = int(x) + x_offset