"""v3dripx.py (A1.28 EXTRA, not pre-registered): exit at end of next block when the LP OWNER (A1.26 lpown.json) itself makes a
sell of >= W WETH after our fill. Same book as v3drip.py. Reported as an idea only, never as a pass."""
src = open("/root/fwa1/v3drip.py").read().split("OUT = {}")[0]
exec(src)
def flagown(pool, fb, W):
    o = (LPOWN.get(pool) or [None, None, None])[2]
    if not o: return None, None
    o = o.lower()
    for b, li, tx, we in SELLS[pool]:
        if we >= W and TXFROM.get(tx) == o: return (b - fb) * SPB, o
    return None, None
def runo(usd, W):
    R = []; cut = []
    for p, s in SET[usd]:
        x = s["base"]; t, w = flagown(p["pool"], p["fb"], W)
        if t is not None and s["te"] < t < s["tb"]:
            xc = s["exit_at"](t); j = state(s["pth"], t + NB); mcc = s["pth"][j][1] ** 2 * s["sup"] * p["eu"]
            cut.append((p, s["base"], xc, w, t - s["te"], mcc)); x = xc
        R.append((p, x, usd))
    return R, cut
print("pools with an LP owner address", sum(1 for p, s in SET[100] if (LPOWN.get(p["pool"]) or [0, 0, None])[2]))
for usd in (100, 1000):
    base = [(p, s["base"], usd) for p, s in SET[usd]]
    print("\n== EXTRA LP-owner-sells $%d ==\nBASE | H1 %s | H2 %s" % (usd, fmt(S(base, D1)), fmt(S(base, D2))))
    for W in (0.25, 0.5, 1.0):
        R, cut = runo(usd, W)
        print("own W%.2f | H1 %s %s | H2 %s %s" % (W, fmt(S(R, D1)), cs(cut, D1), fmt(S(R, D2)), cs(cut, D2)))
        if usd == 100 and W == 0.25:
            for p, xb, xc, w, dt, mcc in cut:
                print("   %s | %s | %.2fx -> %.2fx | %.1f min | $%.0fk" % (p["pool"], day(p["t"]), xb, xc, dt / 60, mcc / 1e3))
