Skip to main content

strands-ccxt

Universal CCXT tool for Strands Agents - trade on 100+ cryptocurrency exchanges.

Installation

pip install strands-ccxt

# With WebSocket support (ccxt.pro)
pip install strands-ccxt[pro]

Quick Start

from strands import Agent
from strands_ccxt import use_ccxt

agent = Agent(tools=[use_ccxt])

# Fetch BTC price
agent("What's the current BTC/USDT price on Bybit?")

# Compare prices across exchanges
agent("Compare BTC/USDT orderbooks on Binance, Bybit, and OKX")

Configuration

Set credentials via environment variables:

# Generic (works for any exchange)
export CCXT_EXCHANGE=bybit
export CCXT_API_KEY=your_api_key
export CCXT_SECRET=your_secret

# Or exchange-specific
export BYBIT_API_KEY=your_api_key
export BYBIT_API_SECRET=your_secret

# Optional
export CCXT_DEFAULT_TYPE=swap    # spot, swap, future
export CCXT_SANDBOX=true         # Enable testnet
export CCXT_TIMEOUT=30000        # Request timeout (ms)

Actions

Discovery

Action Description
list_exchanges List all 100+ supported exchanges
describe Get exchange capabilities and info
list_methods List available API methods
load_markets Load trading pairs/symbols

Market Data

Action Description
fetch_ticker Get ticker for a symbol
fetch_tickers Get all tickers
fetch_orderbook Get order book
fetch_ohlcv Get OHLCV candles
fetch_trades Get recent trades

Trading

Action Description
create_order Create buy/sell order
cancel_order Cancel an order
fetch_order Get order details
fetch_orders Get all orders
fetch_open_orders Get open orders
fetch_closed_orders Get closed orders

Account

Action Description
fetch_balance Get account balance
fetch_positions Get open positions
fetch_my_trades Get trade history

Multi-Exchange

Action Description
multi_orderbook Compare orderbooks across exchanges

WebSocket (requires [pro])

Action Description
watch_ticker Stream ticker updates
watch_orderbook Stream orderbook updates
watch_trades Stream trade updates
watch_ohlcv Stream OHLCV updates

Generic

Action Description
call Call any exchange method directly

Examples

Fetch Ticker

use_ccxt(
    action="fetch_ticker",
    exchange="bybit",
    symbol="BTC/USDT"
)

Fetch OHLCV Candles

use_ccxt(
    action="fetch_ohlcv",
    symbol="BTC/USDT",
    timeframe="1h",
    limit=100
)

Create Order

use_ccxt(
    action="create_order",
    symbol="BTC/USDT",
    side="buy",
    order_type="limit",
    amount=0.001,
    price=50000
)

Compare Orderbooks

use_ccxt(
    action="multi_orderbook",
    exchanges='["binance", "bybit", "okx"]',
    symbol="BTC/USDT"
)

Stream via WebSocket

use_ccxt(
    action="watch_ticker",
    symbol="BTC/USDT",
    max_messages=10,
    max_seconds=30
)

Call Any Method

use_ccxt(
    action="call",
    method="fetch_funding_rate",
    args='["BTC/USDT:USDT"]'
)

Parameters

Parameter Type Description
action str Operation to perform (required)
exchange str Exchange ID (e.g., "bybit")
symbol str Trading pair (e.g., "BTC/USDT")
method str Method name for call action
args str JSON array of positional arguments
kwargs str JSON object of keyword arguments
config str JSON object for exchange config
side str Order side: "buy" or "sell"
order_type str Order type: "market", "limit"
amount float Order quantity
price float Order price (limit orders)
order_id str Order ID for cancel/fetch
exchanges str JSON array of exchange IDs
timeframe str OHLCV timeframe (default: "1m")
limit int Number of results (default: 100)
max_messages int WebSocket message limit (default: 5)
max_seconds int WebSocket time limit (default: 15)

Supported Exchanges

100+ exchanges including:

  • Binance, Binance US, Binance Futures
  • Bybit (spot, derivatives)
  • OKX (OKEx)
  • Coinbase, Coinbase Pro
  • Kraken, Kraken Futures
  • KuCoin, KuCoin Futures
  • Gate.io
  • Bitget
  • MEXC
  • HTX (Huobi)
  • Bitfinex
  • Gemini
  • Bitstamp
  • And many more...

Use use_ccxt(action="list_exchanges") for the full list.

Security

  • API credentials are never logged or returned in responses
  • Sensitive data is automatically redacted from output
  • Supports exchange sandbox/testnet modes

License

Apache-2.0

Metadata

Release files for strands-ccxt 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for strands-ccxt 0.1.0
File Size Uploaded
strands_ccxt-0.1.0.tar.gz 20.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for strands-ccxt 0.1.0
File Interpreter ABI Platform
strands_ccxt-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.0 kB

Release files / strands_ccxt-0.1.0.tar.gz

Download URL strands_ccxt-0.1.0.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3c75da0a07205371be11a3c8dbfdad349c38c03288f6188c4e24b28c4ac4ec8d
BLAKE2b-256 checksum
How to use checksums
5e130a12f84af5d96a161f1ed315a437b54061bb478946068bb2f2539073c432
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / strands_ccxt-0.1.0-py3-none-any.whl

Download URL strands_ccxt-0.1.0-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78dd778d25b37d2f11c2a3f5ae522504a114de74d119f7b3df607de951076074
BLAKE2b-256 checksum
How to use checksums
20c1d10bfc242fd41992b18454262006c36b5d64ab0da4e41a663b7785abb808
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page