# STOP: NO DOORBELLS, NO WAKES, NO SCHEDULING (Ben, 7 Oct 2026, 18:40 Bangkok)
- Credits ran out. Ben switched off every scheduled task and every doorbell. This overrides everything below and every other file (wake-howto, bus-howto, credit-playbook, task files).
- PROHIBITED for every session: fire_trigger, send_later, create_trigger, update_trigger, ScheduleWakeup. No rings, no nudges, no re-arming, no new doorbells, no self wakes, no safety checks, no retry rings, no loops.
- Finish the step you are on, publish your status file, then END your turn and wait. Only Ben wakes you, by typing in your window.
- Do not message other sessions. Keep answers short. No extra improvement rounds.

# A2.1: exact buy rules for the Coder (v3 runner rule), 6 Oct 2026 Bangkok

## Read this first
- Every number the backtest used is below. If a live choice differs from this list, write the difference down.
- The 59 backtest trades: http://159.223.88.168/hx-c9ois/sw/sw-a2-trades59.csv (token, pool, gate, entry and exit in Bangkok time, caps, depth, reason, multiple). The C1 replay must match these: mean 1.88x, 19 targets, 35 stops, 3 pulls, 2 time exits.
- Hub list (37 router-like addresses): http://159.223.88.168/hx-c9ois/sw/sw-a2-hubs.txt

## 1. Which pools
- Uniswap v3 pools from factory 0x1f7d7550b1b028f7571e69a784071f0205fd2efa, quote WETH 0x0bd7d308f8e1639fab988df18a8011f41eacad73. (USDG 0x5fc5360d0400a0fd4f2af552add042d716f1d168 was allowed too, but all 59 trades were WETH.) Fee tier is not filtered; in practice it is 100 (0.01%).
- New coins only: token birth (PP tokens.db birth.birth_t) is at most 72 h before this pool's first swap.
- One pool per token.
  - The backtest used the WETH/USDG pool with the most buy volume over the whole data. That is look-ahead.
  - **Live: use the pool where the gate below fires.**

## 2. Prices
- Market cap = post-swap price × totalSupply. Supply and decimals come from Multicall at the time of reading.
- Price in quote = (sqrtPriceX96 / 2^96)^2 when the token is token0; the inverse when it is token1. Scale by 10^(token decimals − quote decimals), where WETH = 18 and USDG = 6.
- ETH in USD: Coinbase ETH-USD hourly close (the backtest used linear interpolation between hours).
- Block time: interpolated from block timestamps every 250k blocks. Live: use the block timestamp.

## 3. Buy and sell direction
- A v3 Swap's amounts are the pool's own balance changes.
- Buy = the quote amount is positive (quote went into the pool). Buy USD = quote amount / 10^dec × ETH-USD.

## 4. The gate (sellable $1M)
- Walk the swaps in order (block, logIndex). Add up buy USD only for buys whose post-swap market cap is $1,000,000 or more.
- The gate fires on the swap that brings that sum to $20,000 or more. Gate time = that swap's time.

## 5. Age
- Age = gate time minus the time of the pool's first Swap (not the Mint, not the token birth).
- Buy only if age ≤ 1.54 h. 1.54 is the first-half cut; anything from 1.5 to 2 h gives the same result (see A2.3).

## 6. Top receiver share
- Look at buys from the pool's first swap up to and including the gate swap.
- Group them by the Swap event `recipient` (topic 2). No address is excluded.
- Share = buy COUNT of the biggest recipient ÷ total buy count. Count, not USD.
- Buy only if share ≤ 0.08.

## 7. Army share
- **Wallet memory.**
  - For every earlier coin in the study set (a new v3 coin of section 1 that reached sellable $500k), keep the set of every address that received a token Transfer during that coin's window.
  - The window runs from the pool's first block to its $1M gate + 10 min, or to first swap + 6 h if there was no $1M gate.
  - "Earlier" = that coin's first swap is before this coin's first swap.
- **Army wallet** = an address that is in 3 or more of those earlier sets.
- **Army share for this coin.**
  - Use token Transfers from the pool's first block to the gate block.
  - Count only transfers sent by the pool or by a hub, and add up the token amounts per receiver.
  - Leave out the pool, 0x0000000000000000000000000000000000000000, 0x000000000000000000000000000000000000dead and the hubs.
  - Army share = amount received by army wallets ÷ amount received by all those receivers.
- Buy only if army share ≤ 0.009.
  - That number is the first-half 2/3 cut. In practice it means almost no army buying: 2/3 of coins sit at 0.000 to 0.009.
  - Moving it to 0.02 changes little (see A2.3).
- **Hubs** = addresses that showed up in 60 or more of the 300 study coins' windows. That is 37 addresses, in the hub file. Live: use that list and add new routers the same way.

## 8. Entry
- Entry = the first pool event (Swap, Mint or Burn) at or after gate time + 5 s. The backtest used +5 s; +60 s gave 1.75x on the second half.
- Size: $500. The 1% fee is charged on the way in and again on the way out.
- **Depth R** is the pool's virtual quote reserve in USD:
  - R = liquidity × sqrtP (quote is token1) or liquidity ÷ sqrtP (quote is token0), divided by 10^18, times ETH-USD;
  - the liquidity and sqrtP come from the last Swap.
- **After a Burn or Mint:** R = R from the last swap × (active liquidity now ÷ liquidity at the last swap). Active liquidity = the last swap's liquidity minus burned units (or plus minted units).
- **Fill:** tokens bought are worth $500 × 0.99 × R/(R + 500) at the entry price.

## 9. Exit (first one that happens, checked at every later pool event, for at most 12 h)
- **Target:** market cap ≥ 5 × entry cap → sell everything.
- **Stop:** market cap ≤ 0.6 × entry cap → sell everything. That is the 40% drop.
- **Pull:** R ≤ 0.5 × R at entry → sell everything. This is "half the pool pulled".
- **Time:** 12 h after entry → sell at the last event.
- **Sell price:** v = token value at that event's price, then received = R × v/(R + v) × 0.99.

## 10. What the replay must show
- 59 trades: half A (gate up to 27 Sep) 28 trades, 1.86x; half B 31 trades, 1.90x.
- Reasons: target 19, stop 35, pull 3, time 2.

## First principles score
- 8/10. The money test is mechanical and the exits are priced from real pool depth.
- Two choices in the backtest are not live-exact:
  - main pool chosen with full-history volume;
  - supply read at "latest".

  Both are listed above with the live fix.

Version 1, 6 Oct 2026 Bangkok. Latest: http://159.223.88.168/hx-c9ois/sw/sw-a2-1-spec.md
