ccxt-go
БесплатноБез исполняемых скриптовНе проверенCCXT cryptocurrency exchange library for Go developers. Covers both REST API (standard) and WebSocket API (real-time). Helps install CCXT, connect to…
от ccxt★ 45 053 звезды на GitHubОб этом скилле
CCXT for Go
A comprehensive guide to using CCXT in Go projects for cryptocurrency exchange integration.
Installation
go get github.com/ccxt/ccxt/go/v4 # REST (package ccxt)
go get github.com/ccxt/ccxt/go/v4/pro # WebSocket (package ccxtpro) — same module
Every exchange lives in one package: there is no per-exchange import path. Construct with ccxt.New<Exchange>(config) (e.g. ccxt.NewBinance, ccxt.NewOkx, ccxt.NewKraken) or dynamically with ccxt.CreateExchange("binance", config).
Quick Start
REST API
package main
import (
"fmt"
ccxt "github.com/ccxt/ccxt/go/v4"
)
func main() {
exchange := ccxt.NewBinance(nil)
ticker, err := exchange.FetchTicker("BTC/USDT")
if err != nil {
panic(err)
}
fmt.Println(*ticker.Last)
}
WebSocket API - Real-time Updates
package main
import (
"fmt"
ccxtpro "github.com/ccxt/ccxt/go/v4/pro"
)
func main() {
exchange := ccxtpro.NewBinance(nil)
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 | ccxt "github.com/ccxt/ccxt/go/v4" |
ccxtpro "github.com/ccxt/ccxt/go/v4/pro" |
| Constructor | ccxt.NewBinance(cfg) |
ccxtpro.NewBinance(cfg) |
| Methods | Fetch* (FetchTicker, FetchOrderBook) |
Watch* (WatchTicker, WatchOrderBook) |
| Best for | Trading, account management | Price monitoring, arbitrage detection |
How Go calls work (read this first)
- Required arguments are positional; every optional argument is a functional option named
ccxt.With<Method><Arg>(...):exchange.FetchOHLCV("BTC/USDT", ccxt.WithFetchOHLCVTimeframe("1h"), ccxt.WithFetchOHLCVLimit(100)). Do not passnilplaceholders. - Methods whose first unified argument is optional (e.g.
FetchOpenOrders,FetchMyTrades,WatchOrders,CancelAllOrders) take only options:exchange.FetchOpenOrders(ccxt.WithFetchOpenOrdersSymbol("BTC/USDT")). - Exchange-specific extras go in
ccxt.With<Method>Params(map[string]any{...}). - Every method returns
(value, error). Values are structs (ccxt.Ticker,ccxt.Order,[]ccxt.Trade), and most numeric/string fields are pointers (*float64,*string) because exchanges may omit them — nil-check before dereferencing. - The pro package re-uses the REST types, so
WatchOrderBookoptions are stillccxt.WithWatchOrderBookLimit(...).
Creating Exchange Instance
import (
"os"
ccxt "github.com/ccxt/ccxt/go/v4"
ccxtpro "github.com/ccxt/ccxt/go/v4/pro"
)
// Public API (no authentication)
public := ccxt.NewBinance(nil)
// Private API — pass credentials in the config map
exchange := ccxt.NewBinance(map[string]any{
"apiKey": os.Getenv("BINANCE_APIKEY"),
"secret": os.Getenv("BINANCE_SECRET"),
"enableRateLimit": true, // default: true
"options": map[string]any{"defaultType": "swap"}, // optional
})
// Testnet / sandbox — call right after construction
exchange.SetSandboxMode(true)
// WebSocket (same config shape)
ws := ccxtpro.NewBinance(map[string]any{"apiKey": "...", "secret": "..."})
defer ws.Close()
Common REST Operations
Loading Markets
if _, err := exchange.LoadMarkets(); err != nil {
panic(err)
}
market := exchange.GetMarket("BTC/USDT") // typed ccxt.MarketInterface
if market.Limits.Amount.Min != nil {
fmt.Println("min amount:", *market.Limits.Amount.Min)
}
fmt.Println(exchange.AmountToPrecision("BTC/USDT", 0.0012345)) // round to the market's step
Fetching Ticker
ticker, err := exchange.FetchTicker("BTC/USDT")
if err != nil {
panic(err)
}
fmt.Println(*ticker.Last, *ticker.Bid, *ticker.Ask)
tickers, err := exchange.FetchTickers(ccxt.WithFetchTickersSymbols([]string{"BTC/USDT", "ETH/USDT"}))
fmt.Println(tickers.Tickers["ETH/USDT"])
Fetching Order Book
orderbook, err := exchange.FetchOrderBook("BTC/USDT", ccxt.WithFetchOrderBookLimit(5))
if err != nil {
panic(err)
}
fmt.Println(orderbook.Bids[0]) // [price, amount]
fmt.Println(orderbook.Asks[0])
Fetching OHLCV
candles, err := exchange.FetchOHLCV("BTC/USDT",
ccxt.WithFetchOHLCVTimeframe("1h"),
ccxt.WithFetchOHLCVLimit(100),
)
fmt.Println(candles[0].Timestamp, candles[0].Close)
Creating Orders
// Limit
order, err := exchange.CreateLimitBuyOrder("BTC/USDT", 0.001, 50000)
order, err = exchange.CreateLimitSellOrder("BTC/USDT", 0.001, 70000)
order, err = exchange.CreateOrder("BTC/USDT", "limit", "buy", 0.001, ccxt.WithCreateOrderPrice(50000))
// Market
order, err = exchange.CreateMarketBuyOrder("BTC/USDT", 0.001)
order, err = exchange.Creat
Установить ccxt-go в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл 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.
Как установить скилл ccxt-go?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ccxt-go запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic