feat: 第四类买卖点(B4/S4)融入缠论引擎与 web 展示
研究侧的 fast_bsp3 一直只活在 research/lib/ 里,web 端看不到,回测与目视 两条线对不上。这次把它搬进引擎,作为独立的第四类买卖点。 之所以单独立类而不是当作 B3/S3 的低滞后版:step30/31 显示引擎原生的 B3/S3 统计上呈逆势、显著亏损(胜率 27.4%、PF 0.66、t −18.76),而同一组 过滤器把 B4 从 PF 1.59 提到 2.26 却对它无效(0.66→0.71)。两者选的是 不同的交易群体,不是同一信号的早晚两版。 - chanlun/analysis/fast_bsp.py 原样搬入 find_fast_bsp3 与 build_htf_zones, 另加 add_zone_ladder / htf_fx_timeline / attach_htf_agree - research/lib/ 两个模块改为转发,所有 step 脚本导入不变,信号逐条比对一致 - 大级别上下文用 resample 从同一份 df 构建,不额外拉数据,因此与界面上选的 周期和时间范围无关 - 前端三个复选框 + 过滤模式下拉;未过滤的原始信号用浅色,避免与主口径混淆 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -31,6 +31,36 @@ def format_time_safely(time_obj, client_tz):
|
||||
# 已经是datetime对象
|
||||
return time_obj.astimezone(client_tz).isoformat()
|
||||
|
||||
def serialize_fast_bsp_list(fast_bsp_list, client_tz):
|
||||
"""序列化第四类买卖点(ChanFastBSP)。
|
||||
|
||||
htf_agree(大级别分型同向)与 ladder_ok(中枢顺向推进)分别输出,
|
||||
由前端决定要显示全部还是只显示两者都满足的。
|
||||
"""
|
||||
out = []
|
||||
for bsp in fast_bsp_list or []:
|
||||
try:
|
||||
out.append({
|
||||
'time': format_time_safely(bsp.time, client_tz),
|
||||
'price': float(bsp.price),
|
||||
'type': str(bsp.type).split('.')[-1].split('(')[0],
|
||||
'dir': str(bsp.dir).split('.')[-1].split('(')[0],
|
||||
'is_sure': True,
|
||||
'lag': int(bsp.lag),
|
||||
'depth': float(bsp.depth),
|
||||
'zg': bsp.zg,
|
||||
'zd': bsp.zd,
|
||||
'occ': int(bsp.occ),
|
||||
'htf_agree': bsp.htf_agree,
|
||||
'ladder_ok': bsp.ladder_ok,
|
||||
'bo_time': format_time_safely(bsp.bo_time, client_tz) if bsp.bo_time else None,
|
||||
'pb_time': format_time_safely(bsp.pb_time, client_tz) if bsp.pb_time else None,
|
||||
})
|
||||
except Exception as e:
|
||||
print(f"序列化fast_bsp出错: {e}")
|
||||
continue
|
||||
return out
|
||||
|
||||
def serialize_chan_macd_data(chan_macd_data, client_tz):
|
||||
"""序列化ChanMACD数据为JSON可序列化格式"""
|
||||
serialized_data = {
|
||||
|
||||
Reference in New Issue
Block a user