CC

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.zip

Installs 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.
376 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

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

You give it
Exchange symbol or trading parameters
You get back
Market data or order execution status

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

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

FeatureREST APIWebSocket API
Use forOne-time queries, placing ordersReal-time monitoring, live price feeds
Importccxt "github.com/ccxt/ccxt/go/v4"ccxtpro "github.com/ccxt/ccxt/go/v4/pro"
Constructorccxt.NewBinance(cfg)ccxtpro.NewBinance(cfg)
MethodsFetch* (FetchTicker, FetchOrderBook)Watch* (WatchTicker, WatchOrderBook)
Best forTrading, account managementPrice 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 pass nil placeholders.
  • 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 WatchOrderBook options are still ccxt.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.CreateOrder("BTC/USDT", "market", "sell", 0.001)

// Extra unified/exchange params (stop loss, post-only, client id, ...)
order, err = exchange.CreateOrder("BTC/USDT", "limit", "buy", 0.001,
    ccxt.WithCreateOrderPrice(50000),
    ccxt.WithCreateOrderParams(map[string]any{"postOnly": true, "clientOrderId": "my-id-1"}),
)
if err != nil {
    panic(err)
}
fmt.Println(*order.Id)

Fetching Balance

balance, err := exchange.FetchBalance()
if err != nil {
    panic(err)
}
fmt.Println(*balance.Free["USDT"])             // available
fmt.Println(*balance.Balances["BTC"].Total)    // per-currency struct: Free / Used / Total

Fetching Orders

openOrders, err := exchange.FetchOpenOrders(ccxt.WithFetchOpenOrdersSymbol("BTC/USDT"))
closedOrders, err := exchange.FetchClosedOrders(ccxt.WithFetchClosedOrdersSymbol("BTC/USDT"))
order, err := exchange.FetchOrder(orderId, ccxt.WithFetchOrderSymbol("BTC/USDT"))

Fetching Trades

trades, err := exchange.FetchTrades("BTC/USDT", ccxt.WithFetchTradesLimit(10))
myTrades, err := exchange.FetchMyTrades(ccxt.WithFetchMyTradesSymbol("BTC/USDT")) // auth required

Canceling Orders

canceled, err := exchange.CancelOrder(orderId, ccxt.WithCancelOrderSymbol("BTC/USDT"))
all, err := exchange.CancelAllOrders(ccxt.WithCancelAllOrdersSymbol("BTC/USDT"))

Capabilities, Pagination and Testnet

if exchange.GetHas()["fetchOHLCV"] == true {
    // supported
}
features := exchange.GetFeatures() // per market type: which createOrder params, fetch limits, daysBack, ...
fmt.Println(features["spot"])

// Let ccxt page through history for you (respects rate limits)
history, err := exchange.FetchOHLCV("BTC/USDT",
    ccxt.WithFetchOHLCVTimeframe("1d"),
    ccxt.WithFetchOHLCVSince(1704067200000),
    ccxt.WithFetchOHLCVParams(map[string]any{"paginate": true}),
)

WebSocket Operations (Real-time)

Watch* calls block until the next update; call them in a loop. Construct with ccxtpro.New<Exchange> and always defer exchange.Close().

Watching Ticker

exchange := ccxtpro.NewBinance(nil)
defer exchange.Close()

for {
    ticker, err := exchange.WatchTicker("BTC/USDT")
    if err != nil {
        panic(err)
    }
    fmt.Println(*ticker.Last, *ticker.Timestamp)
}

Watching Order Book

for {
    orderbook, err := exchange.WatchOrderBook("BTC/USDT", ccxt.WithWatchOrderBookLimit(10))
    if err != nil {
        panic(err)
    }
    fmt.Println("best bid:", orderbook.Bids[0], "best ask:", orderbook.Asks[0])
}

Watching Trades

for {
    trades, err := exchange.WatchTrades("BTC/USDT")
    if err != nil {
        panic(err)
    }
    for _, t := range trades {
        fmt.Println(*t.Price, *t.Amount, *t.Side)
    }
}

Watching Your Orders and Balance (auth required)

exchange := ccxtpro.NewBinance(map[string]any{"apiKey": "...", "secret": "..."})
defer exchange.Close()

orders, err := exchange.WatchOrders(ccxt.WithWatchOrdersSymbol("BTC/USDT"))
balance, err := exchange.WatchBalance()

Unsubscribing

if exchange.GetHas()["unWatchTicker"] == true {
    _, err := exchange.UnWatchTicker("BTC/USDT") // stop one stream, keep the connection
}

Complete Method Reference

Names below are the canonical camelCase unified names; use your language's casing (fetch_ohlcv in Python/PHP, FetchOHLCV in C#/Go). Arguments are positional in this order — trailing ones are optional and params (exchange-specific extras) is always last and omitted here. Signatures mirror ts/src/base/Exchange.ts. Support varies per exchange: check exchange.has['<method>'] (and exchange.features for finer options) before calling.

Market Data Methods

Tickers & Prices

  • fetchTicker(symbol) - Fetch ticker for one symbol
  • fetchTickers([symbols]) - Fetch multiple tickers at once
  • fetchBidsAsks([symbols]) - Fetch best bid/ask for multiple symbols
  • fetchLastPrices([symbols]) - Fetch last prices
  • fetchMarkPrice(symbol) - Fetch mark price (derivatives)
  • fetchMarkPrices([symbols]) - Fetch mark prices (derivatives)

Order Books

  • fetchOrderBook(symbol, limit) - Fetch order book
  • fetchOrderBooks([symbols], limit) - Fetch multiple order books
  • fetchL2OrderBook(symbol, limit) - Fetch level 2 order book
  • fetchL3OrderBook(symbol, limit) - Fetch level 3 order book (if supported)

Trades

  • fetchTrades(symbol, since, limit) - Fetch public trades
  • fetchMyTrades(symbol, since, limit) - Fetch your trades (auth required)
  • fetchOrderTrades(id, symbol, since, limit) - Fetch trades for specific order

OHLCV (Candlesticks)

  • fetchOHLCV(symbol, timeframe, since, limit) - Fetch candlestick data
  • fetchIndexOHLCV(symbol, timeframe, since, limit) - Fetch index price OHLCV
  • fetchMarkOHLCV(symbol, timeframe, since, limit) - Fetch mark price OHLCV
  • fetchPremiumIndexOHLCV(symbol, timeframe, since, limit) - Fetch premium index OHLCV

Account & Balance

  • `fetchBalanc

Content truncated.

When not to use it

  • →When working with non-crypto financial markets
  • →When low-latency requirements exceed WebSocket capabilities

Prerequisites

Go development environmentExchange API keys (for private operations)

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.

SkillInstallsUpdatedSafetyDifficulty
ccxt-go (this skill)19moReviewIntermediate
templ-htmx310moNo flagsIntermediate
generating-grpc-services14moReviewAdvanced
higress-wasm-go-plugin19moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

ccxt-csharp

ccxt

CCXT cryptocurrency exchange library for C# and .NET 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 .NET projects. Use when working with crypto exchanges in C# applications, trading systems, or financial software. Supports .NET Standard 2.0+.

13

ccxt-php

ccxt

CCXT cryptocurrency exchange library for PHP 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 PHP 8.1+. Use when working with crypto exchanges in PHP projects, trading bots, or web applications. Supports both sync and async (ReactPHP) usage.

18

ccxt-python

ccxt

CCXT cryptocurrency exchange library for Python 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 Python. Use when working with crypto exchanges in Python projects, trading bots, data analysis, or portfolio management. Supports both sync and async (asyncio) usage.

16

ccxt-typescript

ccxt

CCXT cryptocurrency exchange library for TypeScript and JavaScript developers (Node.js and browser). 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. Use when working with crypto exchanges in TypeScript/JavaScript projects, trading bots, arbitrage systems, or portfolio management tools. Includes both REST and WebSocket examples.

15

Search skills

Search the agent skills registry