fix(selection): render gold brick chart as TDX brick blocks with strong-red flag

Match the ZXB1 sub-chart formula: each brick spans between yesterday's
and today's brick value via a stacked range bar — rising bricks are
hollow red (solid on strong_red), falling bricks solid green. The chart
API now also returns brick_strong_red per point.
This commit is contained in:
yuxuanhui
2026-09-05 14:58:02 +08:00
parent 3b50e75ef8
commit 50cac3575a
8 changed files with 124 additions and 33 deletions
@@ -127,10 +127,15 @@ def test_chart_skips_brick_series_by_default_and_computes_on_request() -> None:
"volume": [bar.volume for bar in history.bars],
}
)
expected = prepare_gold_brick_indicators(frame, history.ts_code)["brick_chart"]
assert brick_chart.points[-1].brick_chart == pytest.approx(float(expected.iloc[-1]))
prepared = prepare_gold_brick_indicators(frame, history.ts_code)
assert brick_chart.points[-1].brick_chart == pytest.approx(
float(prepared["brick_chart"].iloc[-1])
)
assert brick_chart.points[-1].brick_strong_red is bool(prepared["strong_red"].iloc[-1])
assert brick_chart.points[0].trade_date == history.bars[10].trade_date
assert brick_chart.points[0].brick_chart == pytest.approx(float(expected.iloc[10]))
assert brick_chart.points[0].brick_chart == pytest.approx(
float(prepared["brick_chart"].iloc[10])
)
def test_chart_rejects_empty_history() -> None: