Agent skill

Nansen Trading

by nansen-ai in nansen-ai/nansen-cli

Execute DEX swaps on Solana or Base (including cross-chain bridges) and Hyperliquid perpetual trades.

MITAuto-check: notesBusiness, Finance & HR

Install Nansen Trading

skills CLI
$ npx skills add nansen-ai/nansen-cli --skill nansen-trading -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install nansen-ai/nansen-cli nansen-trading --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/nansen-ai/nansen-cli.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/nansen-trading .claude/skills/nansen-trading && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
nansen-trading
GitHub stars
139
Token cost
~3.3k tokens
SKILL.md length
1,308 words
Files
1
Skills in repo
32
Repo updated
First seen
Licence
MIT

At a glance

Execute DEX swaps on Solana or Base (including cross-chain bridges) and Hyperliquid perpetual trades.

  • Selling a token
  • SKILL.md covers Authentication, Quote, Constraints and Execute, plus 13 more sections
  • Needs NANSEN_WALLET_PASSWORD and NANSEN_API_KEY
  • Getting a swap quote

What it does

Nansen Trading is an agent skill from nansen-ai/nansen-cli. Execute DEX swaps on Solana or Base (including cross-chain bridges) and Hyperliquid perpetual trades. Use when buying or selling a token, getting a swap quote, executing a trade, or opening/closing/managing a perp position.

Its SKILL.md is about 3.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Business, Finance & HR, covering Trading and backtesting. It works with Solana, Hyperliquid and Circle USDC. The licence is MIT.

When your agent uses it

  • Selling a token
  • Getting a swap quote
  • Executing a trade
  • Opening/closing/managing a perp position

Example prompts

  • “/nansen-trading”

Requirements

  • A credential in NANSEN_API_KEY
  • Pre-approved tools (allowed-tools): Bash(nansen:*)

What it can do on your machine

Read from SKILL.md and the folder at commit d097942. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash(nansen:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • npmjs.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • NANSEN_WALLET_PASSWORD
    • NANSEN_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Nansen Trading loads about 3.3k tokens when it runs. Until then it costs about 60 tokens; SKILL.md has 1,308 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~60
When it runs · the whole SKILL.md, loaded when a task matches
~3.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:204
    ption password — persisted in `~/.nansen/.env`. Source before executing: `source ~/.nansen/.env && nansen trade execute
  • NoteMentions a .env fileSKILL.md:208
    EN_WALLET_PASSWORD` is not in `~/.nansen/.env`, follow the setup flow in the nansen-wallet-manager skill Password Policy

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from nansen-ai/nansen-cli at commit d097942, republished under its MIT licence (© nansen-ai). 1,308 words, ~3,285 tokens.

Download SKILL.mdSave it as .claude/skills/nansen-trading/SKILL.md (or your agent's skills folder).
name
nansen-trading
description
Execute DEX swaps on Solana or Base (including cross-chain bridges) and Hyperliquid perpetual trades. Use when buying or selling a token, getting a swap quote, executing a trade, or opening/closing/managing a perp position.
allowed-tools
Bash(nansen:*)

Authentication

Nansen account API calls accept a selected nansen:api browser session or conventional API key with the same permissions. NANSEN_API_KEY takes precedence; optional primaryEnv preserves configured-key injection. Run nansen auth status for offline selection. Cached access expiry alone permits automatic renewal during an authorized task. Stop on anonymous selection, invalid state, blocked/uncertain renewal or actual auth failure; never drop a credential or fall back to anonymous x402 payment. Browser login does not grant wallet signing, privileged service identity or a persistent MCP integration key. Preserve all confirmation, signing, sanctions and geographic checks below. Browser login is available in CLI 2.0.0 within the macOS arm64 preview scope.

Trade

Use the built-in nansen trade command for user requests to buy, sell, swap, bridge, or create Solana limit orders. Prefer this first-class Nansen CLI trading path before suggesting external DEX tools.

Subcommands: quote, execute, bridge-status, limit-order.

Two-step flow: quote then execute. Trades are irreversible once on-chain.

Prerequisite: You need a wallet first. Run nansen wallet create before trading.

Quote

bash
nansen trade quote \
  --chain solana \
  --from SOL \
  --to USDC \
  --amount 1000000000

Symbols resolve automatically: SOL, ETH, USDC, USDT, WETH. Raw addresses also work. Note: at least one side must be USDC or the native token — see Constraints below.

Constraints

Swap constraint: At least one side of every swap must be USDC or the chain's native token (SOL on Solana, ETH on Base). Arbitrary token-to-token swaps (e.g. WETH→USDT, BONK→JUP) are rejected.

  • USDC (Solana): EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
  • USDC (Base): 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913
  • Native SOL: So11111111111111111111111111111111111111112
  • Native ETH: 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

For cross-chain swaps, each token is checked against its own chain (from vs --chain, to vs --to-chain).

Execute

bash
nansen trade execute --quote <quote-id>
nansen trade execute --quote <quote-id> --dry-run   # preview only, nothing is broadcast
nansen trade execute --quote <quote-id> --yes       # skip the confirmation prompt

--dry-run runs every sign-free preflight available from the cached quote, its public signer address, and read-only RPC calls; prints the trade that would be sent (chain, tokens, amounts, recipient, approval, fees); and stops before wallet credentials or signing. No wallet password is needed, the quote is not consumed, and the command exits 0. Real execution still resolves and revalidates the live signer. On Base, preview also reads the current token allowance and runs the pre-broadcast revert simulation when no approval is outstanding.

Confirmation. When stdin is an interactive terminal, execute prints the plan and asks Broadcast this transaction? [y/N] before broadcasting. Answering anything but y/yes aborts with exit code 1 and nothing signed. Pass --yes (-y), or set NANSEN_YES=1, to skip the question.

Agents and CI are unaffected: when stdin is not a terminal (a pipe, a CI job, an agent shell) the command proceeds without prompting, exactly as before. --yes is accepted there and is simply a no-op, so it is safe to always pass it. The same flags and rules apply to nansen bridge execute.

Exit codes (trade execute, bridge execute)
CodeMeaning
0Broadcast succeeded, or the dry run completed
1Declined at the confirmation prompt, or the execution failed

Cross-Chain Swap

Bridge tokens between Solana and Base using --to-chain:

bash
nansen trade quote \
  --chain base \
  --to-chain solana \
  --from USDC \
  --to USDC \
  --amount 1000000

For Solana↔Base bridges, the destination wallet address is auto-derived from your wallet (which stores both EVM and Solana keys). Override with --to-wallet <address> if needed.

Note: you need gas on the source chain to submit the initial transaction (e.g. SOL for Solana→Base, ETH for Base→Solana).

Bridge Status

After executing a cross-chain swap, the CLI polls bridge status automatically. To check manually:

bash
nansen trade bridge-status --tx-hash <hash> --from-chain base --to-chain solana

Limit Orders

Create and manage Solana limit orders:

bash
nansen trade limit-order create \
  --from SOL \
  --to USDC \
  --amount 1.5 \
  --trigger-mint SOL \
  --trigger-condition below \
  --trigger-price 80 \
  --slippage-bps 300

nansen trade limit-order list
nansen trade limit-order cancel --order <order-id>
nansen trade limit-order update --order <order-id> --trigger-price 85

--slippage-bps is basis points (300 = 3%, 100 = 1%); omit for auto.

Agent pattern

bash
# Pipe quote ID directly into execute
quote_id=$(nansen trade quote --chain solana --from SOL --to USDC --amount 1000000000 2>&1 | grep "Quote ID:" | awk '{print $NF}')
nansen trade execute --quote "$quote_id"

Common Token Addresses

TokenChainAddress
SOLSolanaSo11111111111111111111111111111111111111112
USDCSolanaEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
ETHBase0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
USDCBase0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913

Amounts

By default, --amount accepts integer base units (lamports, wei, etc). Use --amount-unit token for human-readable token amounts, or --amount-unit usd to specify a USD value — the CLI resolves price and decimals automatically.

bash
# Base units (default)
nansen trade quote --chain solana --from SOL --to USDC --amount 1000000000
# Token units (0.5 SOL = 500000000 lamports, resolved automatically)
nansen trade quote --chain solana --from SOL --to USDC --amount 0.5 --amount-unit token
# USD amount ($50 worth of SOL, price resolved via Nansen search API)
nansen trade quote --chain solana --from SOL --to USDC --amount 50 --amount-unit usd
TokenDecimals1 token =
SOL91000000000
ETH181000000000000000000
USDC61000000

If the user says "$20 worth of X", use --amount-unit usd directly — no manual conversion needed. The CLI fetches the current price and converts for you.

Flags

trade quote flags
FlagPurpose
--chainSource chain: solana or base
--to-chainDestination chain for cross-chain swap (omit for same-chain)
--fromSource token (symbol or address)
--toDestination token (symbol or address, resolved against destination chain)
--amountAmount in base units (integer), or token/USD units with --amount-unit
--amount-unittoken for token units (e.g. 0.5 SOL), usd for USD (e.g. 50), base = default
--walletWallet name (default: default wallet)
--to-walletDestination wallet address (auto-derived for cross-chain if omitted)
--slippageSlippage tolerance as decimal (e.g. 0.03)
--auto-slippageEnable auto slippage calculation
--max-auto-slippageMax auto slippage when --auto-slippage is enabled
--swap-modeexactIn (default) or exactOut
trade execute flags
FlagPurpose
--quoteQuote ID from trade quote
--walletWallet name (default: default wallet)
--quote-indexPin a specific quote by index (0-based) when multiple quotes were returned
--no-simulateSkip pre-broadcast simulation
--dry-runValidate and print what would be sent, then stop. Nothing is signed or broadcast
--yes, -ySkip the confirmation prompt (same as NANSEN_YES=1); no-op when stdin is not a terminal
Show full SKILL.md (500 more words)Show less
trade bridge-status flags
FlagPurpose
--tx-hashSource tx hash
--from-chainSource chain (for bridge-status)
--to-chainDestination chain (for bridge-status)

Environment Variables

VarPurpose
NANSEN_WALLET_PASSWORDRequired for trade execute. Wallet encryption password — persisted in ~/.nansen/.env. Source before executing: source ~/.nansen/.env && nansen trade execute ...
NANSEN_API_KEYAPI key (also set via explicit nansen login --human; browser sessions are not wallet or RPC keys)
NANSEN_YESSet to 1 to skip the execute confirmation prompt, like --yes

Agents: Never hold a wallet password only in session memory. If NANSEN_WALLET_PASSWORD is not in ~/.nansen/.env, follow the setup flow in the nansen-wallet-manager skill Password Policy to generate and persist one before proceeding.

Notes

  • Quotes expire after ~1 hour. If execute fails, get a fresh quote.
  • A wallet is required even for quotes (the API builds sender-specific transactions).
  • Compliance screen: trade quote and trade execute check the signing wallet (and any distinct --to-wallet destination) against the compliance blocklist through the Nansen API before requesting a quote or signing — the same fail-closed check bridge and perp run. A flagged address aborts with code SANCTIONED; if the screening call itself fails the command aborts with SCREENING_UNAVAILABLE. Nothing is signed or broadcast in either case.
  • ERC-20 swaps may require an approval step — execute handles this automatically.

Perp Trading

Use nansen perp for Hyperliquid perpetual trading. Uses the same wallet and NANSEN_WALLET_PASSWORD as DEX trading; requires an EVM wallet. Perp orders are irreversible once signed.

Subcommands: order, cancel, close, leverage, positions, orders, account, meta.

The asset is selected with --coin (e.g. BTC, ETH); --symbol is accepted as an alias. List tradable assets and their max leverage with nansen perp meta (use --filter <text> or --all to see beyond the first 20).

Open a position

bash
# Limit long: 0.1 ETH at $1600
nansen perp order --coin ETH --side buy --size 0.1 --price 1600 --type limit

# Market short with optional take-profit / stop-loss
nansen perp order --coin BTC --side sell --size 0.001 --price 95000 --type market \
  --take-profit 90000 --stop-loss 98000
  • --side: buy/long to open a long, sell/short to open a short.
  • --size: position size in base asset units (positive number).
  • --price: limit price (or mark price for market orders).
  • --type: limit (default) or market. --tif: Gtc (default), Ioc, Alo.
  • --slippage: decimal in [0,1] for market orders (default 0.03 = 3%).

On success the command prints the Hyperliquid order id (oid) and the fill (size @ avg price). A resting (unfilled) order also prints a ready-to-run nansen perp cancel --coin <coin> --oid <oid>. Attached take-profit/stop-loss legs are labelled and each print their own oid.

Close / cancel

bash
# Close: sell to close a long, buy to close a short (validated against your open position)
nansen perp close --coin ETH --size 0.1 --price 1600 --side sell

# Cancel a resting order by id
nansen perp cancel --coin ETH --oid 123456

Leverage, transfers & account

bash
nansen perp leverage --coin ETH --leverage 5 --margin-type cross   # or isolated
nansen perp transfer --direction spot-to-perp --amount 25          # or perp-to-spot
nansen perp positions
nansen perp account     # account value, unrealized PnL, margin used, withdrawable, spot USDC

--leverage must be a whole integer and is capped at the asset's maximum (see perp meta).

Spot vs Perps: perp trading draws from the Perps balance, but USDC sent to a wallet via Hyperliquid's Send lands in Spot (and shows as Spot USDC in perp account). Move it across with perp transfer --direction spot-to-perp --amount <usdc> before trading. (Deposits via the bridge land in Perps directly.)

Source

Browser login uses nansen:api with the same account API permissions as an API key, subject to existing plan/account/endpoint checks. Trading still requires a separately configured wallet and its signing authorization. Hosted simulation uses the selected credential only on the matching trusted Nansen API origin; arbitrary RPC endpoints never receive Nansen credentials.

© nansen-ai, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/nansen-trading of nansen-ai/nansen-cli.

Open the folder on GitHubat commit d097942

Compare with similar skills

Nansen Trading next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Nansen Trading compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Nansen Trading this skillnansen-ai/nansen-cli139—~3.3kAutomated safety check: NotesMIT
Minara Crypto Trading and WalletMinara-AI/minara-skills362—~5.7kAutomated safety check: PassNone
Solana Payments Wallets Tradingnpc-live/clawfirm1561 repos~4.7kAutomated safety check: PassMIT
Funding Rate ArbitrageSuperior-Trade/superior-skills215—~1.9kAutomated safety check: PassMIT
Aomi Transactjeremylongshore/tons-of-skills-marketplace2.8k—~2.3kAutomated safety check: PassMIT
SupurrLeoYeAI/openclaw-master-skills2.2k—~6.5kAutomated safety check: PassMIT

Similar skills

  • Minara Crypto Trading and Wallet

    Minara-AI/minara-skills

    Drives the Minara CLI for crypto swaps, perps, limit orders, wallet transfers, deposits and withdrawals, plus AI market analysis.

    362 GitHub stars~5.7k tokensUpdated 23 days ago
    Business, Finance & HRAuto-check passed
  • Pay people in SOL or USDC, buy and sell tokens, check prices, discover trending and new tokens, create and manage Solana wallets, stake SOL, earn yield through lending and managed vaults, borrow…

    156 GitHub starsUsed in 1 repo~4.7k tokens
    Business, Finance & HRAuto-check passed
  • Funding Rate Arbitrage

    Superior-Trade/superior-skills

    A skill your agent uses when writing a funding-rate-driven perp strategy on Superior Trade — anything described as funding harvest, funding arbitrage, funding rate carry, negative funding, paid to…

    215 GitHub stars~1.9k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Aomi Transact

    jeremylongshore/tons-of-skills-marketplace

    Build natural-language crypto agents, web3 assistants, and trading bots that read and write EVM chain state.

    2.8k GitHub stars~2.3k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Supurr

    LeoYeAI/openclaw-master-skills

    Backtest, deploy, and monitor trading bots on Hyperliquid. An agent skill from LeoYeAI/openclaw-master-skills.

    2.2k GitHub stars~6.5k tokensUpdated 2 mo ago
    Business, Finance & HRAuto-check passed
  • Hyperliquid

    Superior-Trade/superior-skills

    A skill your agent uses when backtesting, deploying, checking funding readiness, or debugging a Hyperliquid strategy through Superior Trade Unified API — writing Freqtrade configs and strategy code…

    215 GitHub stars~5.5k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check: warnings

More from nansen-ai/nansen-cli

All 32 skills in this repo
  • Nansen Smart Money Tracker

    nansen-ai/nansen-cli

    Smart money tracking — netflow, trades, holdings, perp trades.

    139 GitHub starsUsed in 2 repos~1.1k tokens
    Auto-check passed
  • Nansen Token Research

    nansen-ai/nansen-cli

    Token deep dive — info, OHLCV, holders, flows, flow intelligence, who bought/sold, DEX trades, PnL, perp trades, perp positions, perp PnL leaderboard.

    139 GitHub starsUsed in 2 repos~1.2k tokens
    Auto-check passed
  • Nansen Wallet Profiler

    nansen-ai/nansen-cli

    Wallet profiler — balance, PnL, labels, transactions, counterparties, related wallets, batch, trace, compare.

    139 GitHub starsUsed in 2 repos~1.5k tokens
    Auto-check passed
  • Nansen Agent Guide

    nansen-ai/nansen-cli

    Routing guide -- when to use nansen agent (AI research) vs direct CLI data commands.

    139 GitHub stars~948 tokensUpdated yesterday
    Auto-check passed
  • Nansen Limit Orders

    nansen-ai/nansen-cli

    Guide users through native limit orders on Solana via nansen trade limit-order create|list|cancel|update, and the alert-based settlement-signal fallback for chains without native support.

    139 GitHub stars~2.5k tokensUpdated yesterday
    Auto-check passed
  • Nansen Smart Alerts

    nansen-ai/nansen-cli

    Manage smart alerts — list, create, update, toggle, delete. An agent skill from nansen-ai/nansen-cli.

    139 GitHub stars~1.6k tokensUpdated yesterday
    Auto-check passed

Questions about Nansen Trading

What does Nansen Trading do?

Execute DEX swaps on Solana or Base (including cross-chain bridges) and Hyperliquid perpetual trades. Nansen Trading is an agent skill from nansen-ai/nansen-cli. Execute DEX swaps on Solana or Base (including cross-chain bridges) and Hyperliquid perpetual trades.

When should I use Nansen Trading?

Nansen Trading fits situations like: selling a token; getting a swap quote; executing a trade; opening/closing/managing a perp position.

How do I install Nansen Trading in Claude Code?

Run `npx skills add nansen-ai/nansen-cli --skill nansen-trading -a claude-code`. Or copy the skill folder (skills/nansen-trading in nansen-ai/nansen-cli) into .claude/skills/nansen-trading in your project. Claude Code loads it when a task matches its description.

How do I install Nansen Trading in Codex?

Run `npx skills add nansen-ai/nansen-cli --skill nansen-trading -a codex`. Or copy the skill folder (skills/nansen-trading in nansen-ai/nansen-cli) into .agents/skills/nansen-trading in your project. Codex loads it when a task matches its description.

Can I use Nansen Trading in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add nansen-ai/nansen-cli --skill nansen-trading -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/nansen-trading, .gemini/skills/nansen-trading, .github/skills/nansen-trading and .opencode/skills/nansen-trading in your project.

What does Nansen Trading need to run?

Going by SKILL.md and its folder, Nansen Trading needs credentials named NANSEN_WALLET_PASSWORD and NANSEN_API_KEY. Our summary lists: A credential in NANSEN_API_KEY. Its frontmatter pre-approves these tools: Bash(nansen:*).

Does Nansen Trading access the network?

SKILL.md names 1 domain. As links in the text: npmjs.com. This is read from the text; nothing was executed.

Is Nansen Trading safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Nansen Trading use?

Nansen Trading is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Nansen Trading use?

About 3.3k tokens (SKILL.md is roughly 13k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Nansen Trading?

Skills that share tags, products or a category with Nansen Trading: Minara Crypto Trading and Wallet (Minara-AI/minara-skills, 362 stars), Solana Payments Wallets Trading (npc-live/clawfirm, 156 stars), Funding Rate Arbitrage (Superior-Trade/superior-skills, 215 stars) and Aomi Transact (jeremylongshore/tons-of-skills-marketplace, 2.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Nansen Trading?

nansen-ai (a GitHub organization) maintains it in nansen-ai/nansen-cli, which has 139 GitHub stars. The repository holds 32 skills in this directory. The repository was last updated on October 9, 2026.

Source: nansen-ai/nansen-cli on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.