Client Flow Funding Optimiser

Subsidise facilitating client spot flow with the funding carry it unlocks — the MM mirror of the EARN book. Snapshot 2026-11-19 18:30 UTC · Funding board →
Client settles physically every 24h — net-balance snapshot 03:30 UTC, delivery 17:00 UTC. Short-spot legs (P(X) sells: we are short the token and must buy it back to deliver) are forced flat at tomorrow 17:00 UTC (22.5h away) and carry an unwind cost. Long-spot legs (P(X) buys: the client delivers the token to us and we deliver stablecoins, which we hold in size) need no unwind — the funding is perpetual, priced over the editable holding horizon below.
days — prices the P(X) buys (perpetual) table only
Spread bps are vs exchange mid: each cell is suggested spread / carry-cost-spread — + spread = markup the client pays, − spread = we quote THROUGH mid (subsidy); the figure after the / is the window PnL in bps the desk keeps at that quote. Hedge cost = perp entry (maker). Unwind cost = the real basis we cross to flatten a short-spot leg for settlement (buy back spot at the offer + sell perp at the bid) = taker fee + half the live bid/ask spread on each leg; buyback venue = cheapest on fee+spread. Long-spot rows show held (no unwind). When a leg has no live book its half-spread is estimated from the token's other markets (flagged ~ / est); a name is dropped only if it has no book anywhere or isn't listed on a withdrawable venue. Windows left = settlements captured before the deadline; perpetual rows show the settlements in the horizon you set, tagged perp. Passive = recover all costs, keep the carry; Moderate = pass 1/3 of the net carry to the client (keep 2/3); Aggressive = pass 1/2 (keep 1/2). In the quote cells the − spread (subsidy we give up) is red and the PnL we keep is green. Avg last 3 = mean 8h-equiv funding over the last 3 realized settlements (red if it has flipped sign vs the live print) — a reversion check on whether the live Fund/8h is a one-off spike. Avg funding reprices a passive (cover-cost) quote off that average: the PnL is the carry the recent-average funding would actually earn; if it's well below the live Passive PnL, the live carry is a spike.

P(X) sells spot — short the token, long the perp (collect −funding) · we owe the token, so deadline-capped and pays the unwind to get flat · 0 shown

Token24h %StructureFund /8hAvg last 3
fund /8h
Windows leftCarry budgetHedge costUnwind costPassive
spread / pnl
Moderate
spread / pnl
Aggressive
spread / pnl
Avg funding
cover cost / pnl

P(X) buys spot — long the token, short the perp (collect +funding) · the client delivers the token and we deliver stablecoins → perpetual carry, no unwind · 0 shown

Token24h %StructureFund /8hAvg last 3
fund /8h
Windows leftCarry budgetHedge costUnwind costPassive
spread / pnl
Moderate
spread / pnl
Aggressive
spread / pnl
Avg funding
cover cost / pnl
Perpetual asymmetry: we are only forced into the market when we are short the physical token. Being short stablecoins is never a problem (we hold plenty), so long-spot carry rolls indefinitely; short-spot carry is capped by the delivery deadline and pays the unwind to get flat.

How each token is priced — the per-token logic, in Python (bps vs mid)

# Client Flow Funding Optimiser -- how each token is priced (all bps vs mid).
# Per token: fund_bps = 8h-equiv funding on the hedge perp; hrs = its funding
# cadence; plus the perp maker/taker fees and each leg's live half-spread.

MOD_SHARE, AGG_SHARE = 1/3, 1/2          # share of net carry passed to the client
PERP_HORIZON_D       = 3               # holding horizon for perpetual (long-spot) rows (editable)
SETTLE_VENUES = ["BN", "KuCoin", "OKX", "Bitstamp"]   # can buy + withdraw to deliver

per_window = abs(fund_bps) * hrs/8       # funding collected per settlement
hedge      = maker_fee(hedge_perp)       # perp hedge ENTRY, worked passively

if regime == "P(X) buys spot":           # we are LONG the token
    # client delivers the token, we deliver stablecoins (held in size) ->
    # funding is PERPETUAL: no forced buyback, not clipped by the deadline.
    windows = round(PERP_HORIZON_D*24 / hrs)
    unwind  = 0
else:                                    # "P(X) sells spot": we are SHORT the token
    # must buy it back to deliver -> capped at the 17:00 settlement, and
    # forced to CROSS the book on both legs to get flat (taker):
    windows = funding_windows_until(settlement_deadline)   # 03:30 snap / 17:00 deliver
    unwind  = ( taker_fee(hedge_perp) + half_spread(hedge_perp)      # sell perp at the bid
              + taker_fee(spot_v)     + half_spread(spot_v) )        # buy spot at the offer
    # spot_v = cheapest SETTLE_VENUE on fee+half_spread; a missing book is
    # estimated from the token's other markets (flagged ~/est).

carry    = windows * per_window          # subsidy budget, before costs
cost     = hedge + unwind
net_edge = carry - cost                  # the most we can quote THROUGH mid

# Quotes vs mid: + = client pays a markup; - = we price THROUGH mid (subsidy).
passive    = +cost                       # covers costs, keep the WHOLE carry
moderate   = -net_edge * MOD_SHARE       # give 1/3 of the net carry, keep 2/3
aggressive = -net_edge * AGG_SHARE       # give 1/2 of the net carry, keep 1/2

# PnL the desk keeps at each quote = carry - cost + quote:
pnl_passive    = carry
pnl_moderate   = net_edge * (1 - MOD_SHARE)   # = 2/3 * net_edge
pnl_aggressive = net_edge * (1 - AGG_SHARE)   # = 1/2 * net_edge

# Reversion check -- an alternative carry from the LAST 3 realized settlements,
# signed to the direction we collect (dir = +1 for P(X) buys, -1 for P(X) sells):
avg_fund_bps = mean(last_3_settlements) * 8/hrs      # signed 8h-equiv
avg_carry    = windows * (dir * avg_fund_bps * hrs/8)
# "Avg funding" column is passive-style: spread = +cost, PnL kept = avg_carry.
# If avg_carry is far below pnl_passive, the live funding is a spike likely to revert.