Agent-native trading terminal for Pacifica DEX
One codebase. Three interfaces. Full agent control.
A terminal-first trading suite for the Pacifica perpetuals DEX — built for traders who live in the terminal and AI agents that need programmatic market access.
┌─────────────────────────────────────────────────────────────────┐
│ pacifica scan │
├──────────┬──────────┬────────┬──────────────┬────────┬─────────┤
│ Symbol │ Price │ 24h % │ Volume │ OI │ Funding │
├──────────┼──────────┼────────┼──────────────┼────────┼─────────┤
│ BTC-PERP │ 69,420 │ +2.4% │ $48.2M │ $120M │ +0.01% │
│ ETH-PERP │ 3,852 │ +1.1% │ $21.6M │ $58M │ +0.008% │
│ SOL-PERP │ 182 │ -0.8% │ $9.4M │ $24M │ -0.003% │
│ JTO-PERP │ 4.21 │ +5.2% │ $3.1M │ $8M │ +0.021% │
└──────────┴──────────┴────────┴──────────────┴────────┴─────────┘
Live ● testnet
| Interface | Command | Purpose |
|---|---|---|
| CLI / TUI | pacifica <cmd> |
Rich terminal UI — live markets, orders, positions, PnL |
| MCP Server | pacifica-mcp |
23 tools for AI agents (Claude, Cursor, any MCP client) |
| Claude Skills | /scan, /trade, /journal |
Slash commands for agent-assisted workflows |
Before using the CLI, activate your wallet on the Pacifica testnet app:
- Go to test-app.pacifica.fi
- Connect your Solana wallet (Phantom, Backpack, etc.)
- Enter access code:
Pacifica - Use the Faucet to mint test USDP
npm install -g pacifica-cli
pacifica init --testnetThe init wizard will ask for your private key and set safe defaults for leverage, slippage, and agent guardrails.
pacifica scan # live market feed
pacifica trade buy ETH 0.5 --lev 5 # place a market order
pacifica positions # view open positions
pacifica journal # PnL history & statspacifica scan # live prices, volume, funding, OI
pacifica funding # funding rates sorted by APRpacifica trade buy <symbol> <size> # market buy
pacifica trade sell <symbol> <size> # market sell
pacifica trade buy <symbol> <size> --limit <price> # limit order
pacifica trade buy <symbol> <size> --lev 10 --tp 4200 --sl 3600pacifica orders # list open orders
pacifica orders cancel <id> # cancel one order
pacifica orders cancel-all [symbol] # cancel all (or by symbol)
pacifica positions # open positions with PnL
pacifica positions close <symbol> # close at market
pacifica heatmap # risk heatmap (live, color-coded)pacifica smart add-trailing <symbol> <distance%> # trailing stop
pacifica smart add-partial-tp <symbol> # multi-level take-profit
pacifica smart list # active automations
pacifica smart cancel <id> # remove automationpacifica journal # full trade history
pacifica journal --symbol ETH # filter by market
pacifica journal --period week # today / week / month / allpacifica agent status # guardrails, budget, recent actions
pacifica agent config # edit limits interactively
pacifica agent log # full audit trail
pacifica agent stop / start # disable / enable agent tradingAdd to your Claude Desktop or Cursor config to give Claude full trading access with built-in guardrails:
{
"mcpServers": {
"pacifica": {
"command": "npx",
"args": ["-y", "pacifica-cli", "--mcp"]
}
}
}| Category | Tools |
|---|---|
| Read (10) |
get_markets · get_ticker · get_orderbookget_positions · get_account · get_ordersget_order_history · get_trade_historyget_trades_stats · get_agent_status
|
| Analytics (5) |
get_funding_rates · analyze_riskget_smart_orders · get_journal_statsget_heatmap_data
|
| Funding (2) |
get_funding_history · analyze_funding_arb
|
| Write (6) |
place_order · close_position · cancel_orderset_position_tpsl · create_smart_ordercancel_smart_order
|
All write tools pass through the guardrail system — order size limits, leverage caps, daily spending budget, and action whitelist are enforced on every agent call.
Every agent action is checked before execution:
Agent call
│
├─ ① Agent enabled?
├─ ② Action in blocked list? → reject
├─ ③ Action in allowed list? → reject if not
├─ ④ Order size ≤ max_order_size? → reject if over
├─ ⑤ Leverage ≤ max_leverage? → reject if over
└─ ⑥ Daily spend + order ≤ budget? → reject if over
│
└─ amount > confirm_threshold? → ask for confirmation
Configure limits in ~/.pacifica.yaml:
agent:
enabled: true
daily_spending_limit: 5000 # USD
max_order_size: 2000 # USD per order
max_leverage: 5
allowed_actions:
- place_order
- close_position
- cancel_order
- set_tpsl
require_confirmation_above: 1000┌─────────────────────────────────────────────────────────────┐
│ User / Agent │
└──────────────────┬───────────────────┬──────────────────────┘
│ │
┌─────────▼──────┐ ┌────────▼────────┐
│ CLI (TUI) │ │ MCP Server │
│ Commander.js │ │ stdio / tools │
│ Ink (React) │ │ 23 tools │
└─────────┬──────┘ └────────┬────────┘
│ │
┌─────────▼───────────────────▼──────┐
│ Core Layer │
│ │
│ ┌───────────┐ ┌───────────────┐ │
│ │ SDK │ │ Agent │ │
│ │ Client │ │ Guardrails │ │
│ │ Signer │ │ Spending │ │
│ │ WS │ │ Logger │ │
│ └─────┬─────┘ └───────────────┘ │
│ │ │
│ ┌─────┴──────────────────────┐ │
│ │ Smart Orders · Risk Calc │ │
│ │ Journal · Config │ │
│ └────────────────────────────┘ │
└────────────────┬────────────────────┘
│
┌────────────────▼────────────────────┐
│ Pacifica DEX API │
│ REST (signed Ed25519) + WebSocket │
│ Testnet: test-api.pacifica.fi │
│ Mainnet: api.pacifica.fi │
└─────────────────────────────────────┘
All data is stored locally — no external database required:
| File | Purpose |
|---|---|
~/.pacifica.yaml |
Config: network, keys, agent limits |
~/.pacifica/spending.json |
Daily budget ledger (auto-resets midnight) |
~/.pacifica/agent-log.json |
Append-only audit trail of all agent actions |
~/.pacifica/journal.json |
Trade log: fills, closes, smart order triggers |
~/.pacifica/smart-orders.json |
Active trailing stops & partial take-profits |
All files are created with
chmod 0o600(owner read/write only).
| Track | Tech |
|---|---|
| Pacifica DEX | Perpetuals trading, Ed25519 signing, WebSocket feeds |
| Claude MCP | 23 tools with full guardrail enforcement |
| Solana | Keypair auth, base58 encoding |
| Terminal UI | Ink (React-in-terminal), Commander.js |
