diff --git a/backend/scrape_lme.py b/backend/scrape_lme.py index 4bd6b63..8fe6ece 100644 --- a/backend/scrape_lme.py +++ b/backend/scrape_lme.py @@ -286,6 +286,7 @@ def get_entire_diagram_data(field: str, ttl_seconds: int = 3600): series_type = "price" pts = [] + last_valid_y = None for val in line: raw_x = val.attrib.get('x', '') # YYYY/MM/DD date_iso = raw_x.replace('/', '-') @@ -298,6 +299,15 @@ def get_entire_diagram_data(field: str, ttl_seconds: int = 3600): except: y_val = 0.0 + # Filter out bank holiday / reporting zero anomalies (e.g. market closed) + if y_val <= 0: + if last_valid_y is not None: + y_val = last_valid_y + else: + continue + else: + last_valid_y = y_val + pts.append({ "x": date_iso, "date_display": date_display, diff --git a/frontend/src/components/LmeView.tsx b/frontend/src/components/LmeView.tsx index f99818d..cc4854b 100644 --- a/frontend/src/components/LmeView.tsx +++ b/frontend/src/components/LmeView.tsx @@ -752,6 +752,7 @@ export function LmeView() { {/* Price Curve */} {showPrice && (