主图增加笔/线段背驰与面积数字,并修正 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
+21 -9
View File
@@ -108,7 +108,8 @@ def analyze():
'start_price': bi.start_klc.low if convert_direction(bi.dir) == 1 else bi.start_klc.high,
'end_price': bi.end_klc.high if convert_direction(bi.dir) == 1 else bi.end_klc.low if bi.end_klc else None,
'direction': convert_direction(bi.dir),
'macd_div': float(bi.macd_div) if hasattr(bi, 'macd_div') else 0
'macd_div': float(bi.macd_div) if hasattr(bi, 'macd_div') else 0,
'macd_hist': float(bi.macd_hist) if getattr(bi, 'macd_hist', None) is not None else 0
} for bi in analysis_result['bi_list'] if bi.is_sure],
# 添加未完成笔列表
'uncompleted_bi_list': [{
@@ -118,7 +119,8 @@ def analyze():
'start_price': bi.start_klc.low if convert_direction(bi.dir) == 1 else bi.start_klc.high,
'end_price': bi.end_klc.low if convert_direction(bi.dir) == 1 else bi.end_klc.high, # 未完成笔没有结束价格
'direction': convert_direction(bi.dir),
'macd_div': float(bi.macd_div) if hasattr(bi, 'macd_div') else 0
'macd_div': float(bi.macd_div) if hasattr(bi, 'macd_div') else 0,
'macd_hist': float(bi.macd_hist) if getattr(bi, 'macd_hist', None) is not None else 0
} for bi in analysis_result['bi_list'] if not bi.is_sure],
'seg_list': [{
'start_time': seg.start_bi.start_klc.end_time if isinstance(seg.start_bi.start_klc.end_time, str) else seg.start_bi.start_klc.end_time.astimezone(client_tz).isoformat(),
@@ -126,7 +128,9 @@ def analyze():
'sure_time': format_time_safely(seg.sure_time, client_tz) if seg.sure_time else None,
'start_price': seg.start_bi.start_klc.low if convert_direction(seg.dir) == 1 else seg.start_bi.start_klc.high,
'end_price': seg.end_bi.end_klc.high if convert_direction(seg.dir) == 1 else seg.end_bi.end_klc.low if seg.end_bi else None,
'direction': convert_direction(seg.dir)
'direction': convert_direction(seg.dir),
'macd_div': float(getattr(seg, 'macd_div', 0) or 0),
'macd_hist': float(getattr(seg, 'macd_hist', 0) or 0)
} for seg in analysis_result['seg_list'] if seg.is_sure],
# 添加未完成线段列表
'uncompleted_seg_list': get_uncompleted_seg_list(analysis_result['seg_list'], client_tz),
@@ -305,7 +309,8 @@ def analyze():
'start_price': bi.start_klc.low if convert_direction(bi.dir) == 1 else bi.start_klc.high,
'end_price': bi.end_klc.high if convert_direction(bi.dir) == 1 else bi.end_klc.low if bi.end_klc else None,
'direction': convert_direction(bi.dir),
'macd_div': float(bi.macd_div) if hasattr(bi, 'macd_div') else 0
'macd_div': float(bi.macd_div) if hasattr(bi, 'macd_div') else 0,
'macd_hist': float(bi.macd_hist) if getattr(bi, 'macd_hist', None) is not None else 0
} for bi in element_analysis['bi_list'] if bi.is_sure]
# 添加次周期未完成笔列表
result['element_uncompleted_bi_list'] = [{
@@ -315,7 +320,8 @@ def analyze():
'start_price': bi.start_klc.low if convert_direction(bi.dir) == 1 else bi.start_klc.high,
'end_price': bi.end_klc.low if convert_direction(bi.dir) == 1 else bi.end_klc.high, # 未完成笔没有结束价格
'direction': convert_direction(bi.dir),
'macd_div': float(bi.macd_div) if hasattr(bi, 'macd_div') else 0
'macd_div': float(bi.macd_div) if hasattr(bi, 'macd_div') else 0,
'macd_hist': float(bi.macd_hist) if getattr(bi, 'macd_hist', None) is not None else 0
} for bi in element_analysis['bi_list'] if not bi.is_sure]
# 添加小周期K线数据
@@ -341,7 +347,9 @@ def analyze():
'sure_time': format_time_safely(seg.sure_time, client_tz) if seg.sure_time else None,
'start_price': seg.start_bi.start_klc.low if convert_direction(seg.dir) == 1 else seg.start_bi.start_klc.high,
'end_price': seg.end_bi.end_klc.high if convert_direction(seg.dir) == 1 else seg.end_bi.end_klc.low if seg.end_bi else None,
'direction': convert_direction(seg.dir)
'direction': convert_direction(seg.dir),
'macd_div': float(getattr(seg, 'macd_div', 0) or 0),
'macd_hist': float(getattr(seg, 'macd_hist', 0) or 0)
} for seg in element_analysis['seg_list'] if seg.is_sure]
# 添加次周期未完成线段列表
result['element_uncompleted_seg_list'] = get_uncompleted_seg_list(element_analysis['seg_list'], client_tz)
@@ -446,7 +454,8 @@ def analyze():
'start_price': bi.start_klc.low if convert_direction(bi.dir) == 1 else bi.start_klc.high,
'end_price': bi.end_klc.high if convert_direction(bi.dir) == 1 else bi.end_klc.low if bi.end_klc else None,
'direction': convert_direction(bi.dir),
'macd_div': float(bi.macd_div) if hasattr(bi, 'macd_div') else 0
'macd_div': float(bi.macd_div) if hasattr(bi, 'macd_div') else 0,
'macd_hist': float(bi.macd_hist) if getattr(bi, 'macd_hist', None) is not None else 0
} for bi in sub_sub_analysis['bi_list'] if bi.is_sure]
result['sub_sub_uncompleted_bi_list'] = [{
'start_time': bi.start_klc.end_time if isinstance(bi.start_klc.end_time, str) else bi.start_klc.end_time.astimezone(client_tz).isoformat(),
@@ -455,7 +464,8 @@ def analyze():
'start_price': bi.start_klc.low if convert_direction(bi.dir) == 1 else bi.start_klc.high,
'end_price': bi.end_klc.low if convert_direction(bi.dir) == 1 else bi.end_klc.high,
'direction': convert_direction(bi.dir),
'macd_div': float(bi.macd_div) if hasattr(bi, 'macd_div') else 0
'macd_div': float(bi.macd_div) if hasattr(bi, 'macd_div') else 0,
'macd_hist': float(bi.macd_hist) if getattr(bi, 'macd_hist', None) is not None else 0
} for bi in sub_sub_analysis['bi_list'] if not bi.is_sure]
# 次次周期 KLC 列表
result['sub_sub_klc_list'] = [{
@@ -477,7 +487,9 @@ def analyze():
'sure_time': format_time_safely(seg.sure_time, client_tz) if seg.sure_time else None,
'start_price': seg.start_bi.start_klc.low if convert_direction(seg.dir) == 1 else seg.start_bi.start_klc.high,
'end_price': seg.end_bi.end_klc.high if convert_direction(seg.dir) == 1 else seg.end_bi.end_klc.low if seg.end_bi else None,
'direction': convert_direction(seg.dir)
'direction': convert_direction(seg.dir),
'macd_div': float(getattr(seg, 'macd_div', 0) or 0),
'macd_hist': float(getattr(seg, 'macd_hist', 0) or 0)
} for seg in sub_sub_analysis['seg_list'] if seg.is_sure]
result['sub_sub_uncompleted_seg_list'] = get_uncompleted_seg_list(sub_sub_analysis['seg_list'], client_tz)
result['sub_sub_zs_list'] = [{