CCXT library support for Go developers to interact with cryptocurrency exchanges via REST and WebSocket APIs.
Install
mkdir -p .claude/skills/ccxt-go && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/4151" && unzip -o skill.zip -d .claude/skills/ccxt-go && rm skill.zipInstalls to .claude/skills/ccxt-go
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
CCXT cryptocurrency exchange library for Go developers. Covers both REST API (standard) and WebSocket API (real-time). Helps install CCXT, connect to exchanges, fetch market data, place orders, stream live tickers/orderbooks, handle authentication, and manage errors in Go projects. Use when working with crypto exchanges in Go applications, microservices, or trading systems.Key capabilities
- →Connect to crypto exchanges
- →Fetch market data (tickers, orderbooks)
- →Place limit and market orders
- →Stream real-time data via WebSockets
- →Manage authentication and errors
How it works
The library provides a unified interface for both REST and WebSocket APIs across multiple cryptocurrency exchanges, abstracting exchange-specific differences into common Go methods.
Inputs & outputs
When to use ccxt-go
- →Fetching crypto market tickers
- →Placing automated orders
- →Streaming live orderbooks
- →Building trading bots
About this skill
CCXT for Go
A comprehensive guide to using CCXT in Go projects for cryptocurrency exchange integration.
Installation
REST API
go get github.com/ccxt/ccxt/go/v4
WebSocket API (ccxt.pro)
go get github.com/ccxt/ccxt/go/v4/pro
Quick Start
REST API
package main
import (
"fmt"
"github.com/ccxt/ccxt/go/v4/binance"
)
func main() {
exchange := binance.New()
markets, err := exchange.LoadMarkets()
if err != nil {
panic(err)
}
ticker, err := exchange.FetchTicker("BTC/USDT")
if err != nil {
panic(err)
}
fmt.Println(ticker)
}
WebSocket API - Real-time Updates
package main
import (
"fmt"
"github.com/ccxt/ccxt/go/v4/pro/binance"
)
func main() {
exchange := binance.New()
defer exchange.Close()
for {
ticker, err := exchange.WatchTicker("BTC/USDT")
if err != nil {
panic(err)
}
fmt.Println(ticker.Last) // Live updates!
}
}
REST vs WebSocket
| Feature | REST API | WebSocket API |
|---|---|---|
| Use for | One-time queries, placing orders | Real-time monitoring, live price feeds |
| Import | github.com/ccxt/ccxt/go/v4/{exchange} | github.com/ccxt/ccxt/go/v4/pro/{exchange} |
| Methods | Fetch* (FetchTicker, FetchOrderBook) | Watch* (WatchTicker, WatchOrderBook) |
| Speed | Slower (HTTP request/response) | Faster (persistent connection) |
| Rate limits | Strict (1-2 req/sec) | More lenient (continuous stream) |
| Best for | Trading, account management | Price monitoring, arbitrage detection |
Important: All methods return (result, error) - always check errors!
Creating Exchange Instance
REST API
import "github.com/ccxt/ccxt/go/v4/binance"
// Public API (no authentication)
exchange := binance.New()
exchange.EnableRateLimit = true // Recommended!
// Private API (with authentication)
exchange := binance.New()
exchange.ApiKey = "YOUR_API_KEY"
exchange.Secret = "YOUR_SECRET"
exchange.EnableRateLimit = true
WebSocket API
import "github.com/ccxt/ccxt/go/v4/pro/binance"
// Public WebSocket
exchange := binance.New()
defer exchange.Close()
// Private WebSocket (with authentication)
exchange := binance.New()
exchange.ApiKey = "YOUR_API_KEY"
exchange.Secret = "YOUR_SECRET"
defer exchange.Close()
Common REST Operations
Loading Markets
// Load all available trading pairs
markets, err := exchange.LoadMarkets()
if err != nil {
panic(err)
}
// Access market information
btcMarket := exchange.Market("BTC/USDT")
fmt.Println(btcMarket.Limits.Amount.Min) // Minimum order amount
Fetching Ticker
// Single ticker
ticker, err := exchange.FetchTicker("BTC/USDT")
if err != nil {
panic(err)
}
fmt.Println(ticker.Last) // Last price
fmt.Println(ticker.Bid) // Best bid
fmt.Println(ticker.Ask) // Best ask
fmt.Println(ticker.Volume) // 24h volume
// Multiple tickers (if supported)
tickers, err := exchange.FetchTickers([]string{"BTC/USDT", "ETH/USDT"})
Fetching Order Book
// Full orderbook
orderbook, err := exchange.FetchOrderBook("BTC/USDT", nil)
if err != nil {
panic(err)
}
fmt.Println(orderbook.Bids[0]) // [price, amount]
fmt.Println(orderbook.Asks[0]) // [price, amount]
// Limited depth
limit := 5
orderbook, err := exchange.FetchOrderBook("BTC/USDT", &limit)
Creating Orders
Limit Order
// Buy limit order
order, err := exchange.CreateLimitBuyOrder("BTC/USDT", 0.01, 50000, nil)
if err != nil {
panic(err)
}
fmt.Println(order.Id)
// Sell limit order
order, err := exchange.CreateLimitSellOrder("BTC/USDT", 0.01, 60000, nil)
// Generic limit order
order, err := exchange.CreateOrder("BTC/USDT", "limit", "buy", 0.01, 50000, nil)
Market Order
// Buy market order
order, err := exchange.CreateMarketBuyOrder("BTC/USDT", 0.01, nil)
// Sell market order
order, err := exchange.CreateMarketSellOrder("BTC/USDT", 0.01, nil)
// Generic market order
order, err := exchange.CreateOrder("BTC/USDT", "market", "sell", 0.01, nil, nil)
Fetching Balance
balance, err := exchange.FetchBalance()
if err != nil {
panic(err)
}
fmt.Println(balance["BTC"].Free) // Available balance
fmt.Println(balance["BTC"].Used) // Balance in orders
fmt.Println(balance["BTC"].Total) // Total balance
Fetching Orders
// Open orders
openOrders, err := exchange.FetchOpenOrders("BTC/USDT", nil, nil, nil)
// Closed orders
closedOrders, err := exchange.FetchClosedOrders("BTC/USDT", nil, nil, nil)
// All orders (open + closed)
allOrders, err := exchange.FetchOrders("BTC/USDT", nil, nil, nil)
// Single order by ID
order, err := exchange.FetchOrder(orderId, "BTC/USDT", nil)
Fetching Trades
// Recent public trades
limit := 10
trades, err := exchange.FetchTrades("BTC/USDT", nil, &limit, nil)
// Your trades (requires authentication)
myTrades, err := exchange.FetchMyTrades("BTC/USDT", nil, nil, nil)
Canceling Orders
// Cancel single order
err := exchange.CancelOrder(orderId, "BTC/USDT", nil)
// Cancel all orders for a symbol
err := exchange.CancelAllOrders("BTC/USDT", nil)
WebSocket Operations (Real-time)
Watching Ticker (Live Price Updates)
import "github.com/ccxt/ccxt/go/v4/pro/binance"
exchange := binance.New()
defer exchange.Close()
for {
ticker, err := exchange.WatchTicker("BTC/USDT")
if err != nil {
panic(err)
}
fmt.Println(ticker.Last, ticker.Timestamp)
}
Watching Order Book (Live Depth Updates)
exchange := binance.New()
defer exchange.Close()
for {
orderbook, err := exchange.WatchOrderBook("BTC/USDT", nil)
if err != nil {
panic(err)
}
fmt.Println("Best bid:", orderbook.Bids[0])
fmt.Println("Best ask:", orderbook.Asks[0])
}
Watching Trades (Live Trade Stream)
exchange := binance.New()
defer exchange.Close()
for {
trades, err := exchange.WatchTrades("BTC/USDT", nil, nil, nil)
if err != nil {
panic(err)
}
for _, trade := range trades {
fmt.Println(trade.Price, trade.Amount, trade.Side)
}
}
Watching Your Orders (Live Order Updates)
exchange := binance.New()
exchange.ApiKey = "YOUR_API_KEY"
exchange.Secret = "YOUR_SECRET"
defer exchange.Close()
for {
orders, err := exchange.WatchOrders("BTC/USDT", nil, nil, nil)
if err != nil {
panic(err)
}
for _, order := range orders {
fmt.Println(order.Id, order.Status, order.Filled)
}
}
Watching Balance (Live Balance Updates)
exchange := binance.New()
exchange.ApiKey = "YOUR_API_KEY"
exchange.Secret = "YOUR_SECRET"
defer exchange.Close()
for {
balance, err := exchange.WatchBalance()
if err != nil {
panic(err)
}
fmt.Println("BTC:", balance["BTC"])
fmt.Println("USDT:", balance["USDT"])
}
Complete Method Reference
Market Data Methods
Tickers & Prices
fetchTicker(symbol)- Fetch ticker for one symbolfetchTickers([symbols])- Fetch multiple tickers at oncefetchBidsAsks([symbols])- Fetch best bid/ask for multiple symbolsfetchLastPrices([symbols])- Fetch last pricesfetchMarkPrices([symbols])- Fetch mark prices (derivatives)
Order Books
fetchOrderBook(symbol, limit)- Fetch order bookfetchOrderBooks([symbols])- Fetch multiple order booksfetchL2OrderBook(symbol)- Fetch level 2 order bookfetchL3OrderBook(symbol)- Fetch level 3 order book (if supported)
Trades
fetchTrades(symbol, since, limit)- Fetch public tradesfetchMyTrades(symbol, since, limit)- Fetch your trades (auth required)fetchOrderTrades(orderId, symbol)- Fetch trades for specific order
OHLCV (Candlesticks)
fetchOHLCV(symbol, timeframe, since, limit)- Fetch candlestick datafetchIndexOHLCV(symbol, timeframe)- Fetch index price OHLCVfetchMarkOHLCV(symbol, timeframe)- Fetch mark price OHLCVfetchPremiumIndexOHLCV(symbol, timeframe)- Fetch premium index OHLCV
Account & Balance
fetchBalance()- Fetch account balance (auth required)fetchAccounts()- Fetch sub-accountsfetchLedger(code, since, limit)- Fetch ledger historyfetchLedgerEntry(id, code)- Fetch specific ledger entryfetchTransactions(code, since, limit)- Fetch transactionsfetchDeposits(code, since, limit)- Fetch deposit historyfetchWithdrawals(code, since, limit)- Fetch withdrawal historyfetchDepositsWithdrawals(code, since, limit)- Fetch both deposits and withdrawals
Trading Methods
Creating Orders
createOrder(symbol, type, side, amount, price, params)- Create order (generic)createLimitOrder(symbol, side, amount, price)- Create limit ordercreateMarketOrder(symbol, side, amount)- Create market ordercreateLimitBuyOrder(symbol, amount, price)- Buy limit ordercreateLimitSellOrder(symbol, amount, price)- Sell limit ordercreateMarketBuyOrder(symbol, amount)- Buy market ordercreateMarketSellOrder(symbol, amount)- Sell market ordercreateMarketBuyOrderWithCost(symbol, cost)- Buy with specific costcreateStopLimitOrder(symbol, side, amount, price, stopPrice)- Stop-limit ordercreateStopMarketOrder(symbol, side, amount, stopPrice)- Stop-market ordercreateStopLossOrder(symbol, side, amount, stopPrice)- Stop-loss ordercreateTakeProfitOrder(symbol, side, amount, takeProfitPrice)- Take-profit ordercreateTrailingAmountOrder(symbol, side, amount, trailingAmount)- Trailing stopcreateTrailingPercentOrder(symbol, side, amount, trailingPercent)- Trailing stop %createTriggerOrder(symbol, side, amount, triggerPrice)- Trigger ordercreatePostOnlyOrder(symbol, side, amount, price)- Post-only ordercreateReduceOnlyOrder(symbol, side, amount, price)- Reduce-only ordercreateOrders([orders])
Content truncated.
When not to use it
- →When working with non-crypto financial markets
- →When low-latency requirements exceed WebSocket capabilities
Prerequisites
Limitations
- →Rate limits vary by exchange
- →Requires careful handling of WebSocket connections
- →Symbol formats must follow CCXT conventions
How it compares
It provides a unified, standardized API for multiple exchanges, eliminating the need to write custom integration code for each platform.
Compared to similar skills
ccxt-go side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| ccxt-go (this skill) | 1 | 6mo | Review | Intermediate |
| templ-htmx | 3 | 7mo | No flags | Intermediate |
| generating-grpc-services | 1 | 27d | Review | Advanced |
| higress-wasm-go-plugin | 1 | 6mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by ccxt
View all by ccxt →You might also like
templ-htmx
Xe
Build interactive hypermedia-driven applications with templ and HTMX. Use when creating dynamic UIs, real-time updates, AJAX interactions, mentions 'HTMX', 'dynamic content', or 'interactive templ app'.
generating-grpc-services
jeremylongshore
Generate gRPC service definitions, stubs, and implementations from Protocol Buffers. Use when creating high-performance gRPC services. Trigger with phrases like "generate gRPC service", "create gRPC API", or "build gRPC server".
higress-wasm-go-plugin
alibaba
Develop Higress WASM plugins using Go 1.24+. Use when creating, modifying, or debugging Higress gateway plugins for HTTP request/response processing, external service calls, Redis integration, or custom gateway logic.
api-server
HoangNguyen0403
Standards for building HTTP services, REST APIs, and middleware in Golang.
API service
TheBearIsOne
Use this skill when: - adding HTTP endpoints; - defining request and response models; - wiring document generation into an API surface; - shaping controller, route, or handler behavior.
senior-backend
Cor-Incorporated
Guides backend system development with Node.js, Express, Go, Python, PostgreSQL, GraphQL, and REST APIs. Use when the user says: 'design an API', 'optimize database queries', 'implement authentication', 'set up backend', 'create API endpoint', 'database migration', 'fix N+1 query', 'add rate limitin