fix(lme): eliminate zero-drop spikes caused by exchange bank holidays and reporting gaps
This commit is contained in:
parent
92a9c489fb
commit
2b22b032c1
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -752,6 +752,7 @@ export function LmeView() {
|
|||
{/* Price Curve */}
|
||||
{showPrice && (
|
||||
<Area
|
||||
connectNulls={true}
|
||||
yAxisId="price"
|
||||
type="monotone"
|
||||
dataKey="priceVal"
|
||||
|
|
@ -767,6 +768,7 @@ export function LmeView() {
|
|||
{/* Stock Curve (Mapped to Left Y-Axis) */}
|
||||
{showStocks && stockLine && (
|
||||
<Line
|
||||
connectNulls={true}
|
||||
yAxisId="stocks"
|
||||
type="monotone"
|
||||
dataKey="stockVal"
|
||||
|
|
|
|||
Loading…
Reference in New Issue