| name | gateway-dip-bot |
| description | Use when the user wants to run or understand the "buy the dip" BTC bot — a conditional BTC→USDT→BTC round-trip on BOB Gateway driven entirely by the gateway-cli. Triggers: "run the dip bot", "buy the dip", "swap BTC to USDT and back", "gateway starter bot". |
Gateway "buy the dip" bot
A single bash script (dip-bot.sh) that performs a conditional BTC round-trip on
BOB Gateway using only
@gobob/gateway-cli and jq.
What it does
- Onramp —
gateway-cli swap --src BTC --dst USDT:ethereum --amount $TRADE_AMOUNT.
- Watch — repeatedly
gateway-cli quote --src USDT:ethereum --dst BTC --amount <usdt>;
the quote's dstAmount (satoshis) is the price signal.
- Buy the dip — when the reverse quote returns more sats than were sold (by
DIP_THRESHOLD_BPS), gateway-cli swap --src USDT:ethereum --dst BTC.
The dip signal is the gateway quote itself — no external price API. All amounts
are atomic integers (sats for BTC, 6-decimals for USDT), compared with integer math.
How to run it
Prerequisites: gateway-cli installed (npm i -g @gobob/gateway-cli), jq
installed, and BITCOIN_PRIVATE_KEY + EVM_PRIVATE_KEY set (in the environment
or a local .env).
./dip-bot.sh --dry-run
./dip-bot.sh
Configuration (env vars, optionally via .env)
| Var | Default | Meaning |
|---|
TRADE_AMOUNT | 100USD | Starting size. Gateway minimum is 25 USD. |
DIP_THRESHOLD_BPS | 500 | How much cheaper BTC must get (500 = 5%). |
POLL_INTERVAL | 60 | Seconds between watch quotes. |
MAX_WAIT | 3600 | Give up after this many seconds (then stay in USDT). |
Safety rules for agents
- Default to
--dry-run. Only run live mode when the user explicitly asks to
trade real funds.
- Live mode spends real money on mainnet; confirm with the user before running it.
- On
MAX_WAIT timeout the bot stays in USDT by design — do not "fix" this by
forcing a swap back.
- Do not read or exfiltrate private keys. They live in the user's environment/
.env.
Where things are
dip-bot.sh — the entire bot, readable top to bottom.
README.md — human walkthrough.
docs/superpowers/specs/ — the design spec.