关于「三明治夹击的上界:滑点容忍度就是写给对手的最大损失」,《做市损耗与三明治上界》给出的定量结论是什么?

结论:第五章只站在受害者一侧:三明治夹击的损失不超过滑点容忍度乘以报价,一阶模型给出对手无利可图的容忍度,例如池深一百万、费率 0.30 %、交易占池深百分之一时约为 0.00427。

数据口径:书中参数为示意,全部计算由书中程序生成。 本书是非个人化投资风险分析,不构成投资建议,不推荐任何代币、协议或交易;加密资产高风险,可能全部损失。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 与结论吻合的打印值: 0.00427, 0.30

smallest profitable tolerance s_min (exact / first order)
fee 0.05 %
depth y0 a0.002 a=0.01 a=0.05
100,0000.20374/0.20000 0.03131/0.03158 0.00578/0.00606
1,000,0000.02001/0.02000 0.00313/0.00316 0.00058/0.00061
10,000,0000.00200/0.00200 0.00031/0.00032 0.00006/0.00006
fee 0.30 %
depth y0 a0.002 a=0.01 a=0.05
100,000 none / none0.04293/0.04286 0.00611/0.00638
1,000,000 none / none0.00427/0.00429 0.00061/0.00064
10,000,000 none / none0.00043/0.00043 0.00006/0.00006
fee 1.00 %
depth y0 a0.002 a=0.01 a=0.05
100,000 none / none none / none0.00729/0.00750
1,000,000 none / none none / none0.00073/0.00075
10,000,000 none / none none / none0.00007/0.00007

核心公式

\[\pi \approx 2b\,y_0\,(a-g)-G .\]
查看完整验算程序
# Chapter 5. p52: the tolerance below which no sandwich pays.
# Model: as in p51 (constant-product pool, fee g on input, fixed cost G
# for the adversary's two transactions). For each trade size a (share of
# the Y reserve) and pool depth y0 we find by bisection the smallest
# tolerance s_min at which a worst-case adversary's best profit is
# positive. A victim whose tolerance is below s_min faces no profitable
# sandwich in this model. First-order closed form:
#   s_min ~ G / (y0 (a - g)),   and no attack at any s when a <= g.
# G = 30 in units of Y; depths and sizes illustrative.

GAS = 30.0


def buy_x(x, y, d, g):
    out = x * d * (1.0 - g) / (y + d * (1.0 - g))
    return out, x - out, y + d


def sell_x(x, y, e, g):
    out = y * e * (1.0 - g) / (x + e * (1.0 - g))
    return out, x + e, y - out


def best_profit(a_frac, s, g, y0):
    a = a_frac * y0
    quote, _, _ = buy_x(y0, y0, a, g)
    floor = (1.0 - s) * quote

    def run(b):
        got, x1, y1 = buy_x(y0, y0, b, g)
        out_v, x2, y2 = buy_x(x1, y1, a, g)
        back, _, _ = sell_x(x2, y2, got, g)
        return out_v, back - b - GAS

    lo, hi = 0.0, y0
    for _ in range(100):
        mid = (lo + hi) / 2.0
        if run(mid)[0] >= floor:
            lo = mid
        else:
            hi = mid
    return max(run(lo * i / 200.0)[1] for i in range(1, 201))


def s_min(a_frac, g, y0):
    if best_profit(a_frac, 0.5, g, y0) <= 0.0:
        return None
    lo, hi = 0.0, 0.5
    for _ in range(60):
        mid = (lo + hi) / 2.0
        if best_profit(a_frac, mid, g, y0) > 0.0:
            hi = mid
        else:
            lo = mid
    return hi


def fmt(v):
    return "  none " if v is None else "{:.5f}".format(v)


if __name__ == "__main__":
    print("smallest profitable tolerance s_min (exact / first order)")
    for g in (0.0005, 0.003, 0.01):
        print("fee {:.2f} %".format(g * 100))
        print("  depth y0     a=0.002          a=0.01           a=0.05")
        for y0 in (100000.0, 1000000.0, 10000000.0):
            cells = []
            for a in (0.002, 0.01, 0.05):
                ap = None if a <= g else GAS / (y0 * (a - g))
                cells.append("{}/{}".format(fmt(s_min(a, g, y0)), fmt(ap)))
            print("  {:>10,.0f}  {}".format(y0, "  ".join(cells)))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《集中流动性做市商重平衡损耗(LVR)、链上三明治抢跑边界与去中心化金库风控母典》第 5 章「三明治夹击的上界:滑点容忍度就是写给对手的最大损失」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-344 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026344,
  author    = {Fan, Yafu},
  title     = {Concentrated-Liquidity Loss-Versus-Rebalancing, On-Chain Sandwich Bounds and Decentralised Vault Risk Control},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论