diff --git a/crypto_monitor_binance/更新文档.md b/crypto_monitor_binance/更新文档.md index 6d375d4..7408bda 100644 --- a/crypto_monitor_binance/更新文档.md +++ b/crypto_monitor_binance/更新文档.md @@ -22,7 +22,7 @@ |----|------| | 同币互斥 | 每个币种只能有一条斐波监控(0.618 与 0.786 不可并存) | | 上下沿 | 上沿 **H**、下沿 **L**(须 H > L) | -| 挂单价 E | `E = L + ratio × (H − L)`(0.618 或 0.786) | +| 挂单价 E | **做多** `E = H − ratio × (H − L)`(自 H 向下回撤);**做空** `E = L + ratio × (H − L)`(自 L 向上反弹) | | 做多 | 限价 @ E,止损 L,止盈 H | | 做空 | 限价 @ E,止损 H,止盈 L | | 添加后 | **立即**在 Binance U 本位挂限价单;卡片显示 **挂E**、限价单 ID | diff --git a/crypto_monitor_gate/更新文档.md b/crypto_monitor_gate/更新文档.md index 821001b..a62cfe1 100644 --- a/crypto_monitor_gate/更新文档.md +++ b/crypto_monitor_gate/更新文档.md @@ -22,7 +22,7 @@ |----|------| | 同币互斥 | 每个币种只能有一条斐波监控(0.618 与 0.786 不可并存) | | 上下沿 | 上沿 **H**、下沿 **L**(须 H > L) | -| 挂单价 E | `E = L + ratio × (H − L)`(0.618 或 0.786) | +| 挂单价 E | **做多** `E = H − ratio × (H − L)`(自 H 向下回撤);**做空** `E = L + ratio × (H − L)`(自 L 向上反弹) | | 做多 | 限价 @ E,止损 L,止盈 H | | 做空 | 限价 @ E,止损 H,止盈 L | | 添加后 | **立即**在 Gate 挂限价单;卡片显示 **挂E**、限价单 ID | diff --git a/fib_key_monitor_lib.py b/fib_key_monitor_lib.py index 140e1e3..ed09f61 100644 --- a/fib_key_monitor_lib.py +++ b/fib_key_monitor_lib.py @@ -18,8 +18,9 @@ def fib_ratio_from_type(monitor_type): def calc_fib_plan(direction, upper, lower, ratio): """ - 上沿 H、下沿 L;挂单价 E = L + ratio*(H-L)。 - 多:SL=L,TP=H;空:SL=H,TP=L。 + 上沿 H、下沿 L(H > L)。 + 做多:自 H 向下回撤 ratio,E = H - ratio*(H-L);SL=L,TP=H。 + 做空:自 L 向上反弹 ratio,E = L + ratio*(H-L);SL=H,TP=L。 返回 (entry, stop_loss, take_profit) 或 None。 """ try: @@ -31,10 +32,11 @@ def calc_fib_plan(direction, upper, lower, ratio): if h <= l or r <= 0 or r >= 1: return None span = h - l - entry = l + r * span direction = (direction or "long").strip().lower() if direction == "short": + entry = l + r * span return entry, h, l + entry = h - r * span return entry, l, h