主图增加笔/线段背驰与面积数字,并修正 SD99999 显示。
三周期分开关控制,只画数字不画图标;线段面积比沿用同向笔面积口径。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -48,6 +48,10 @@ def analyze_chan(df, symbol=None, timeframe=None):
|
||||
for bi in bi_list:
|
||||
bi.cal_macd_div()
|
||||
#print(bi.start_time, bi.macd_hist, bi.macd_div)
|
||||
for seg in seg_list:
|
||||
seg.cal_macdhist()
|
||||
for seg in seg_list:
|
||||
seg.cal_macd_div()
|
||||
|
||||
# 添加ChanMACD分析(复用 get_klc_list 内已算好的结果,避免同周期二次全量分析)
|
||||
chan_macd = None
|
||||
|
||||
@@ -98,8 +98,14 @@ def serialize_chan_macd_data(chan_macd_data, client_tz):
|
||||
# 序列化unittf_list(兼容新结构与枚举类型)
|
||||
for unittf in chan_macd_data.get('unittf_list', []):
|
||||
try:
|
||||
dir_value = getattr(unittf, 'uinttf_dir', None)
|
||||
dir_value = getattr(unittf, 'unittf_dir', None)
|
||||
dir_name = getattr(dir_value, 'name', dir_value if isinstance(dir_value, str) else None)
|
||||
if dir_name == 'ABOVE':
|
||||
dir_num = 1
|
||||
elif dir_name == 'UNDER':
|
||||
dir_num = -1
|
||||
else:
|
||||
dir_num = 0
|
||||
start_t = getattr(unittf, 'start_type', None)
|
||||
start_type = getattr(start_t, 'name', start_t)
|
||||
end_t = getattr(unittf, 'end_type', None)
|
||||
@@ -114,7 +120,7 @@ def serialize_chan_macd_data(chan_macd_data, client_tz):
|
||||
unittf_data = {
|
||||
'start_time': format_time_safely(getattr(unittf, 'start_time', None), client_tz),
|
||||
'end_time': format_time_safely(getattr(unittf, 'end_time', None), client_tz) if getattr(unittf, 'end_time', None) else None,
|
||||
'dir': dir_name, # 'ABOVE' | 'UNDER' | None
|
||||
'dir': dir_num,
|
||||
'start_type': start_type, # e.g. 'START' | 'CROSS0' | 'NEAR0_UP' | 'NEAR0_DOWN'
|
||||
'end_type': end_type,
|
||||
'invalid': getattr(unittf, 'invalid', False),
|
||||
@@ -307,7 +313,9 @@ def get_uncompleted_seg_list(seg_list, client_tz):
|
||||
'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(),
|
||||
'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,
|
||||
'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)
|
||||
}
|
||||
|
||||
if is_last:
|
||||
|
||||
Reference in New Issue
Block a user