Skip to content
Skillpedia
APIs & servers (backend)45k · #6381

ccxt-go

What it does

This skill is a guide for building crypto exchange features in Go projects with the CCXT library. It is for developers building trading tools or microservices in Go.

When to use it

  • ✓When you are writing a Go service that reads crypto market data.
  • ✓When you need to place or check orders from a Go program.
  • ✓When you want live ticker updates in a Go project.

Skill link

https://github.com/ccxt/ccxt/blob/master/.claude/skills/ccxt-go/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/ccxt/ccxt/blob/master/.claude/skills/ccxt-go/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Write a Go program that fetches the BTC/USDT ticker from Binance.”

5 new skills a week. 1 minute to read.

How it works

The AI uses the CCXT Go module, creates an exchange client, and calls the matching REST or WebSocket function for the task.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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 := 
FAQ

How do I install the Go package?

The skill shows using go get with the CCXT v4 module path.

Is there a live update option?

Yes. A separate WebSocket package provides Watch functions for live tickers.

How are errors handled?

The skill's examples check the error returned by each call so the program can respond to it.

Details

Original description by the author

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.

repo: ccxt/ccxt

Popularity

GitHub stars
45k
Ranking position
#6381
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills