← back to Zero Code Trading Bot

SKILL.md

133 lines

---
name: zero-code-trading-bot
description: 'Turn a plain-English trading strategy into a runnable, PAPER-FIRST prediction-market bot — scaffolded, validated, and safe by construction. The user describes a strategy in words ("buy Polymarket longshots under 8c with real volume, take profit at 15c, stop at 3c, $25 a bet, $250 max exposure"); this skill compiles it to a declarative strategy.json, validates every rule through a sandboxed evaluator, and scaffolds a self-contained bot project (zero-dependency Python: read-only market data + paper executor + append-only P&L ledger + dashboard) that runs against Polymarket''s public API with no key and $0. Use when Steve says "zero code trading bot", "build me a trading bot", "make a bot that trades this strategy", "paper-trade this idea", "backtest/paper this on Polymarket", "/zero-code-trading-bot", or describes a market strategy he wants automated. Composes with the polymtrx skill (signal discovery) and the Ken/Kalshi dashboard (Kalshi execution) instead of duplicating them. HARD RAIL: paper by default; going LIVE is Steve-gated (requires LIVE=1 + SAFE_MODE=0 + a confirmation token + a real broker key + a wired order call + a go-live approval memo) — the skill never places a real order, never sets those switches, never deploys a live loop. Always shows cost ($0 for paper).'
argument-hint: 'zero-code-trading-bot "buy polymarket longshots under 8c, tp 15c, stop 3c, $25/bet, $250 cap" | validate strategy.json | scaffold <name>'
allowed-tools: Bash, Read, Write, Edit, AskUserQuestion
license: MIT
user-invocable: true
metadata:
  type: reference
  inspired-by: Sharbel (@sharbel) on X — "how I built a trading bot with zero code" / no-code AI-agent trading playbooks
  engine: assets/bot-template (scaffolded per bot) + scripts/new_bot.py + scripts/validate_strategy.py
  composes-with: [polymtrx, Ken/Kalshi dashboard]
  tags:
    - trading-bot
    - prediction-markets
    - polymarket
    - kalshi
    - no-code
    - paper-trading
    - strategy-dsl
    - safe-by-default
    - gated-live
    - zero-cost
---

# zero-code-trading-bot

## Overview

Reproduce the **Sharbel (@sharbel)** "trading bot with zero code" playbook —
*describe a strategy in plain English, iterate with an AI agent, end up with a
running bot* — as a deterministic, **paper-first** scaffold. The user never
writes code: they say what they want, Claude compiles it to a validated
`strategy.json`, and this skill stamps out a self-contained bot project that
paper-trades live prediction markets for **$0, no keys**.

> **Provenance note.** The seed is the tweet at
> `x.com/sharbel/status/2055680438417412359`. That exact post is unreachable (X
> returns 404/paywall to automated reads), so the specific wording could not be
> captured verbatim. This skill is built from Sharbel's verified, consistent body
> of work — *"how I built a trading bot with zero code: 345 wins, 26 losses, no
> Python… just talking to an AI agent and iterating"*, plus his Polymarket
> copy-trading-bot and "run your business on AI agents" playbooks — and adapted to
> Steve's hard rule that anything touching money is gated.

This is a **build-and-paper-test contract**, not a license to trade. The skill
authors, validates, scaffolds, and paper-runs. It stops at the money line.

## When to use

- "build me a trading bot" / "zero code trading bot" / "make a bot for this strategy"
- "paper-trade this idea on Polymarket" / "automate this market strategy"
- Steve describes any entry/exit/sizing strategy for prediction markets
- After a `/polymtrx` scan surfaces an edge worth encoding as a repeatable bot

Not for: placing live orders, wallet operations, non-prediction-market venues, or
"just tell me the odds" (that's `/polymtrx`).

## How to use it

### 1. Compile the plain-English strategy → `strategy.json`

Read `references/strategy-dsl.md` for the schema and the plain-English → JSON
mapping. Translate the user's words into a `strategy.json` with `universe`,
`entry`, `exit`, `sizing`, and `risk`. Rule expressions may reference **only**
`price`, `volume_usd`, `liquidity_usd`, `spread`, `days_to_resolve`. Always set
`mode: "paper"`.

If the strategy is underspecified (no stop, no exposure cap, no bet size), ask
with `AskUserQuestion` — a strategy without a risk cap is not shippable.

### 2. Validate before anything runs

```bash
scripts/validate_strategy.py <path>/strategy.json
```

This confirms required keys, sane sizing/risk, and — critically — that every rule
parses under the sandboxed evaluator with only known variables. Fix any error
before scaffolding. A rule that fails here would silently misfire at runtime.

### 3. Scaffold the bot project (paper, git-init'd)

```bash
scripts/new_bot.py <bot-name> --strategy <path>/strategy.json
# → ~/Projects/<bot-name>/  (copied from assets/bot-template, mode forced to paper)
```

### 4. Paper-run and iterate

```bash
cd ~/Projects/<bot-name>
python venue_adapter.py          # confirm live market data ($0, no key)
python bot.py --once --dry-run   # decide, place NO fills — safest first look
python bot.py --once             # first paper fills → data/ledger.jsonl
python bot.py --loop             # continuous, every strategy.poll_seconds
python dashboard.py --serve      # live paper P&L on a free localhost port
```

Iterate on the rules with the user, re-validate, re-dry-run. Every cycle prints a
`cost:` line — `$0 (paper)` until someone deliberately goes live.

### 5. Going live is Steve's call — never yours

Read `references/safety-model.md`. To place real orders a human must clear **all**
of: `LIVE=1`, `SAFE_MODE=0`, a `data/LIVE_CONFIRMED` token, a real broker key, a
*wired* order call (the template leaves it unimplemented on purpose), and a
go-live approval memo drafted to `~/.claude/yolo-queue/pending-approval/`. This
skill does none of those automatically. `safe_mode` is a hard precondition, not a
suggestion — the Ken/Kalshi autoTrader once traded with safe_mode on; here it
cannot.

## Composition (don't reinvent what exists)

See `references/venues.md`.

- **`polymtrx`** finds the edge (read-only Polymarket scan). Use `/polymtrx scan
  <topic>` to *discover* a strategy, then encode it here.
- **Ken / Kalshi dashboard** (`~/Projects/Ken/kalshi-dash`, pm2 `ken` :7810) owns
  Kalshi paper portfolios + a `safe_mode`-honoring autoTrader. For Kalshi
  execution, hand off to Ken rather than wiring a second money path — the
  `KalshiDemoAdapter` here stays DEMO until Steve's prod Kalshi creds exist.

## Files

- `assets/bot-template/` — the scaffold copied per bot: `bot.py` (runner),
  `strategy.json` (rules), `venue_adapter.py` (read-only data), `executor.py`
  (paper vs gated-live), `ledger.py` (append-only P&L), `safe_eval.py` (sandboxed
  rules), `dashboard.py` (P&L viewer).
- `scripts/new_bot.py` — scaffold a bot project (paper, git-init'd).
- `scripts/validate_strategy.py` — validate a strategy.json (schema + sandbox check).
- `references/strategy-dsl.md` · `references/safety-model.md` · `references/venues.md`.