ccxt-go
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.
Install
mkdir -p .claude/skills/ccxt-go && curl -L -o skill.zip "https://mcp.directory/api/skills/download/4151" && unzip -o skill.zip -d .claude/skills/ccxt-go && rm skill.zipInstalls to .claude/skills/ccxt-go
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.
More by ccxt
View all skills by ccxt →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversTrade crypto easily with CCXT Crypto Trading bot. Monitor, analyze, and execute trades across 100+ exchanges with this c
Experience high-performance CCXT MCP server for seamless cryptocurrency exchange integration.
Get live crypto exchange data from Hyperliquid: real-time coin stock prices, bitcoin price live, and market analytics fo
Get live crypto exchange data from Binance: real-time coin stock prices, bitcoin price live, charts, order books & tradi
Connect to Binance API for real-time market data, trading, and portfolio monitoring with 17 automated tools for efficien
Get live crypto exchange data & coin stock prices on DexPaprika. Track bitcoin price live, DEX listings, and more across
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.