主图增加笔/线段背驰与面积数字,并修正 SD99999 显示。

三周期分开关控制,只画数字不画图标;线段面积比沿用同向笔面积口径。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-09-10 04:33:40 +08:00
co-authored by Cursor
parent 6b72ba226b
commit 2cd50f1e01
11 changed files with 378 additions and 117 deletions
+26
View File
@@ -105,6 +105,32 @@ def test_analyze_chan_keys_on_fixture():
assert k in result["chan_macd"]
def test_bi_and_seg_area_div_computed():
from services.runtime import add_indicators, analyze_chan
df = add_indicators(make_ohlcv(400))
result = analyze_chan(df, symbol="TEST/USDT:USDT", timeframe="5m")
bis = result["bi_list"]
segs = result["seg_list"]
assert bis, "fixture should produce bi"
assert all(hasattr(bi, "macd_div") for bi in bis)
assert all(hasattr(seg, "macd_div") for seg in segs)
assert all(hasattr(bi, "macd_hist") for bi in bis)
assert all(hasattr(seg, "macd_hist") for seg in segs)
same_dir_bis = [bi for bi in bis if getattr(bi, "pre", None) and getattr(bi.pre, "pre", None)]
if same_dir_bis:
bi = same_dir_bis[-1]
prev = bi.pre.pre
if prev.macd_hist:
assert abs(bi.macd_div - (bi.macd_hist / prev.macd_hist)) < 1e-9
same_dir_segs = [seg for seg in segs if getattr(seg, "pre", None) and getattr(seg.pre, "pre", None)]
if same_dir_segs:
seg = same_dir_segs[-1]
prev = seg.pre.pre
if prev.macd_hist:
assert abs(seg.macd_div - (seg.macd_hist / prev.macd_hist)) < 1e-9
def test_serialize_chan_macd_shape():
from pytz import timezone