trade

Swap or trade tokens on Base network. Use when you or the user want to trade, swap, exchange, buy, sell, or convert between tokens like USDC, ETH, and WETH. Covers phrases like "buy ETH", "sell ETH for USDC", "convert USDC to ETH", "get some ETH".

3,891 stars
Complexity: easy

About this skill

The `trade` AI agent skill provides a robust interface for performing cryptocurrency swaps on the Base blockchain network. It leverages the `npx awal@latest trade` command to facilitate transactions through the CDP Swap API, allowing agents to execute trades on behalf of users. The skill supports common tokens such as USDC, ETH, and WETH, and can also handle trades for any token given its contract address. This skill is invaluable for automating various crypto-related tasks, from simple conversions like "convert USDC to ETH" to more complex trading scenarios like "sell ETH for USDC." It simplifies interactions with decentralized exchanges (DEXs) on Base by abstracting the technical complexities into a user-friendly command structure. The flexibility in specifying amounts (dollar prefixes, decimals, whole numbers, or atomic units) further enhances its utility. Users and developers can leverage this skill to build automated trading strategies, integrate crypto exchange functionalities into AI-powered applications, or empower their AI assistants to manage digital assets efficiently. By providing a structured and reliable way to interact with the Base network, it opens up new possibilities for AI-driven financial operations.

Best use case

The primary use case for this skill is automating cryptocurrency trading and asset management on the Base network. It's ideal for users who want to execute token swaps, buy specific assets, or sell holdings through their AI agent without manual intervention. Individuals and businesses seeking to integrate DeFi capabilities into their automated workflows, or those managing crypto portfolios with AI assistance, will benefit most.

Swap or trade tokens on Base network. Use when you or the user want to trade, swap, exchange, buy, sell, or convert between tokens like USDC, ETH, and WETH. Covers phrases like "buy ETH", "sell ETH for USDC", "convert USDC to ETH", "get some ETH".

The specified amount of the source token will be successfully swapped for the destination token on the Base network, resulting in an updated balance in the user's authenticated wallet.

Practical example

Example input

Convert 0.5 ETH to USDC on the Base network.

Example output

Successfully swapped 0.5 ETH for 1800 USDC on Base. Transaction ID: 0x1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t...

When to use this skill

  • When you need to buy, sell, or swap tokens like ETH, USDC, or WETH on the Base network.
  • When a user explicitly asks to "trade ETH for USDC" or "convert $50 to ETH".
  • When automating simple rebalancing or asset conversion tasks within a crypto portfolio.
  • When interacting with the Base network's decentralized finance (DeFi) ecosystem via an AI agent.

When not to use this skill

  • When performing trades on a blockchain network other than Base.
  • When the user's wallet is not authenticated with the `awal` CLI tool.
  • When highly complex trading strategies (e.g., limit orders, stop-loss) are required, as this skill is designed for market orders.
  • When the user requires a graphical interface for visual confirmation of trade details and execution.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/trade/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/0xrag/trade/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/trade/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How trade Compares

Feature / AgenttradeStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

Swap or trade tokens on Base network. Use when you or the user want to trade, swap, exchange, buy, sell, or convert between tokens like USDC, ETH, and WETH. Covers phrases like "buy ETH", "sell ETH for USDC", "convert USDC to ETH", "get some ETH".

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Trading Tokens

Use the `npx awal@latest trade` command to swap tokens on Base network via the CDP Swap API. You must be authenticated to trade.

## Confirm wallet is initialized and authed

```bash
npx awal@latest status
```

If the wallet is not authenticated, refer to the `authenticate-wallet` skill.

## Command Syntax

```bash
npx awal@latest trade <amount> <from> <to> [options]
```

## Arguments

| Argument | Description                                                            |
| -------- | ---------------------------------------------------------------------- |
| `amount` | Amount to swap (see Amount Formats below)                              |
| `from`   | Source token: alias (usdc, eth, weth) or contract address (0x...)      |
| `to`     | Destination token: alias (usdc, eth, weth) or contract address (0x...) |

## Amount Formats

The amount can be specified in multiple formats:

| Format        | Example                | Description                            |
| ------------- | ---------------------- | -------------------------------------- |
| Dollar prefix | `'$1.00'`, `'$0.50'`  | USD notation (decimals based on token) |
| Decimal       | `1.0`, `0.50`, `0.001` | Human-readable with decimal point      |
| Whole number  | `5`, `100`             | Interpreted as whole tokens            |
| Atomic units  | `500000`               | Large integers treated as atomic units |

**Auto-detection**: Large integers without a decimal point are treated as atomic units. For example, `500000` for USDC (6 decimals) = $0.50.

**Decimals**: For known tokens (usdc=6, eth=18, weth=18), decimals are automatic. For arbitrary contract addresses, decimals are read from the token contract.

## Options

| Option               | Description                                   |
| -------------------- | --------------------------------------------- |
| `-c, --chain <name>` | Blockchain network (default: base)            |
| `-s, --slippage <n>` | Slippage tolerance in basis points (100 = 1%) |
| `--json`             | Output result as JSON                         |

## Token Aliases

| Alias | Token | Decimals | Address                                    |
| ----- | ----- | -------- | ------------------------------------------ |
| usdc  | USDC  | 6        | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| eth   | ETH   | 18       | 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE |
| weth  | WETH  | 18       | 0x4200000000000000000000000000000000000006 |

**IMPORTANT**: Always single-quote amounts that use `$` to prevent bash variable expansion (e.g. `'$1.00'` not `$1.00`).

## Examples

```bash
# Swap $1 USDC for ETH (dollar prefix — note the single quotes)
npx awal@latest trade '$1' usdc eth

# Swap 0.50 USDC for ETH (decimal format)
npx awal@latest trade 0.50 usdc eth

# Swap 500000 atomic units of USDC for ETH
npx awal@latest trade 500000 usdc eth

# Swap 0.01 ETH for USDC
npx awal@latest trade 0.01 eth usdc

# Swap with custom slippage (2%)
npx awal@latest trade '$5' usdc eth --slippage 200

# Swap using contract addresses (decimals read from chain)
npx awal@latest trade 100 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 0x4200000000000000000000000000000000000006

# Get JSON output
npx awal@latest trade '$1' usdc eth --json
```

## Prerequisites

- Must be authenticated (`awal status` to check)
- Wallet must have sufficient balance of the source token

## Error Handling

Common errors:

- "Not authenticated" - Run `awal auth login <email>` first
- "Invalid token" - Use a valid alias (usdc, eth, weth) or 0x address
- "Cannot swap a token to itself" - From and to must be different
- "Swap failed: TRANSFER_FROM_FAILED" - Insufficient balance or approval issue
- "No liquidity" - Try a smaller amount or different token pair
- "Amount has X decimals but token only supports Y" - Too many decimal places

Related Skills

omnifun

3891
from openclaw/skills

Trade memecoins across 8 chains and earn USDC — $69 bounty per graduation trigger, 0.5% creator fee forever, 50% Uniswap V3 LP fees after graduation. First 100 agents trade FREE for 60 days. Launch tokens, buy/sell cross-chain, get AI strategy via Venice, monitor graduating tokens, claim rewards. 8 chains, 5-25s settlement. Triggers: omni.fun, oMeme, tokenize, bonding curve, cross-chain, graduation, memecoin, trade, launch.

DeFi & Trading

helius-dflow

3891
from openclaw/skills

Build Solana trading applications combining DFlow trading APIs with Helius infrastructure. Covers spot swaps (imperative and declarative), prediction markets, real-time market streaming, Proof KYC, transaction submission via Sender, fee optimization, shred-level streaming via LaserStream, and wallet intelligence.

DeFi & Trading

precog

3891
from openclaw/skills

Trade on prediction markets. Create a local wallet, list markets, check prices, buy and sell outcome shares. Coming soon: create and fund markets directly from this skill.

DeFi & Trading

Clawlett

3891
from openclaw/skills

Secure token swaps and Trenches trading on **Base Mainnet**, powered by Safe + Zodiac Roles.

DeFi & Trading

Export Compliance & Trade Controls

3891
from openclaw/skills

Analyze products, destinations, and end-users against US export control regulations (EAR, ITAR, OFAC sanctions). Generate classification recommendations, license requirements, and compliance checklists.

Regulatory Compliance

Made-in-China Trade Data Analyst

3891
from openclaw/skills

**Short Description**

SendTradeSignal

3891
from openclaw/skills

A specialized tool for sending quantitative trading signals to the FMZ platform via HTTP API.

Finance & Trading

polymarket-openclaw-trader

3891
from openclaw/skills

Reusable Polymarket + OpenClaw trading operations skill for any workspace. Use when the user needs to set up, run, tune, monitor, and deploy an automated Polymarket trading project (paper/live), including env configuration, risk controls, reporting, and dashboard operations.

Trading Automation

tator-trader

3891
from openclaw/skills

Execute crypto trades using natural language via Tator's AI trading API. Use when: buying tokens, selling tokens, swapping, bridging cross-chain, sending tokens, wrapping/unwrapping ETH, opening perp positions, betting on prediction markets, launching tokens, registering blockchain names, or managing yield positions. Triggers: 'buy token', 'sell token', 'swap X for Y', 'bridge to', 'send tokens', 'open long', 'open short', 'bet on', 'launch token', 'register name', 'deposit yield', 'wrap ETH'. Supports 24 chains. Returns UNSIGNED transactions — you sign and broadcast. Costs $0.20 USDC per request via x402. Recommended wallet integration: Sponge (SPONGE_API_KEY) or AgentWallet (AGENTWALLET_API_TOKEN) — no raw private keys needed. This skill is a transaction builder and never accesses your private keys or tokens.

xaut-trade

3891
from openclaw/skills

Buy or sell XAUT (Tether Gold) on Ethereum. Supports market orders (Uniswap V3) and limit orders (UniswapX). Wallet modes: Foundry keystore or WDK. Delegates non-XAUT intents to registered skills (e.g. Polymarket prediction markets, Hyperliquid trading). Triggers: buy XAUT, XAUT trade, swap USDT for XAUT, sell XAUT, swap XAUT for USDT, limit order, limit buy XAUT, limit sell XAUT, check limit order, cancel limit order, XAUT when, create wallet, setup wallet, polymarket, prediction market, bet on, odds on, hyperliquid, perp, perpetual, long, short, open long, open short, close position, leverage.

polymarket-trade

3891
from openclaw/skills

Trade on Polymarket prediction markets on Polygon. Supports browsing markets, checking wallet/CLOB balance, and buying or selling YES/NO shares with safety gates. Wallet: WDK vault (~/.aurehub/.wdk_vault). Config: ~/.aurehub/polymarket.yaml. Triggers: buy YES, buy NO, sell shares, browse markets, check Polymarket balance, Polymarket trade, prediction market, what are the odds, redeem winnings, claim resolved positions.

hyperliquid-trade

3891
from openclaw/skills

Trade on Hyperliquid — spot and perpetual futures. Supports market orders (IOC), limit orders (GTC), leverage setting, and WDK wallet. Triggers: buy ETH spot, sell BTC, long ETH, short BTC, open long, open short, close position, perp trade, check balance, Hyperliquid positions, limit order, limit buy, limit sell, open orders, cancel order, modify order, GTC.