> ## Documentation Index
> Fetch the complete documentation index at: https://daehan-base.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 트레이딩 퀵스타트

> Base에서 실시간 시장 데이터를 가져오고 토큰 스왑을 실행하는 에이전트 구축

export const TradingQuickstartDemo = () => {
  const mono = "ui-monospace,'Cascadia Code','Source Code Pro',Menlo,Monaco,Consolas,monospace";
  const col = {
    dim: "#3f3f46",
    muted: "#52525b",
    active: "#60a5fa",
    success: "#34d399",
    code: "#d4d4d8"
  };
  const steps = [{
    delay: 350,
    left: [{
      t: "> install bankr skill from github.com/BankrBot/skills",
      c: "active"
    }],
    right: [{
      t: "── Bankr Wallet ────────────────────────",
      c: "dim"
    }, {
      t: "GET /releases/latest",
      c: "muted"
    }]
  }, {
    delay: 700,
    left: [{
      t: "  ✓ Bankr skill installed",
      c: "success"
    }],
    right: [{
      t: "  tag: bankr-wallet-v2.1.0",
      c: "success"
    }, {
      t: "  chains: base, eth, solana",
      c: "muted"
    }, {
      t: "  gas:    sponsored",
      c: "muted"
    }]
  }, {
    delay: 500,
    left: [{
      t: "  ✓ Bankr wallet connected   wlt_bankr_...",
      c: "success"
    }],
    right: []
  }, {
    delay: 500,
    left: [{
      t: "> Buy $50 of ETH on Base",
      c: "active"
    }],
    right: [{
      t: "",
      c: "dim"
    }, {
      t: "── Swap Quote ──────────────────────────",
      c: "dim"
    }, {
      t: "POST /v1/swap/quote",
      c: "code"
    }, {
      t: "Host: api.bankr.bot",
      c: "muted"
    }]
  }, {
    delay: 700,
    left: [{
      t: "  fetching quote...",
      c: "muted"
    }],
    right: [{
      t: "",
      c: "dim"
    }, {
      t: '{"fromAmount":"50.00 USDC",',
      c: "code"
    }, {
      t: '  "toAmount":"0.01756 ETH",',
      c: "code"
    }, {
      t: '  "priceImpact":"0.12%"}',
      c: "code"
    }]
  }, {
    delay: 500,
    left: [{
      t: "  ← 0.01756 ETH · price impact 0.12%",
      c: "muted"
    }],
    right: []
  }, {
    delay: 500,
    left: [{
      t: "  impact below 1% — executing...",
      c: "muted"
    }],
    right: []
  }, {
    delay: 750,
    left: [{
      t: "  ✓ tx 0xb4f2...91ca confirmed",
      c: "success"
    }],
    right: [{
      t: "",
      c: "dim"
    }, {
      t: "── Transaction ─────────────────────────",
      c: "dim"
    }, {
      t: "  hash:   0xb4f2...91ca",
      c: "success"
    }, {
      t: "  status: confirmed",
      c: "success"
    }, {
      t: "  block:  28,419,042",
      c: "muted"
    }]
  }, {
    delay: 400,
    left: [{
      t: "  ✓ received 0.01756 ETH",
      c: "success",
      bold: true
    }],
    right: []
  }];
  const [leftLines, setLeftLines] = useState([]);
  const [rightLines, setRightLines] = useState([]);
  const [running, setRunning] = useState(false);
  const [done, setDone] = useState(false);
  const [blink, setBlink] = useState(true);
  const leftRef = useRef(null);
  const rightRef = useRef(null);
  useEffect(() => {
    const t = setInterval(() => setBlink(b => !b), 530);
    return () => clearInterval(t);
  }, []);
  useEffect(() => {
    if (leftRef.current) leftRef.current.scrollTop = leftRef.current.scrollHeight;
  }, [leftLines]);
  const play = () => {
    setLeftLines([]);
    setRightLines([]);
    setRunning(true);
    setDone(false);
    let i = 0;
    const next = () => {
      if (i >= steps.length) {
        setRunning(false);
        setDone(true);
        return;
      }
      const s = steps[i];
      setTimeout(() => {
        if (s.left && s.left.length) setLeftLines(prev => [...prev, ...s.left]);
        if (s.right && s.right.length) setRightLines(prev => [...prev, ...s.right]);
        i++;
        next();
      }, s.delay);
    };
    next();
  };
  useEffect(() => {
    setTimeout(play, 350);
  }, []);
  const renderLine = (item, i) => {
    if (!item.t) return <div key={i} style={{
      height: 6
    }} />;
    return <div key={i} style={{
      fontFamily: mono,
      fontSize: 12,
      lineHeight: "20px",
      color: col[item.c] || col.code,
      fontWeight: item.bold ? 600 : 400,
      whiteSpace: "pre"
    }}>{item.t}</div>;
  };
  return <div style={{
    margin: "28px 0",
    borderRadius: 12,
    overflow: "hidden",
    border: "1px solid #27272a",
    background: "#09090b"
  }}>
      <div style={{
    display: "flex",
    alignItems: "center",
    padding: "8px 12px",
    background: "#111113",
    borderBottom: "1px solid #27272a"
  }}>
        <div style={{
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    width: 28,
    height: 24,
    borderRadius: 6,
    background: "#1e1e20",
    border: "1px solid #27272a",
    marginRight: 10,
    flexShrink: 0
  }}>
          <span style={{
    fontFamily: mono,
    fontSize: 11,
    color: "#71717a",
    userSelect: "none"
  }}>{">"}_</span>
        </div>
        <span style={{
    fontFamily: mono,
    fontSize: 12,
    color: "#52525b"
  }}>Trading Quickstart</span>
        <div style={{
    flex: 1
  }} />
        <button onClick={play} title="Reset" style={{
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    width: 28,
    height: 24,
    borderRadius: 6,
    background: "transparent",
    border: "1px solid transparent",
    cursor: "pointer",
    color: "#3f3f46",
    fontSize: 15,
    lineHeight: 1
  }} onMouseEnter={e => {
    e.currentTarget.style.color = "#a1a1aa";
    e.currentTarget.style.background = "#1e1e20";
    e.currentTarget.style.borderColor = "#27272a";
  }} onMouseLeave={e => {
    e.currentTarget.style.color = "#3f3f46";
    e.currentTarget.style.background = "transparent";
    e.currentTarget.style.borderColor = "transparent";
  }}>
          {"\u21ba"}
        </button>
      </div>

      <div style={{
    height: 250,
    borderBottom: "1px solid #27272a",
    overflow: "hidden",
    display: "flex",
    flexDirection: "column"
  }}>
        <div style={{
    padding: "7px 16px 5px",
    borderBottom: "1px solid #1c1c1e"
  }}>
          <span style={{
    fontFamily: mono,
    fontSize: 10,
    fontWeight: 600,
    letterSpacing: "0.1em",
    textTransform: "uppercase",
    color: "#3f3f46"
  }}>Agent</span>
        </div>
        <div ref={leftRef} style={{
    flex: 1,
    overflowY: "hidden",
    padding: "12px 16px"
  }}>
          {leftLines.map(renderLine)}
          {running && <div style={{
    fontFamily: mono,
    fontSize: 12,
    lineHeight: "20px",
    color: "#60a5fa",
    opacity: blink ? 1 : 0
  }}>{"▋"}</div>}
        </div>
      </div>

      <div style={{
    padding: "8px 16px",
    display: "flex",
    justifyContent: "center",
    minHeight: 37,
    alignItems: "center"
  }}>
        {done && <button onClick={play} style={{
    fontFamily: mono,
    fontSize: 11,
    color: "#52525b",
    background: "none",
    border: "none",
    cursor: "pointer",
    padding: "4px 10px",
    borderRadius: 4
  }} onMouseEnter={e => {
    e.currentTarget.style.color = "#a1a1aa";
    e.currentTarget.style.background = "#18181b";
  }} onMouseLeave={e => {
    e.currentTarget.style.color = "#52525b";
    e.currentTarget.style.background = "none";
  }}>
            {"\u21ba"} Play again
          </button>}
      </div>
    </div>;
};

이 가이드는 처음 시작하는 순간부터 x402를 통해 실시간 가격 데이터를 가져오고 Base에서 토큰 스왑을 실행하는 작동하는 에이전트를 만드는 과정을 안내합니다.

## 모의 데모

<TradingQuickstartDemo />

## OpenClaw 설치

<Steps>
  <Step title="CLI 설치">
    **macOS / Linux:**

    ```bash Terminal theme={null}
    curl -fsSL https://openclaw.ai/install.sh | bash
    ```

    **Windows (PowerShell):**

    ```powershell Terminal theme={null}
    iwr -useb https://openclaw.ai/install.ps1 | iex
    ```

    설치 확인:

    ```bash Terminal theme={null}
    openclaw --version
    ```
  </Step>

  <Step title="온보딩 실행">
    ```bash Terminal theme={null}
    openclaw onboard --install-daemon
    ```
  </Step>

  <Step title="게이트웨이 시작">
    ```bash Terminal theme={null}
    openclaw gateway --port 18789
    ```
  </Step>
</Steps>

<Tip>
  **Claude Code, Codex, OpenCode 사용자** — 아래의 지갑 및 트레이딩 스킬은 스킬을 지원하는 모든 AI 코딩 도구와 호환됩니다. 동일한 `npx skills add` 명령을 도구 내에서 실행하세요.
</Tip>

## 트레이딩 지갑 설정

Bankr은 가스 스폰서십과 내장된 스왑 지원을 포함한 크로스체인 지갑 접근을 제공합니다 — 트레이딩 에이전트에 이상적입니다:

```text theme={null}
install the bankr skill from https://github.com/BankrBot/skills
```

[bankr.bot](https://bankr.bot)에서 전용 계정을 생성하고 [bankr.bot/api](https://bankr.bot/api)에서 API 키를 발급받으세요.

[CDP Agentic Wallet](https://docs.cdp.coinbase.com/agentic-wallet/) 또는 [Sponge Wallet](https://www.paysponge.com)의 경우 [지갑 설정](/ai-agents/setup/wallet-setup)을 참조하세요.

## 스왑 실행

에이전트에게 지갑 기본 도구를 사용하여 거래를 실행하도록 요청합니다:

```text theme={null}
Buy $50 of ETH on Base
```

Bankr 또는 CDP Agentic Wallet의 경우 내장된 스왑 도구가 거래를 처리합니다 — 외부 DEX 통합이 필요하지 않습니다. 지갑이 트랜잭션을 구성, 서명 및 브로드캐스트합니다.

Base에서 최적의 실행을 위해 preconf 엔드포인트를 사용하여 서명 전에 시뮬레이션합니다:

```text theme={null}
Simulate buying $50 of ETH then execute if the price impact is below 1%
```

## 다음 단계

<CardGroup cols={2}>
  <Card title="데이터 페칭" icon="database" href="/ai-agents/trading/data-fetching">
    트레이딩 에이전트를 위한 x402 데이터 소스 전체 카탈로그입니다.
  </Card>

  <Card title="트레이드 실행" icon="chart-line" href="/ai-agents/trading/trade-execution">
    Base에서의 Flashblocks 타이밍, 수수료 조정, 장애 모드입니다.
  </Card>

  <Card title="지갑 설정" icon="wallet" href="/ai-agents/setup/wallet-setup">
    에이전트를 위한 Bankr, CDP, 또는 Sponge를 설정합니다.
  </Card>

  <Card title="x402 프로토콜" icon="bolt" href="/ai-agents/payments/pay-for-services-with-x402">
    데이터 페칭과 결제를 위한 x402 작동 방식입니다.
  </Card>
</CardGroup>
