nansen-trading
Original:🇺🇸 English
Translated
Execute DEX swaps on Solana or Base. Use when buying or selling a token, getting a swap quote, or executing a trade.
3installs
Sourcenansen-ai/nansen-cli
Added on
NPX Install
npx skill4agent add nansen-ai/nansen-cli nansen-tradingTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Trade
Two-step flow: quote then execute. Trades are irreversible once on-chain.
Prerequisite: You need a wallet first. Run before trading.
nansen wallet createQuote
bash
nansen trade quote \
--chain solana \
--from SOL \
--to USDC \
--amount 1000000000Symbols resolve automatically: , , , , . Raw addresses also work.
SOLETHUSDCUSDTWETHExecute
bash
nansen trade execute --quote <quote-id>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
| Token | Chain | Address |
|---|---|---|
| SOL | Solana | |
| USDC | Solana | |
| ETH | Base | |
| USDC | Base | |
Amounts are in base units
| Token | Decimals | 1 token = |
|---|---|---|
| SOL | 9 | |
| ETH | 18 | |
| USDC | 6 | |
Flags
| Flag | Purpose |
|---|---|
| |
| Source token (symbol or address) |
| Destination token (symbol or address) |
| Amount in base units (integer) |
| Wallet name (default: default wallet) |
| Slippage tolerance as decimal (e.g. 0.03) |
| Quote ID for execute |
| Skip pre-broadcast simulation |
Environment Variables
| Var | Purpose |
|---|---|
| Required for |
| API key (also set via |
Agents: Never hold a wallet password only in session memory. Ifis not inNANSEN_WALLET_PASSWORD, follow the setup flow in the nansen-wallet-manager skill Password Policy to generate and persist one before proceeding.~/.nansen/.env
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).
- ERC-20 swaps may require an approval step — execute handles this automatically.