from chanlun.core.ChanEnum import Chan_BSP_DIR, Chan_BSP_TYPE class ChanFastBSP(): """第四类买卖点(B4/S4)。 与 ChanBSP 的区别在于它不挂在笔上:fast_bsp 刻意不等笔确认,入场点是一根具体的 K线而非一笔的端点,所以时间与价格直接取自 K 线,没有 bi / klc 可依附。 htf_agree 与 ladder_ok 是两个独立的过滤标志,不在这里合成——上层(图表或策略) 自己决定要不要用、怎么组合。 """ def __init__(self, time, price, ddir, entry_idx, bo_time=None, pb_time=None, lag=0, depth=0.0, zg=None, zd=None, occ=1, htf_dir=None, htf_agree=None, ladder_ok=None): self.time = time self.price = float(price) self.dir = ddir self.type = Chan_BSP_TYPE.B4 if ddir == Chan_BSP_DIR.BUY else Chan_BSP_TYPE.S4 self.entry_idx = int(entry_idx) self.bo_time = bo_time self.pb_time = pb_time self.lag = int(lag) self.depth = float(depth) self.zg = float(zg) if zg is not None else None self.zd = float(zd) if zd is not None else None self.occ = int(occ) self.htf_dir = htf_dir self.htf_agree = htf_agree self.ladder_ok = ladder_ok # 入场即成立,没有「等待确认」这个状态;留此字段是为了与 ChanBSP 的序列化对齐 self.is_sure = True self.start_time = time self.end_time = time self.sure_time = time def __repr__(self): name = str(self.type).replace('Chan_BSP_TYPE.', '') return f""