Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

ccxt-rust

БесплатноБез исполняемых скриптовНе проверен

CCXT cryptocurrency exchange library for Rust developers. Covers both REST API (standard) and WebSocket API (real-time). Helps install CCXT, connect to…

ccxtот ccxt★ 45 053 звезды на GitHub

Об этом скилле

CCXT for Rust

A comprehensive guide to using CCXT in Rust projects for cryptocurrency exchange integration.

Every exchange is a single struct (ccxt::Binance, ccxt::Kraken, …) exposing the unified CCXT API with native Rust return types — Ticker, Order, OrderBook, Market — instead of a dynamic value. All methods are async and return Result<T, ExchangeError>.

Installation

REST API

cargo add ccxt tokio --features tokio/full

WebSocket API (ccxt.pro)

cargo add ccxt-pro

Prediction markets

cargo add ccxt-prediction

Cargo.toml

[dependencies]
ccxt = "4.5.95"                 # REST exchanges (typed) — required
ccxt-pro = "4.5.95"             # WebSocket (watch*) exchanges — only if you stream
ccxt-prediction = "4.5.95"      # prediction markets — only if you trade them
tokio = { version = "1", features = ["full"] }

Requirements

  • Rust stable, edition 2021 or later.
  • A tokio runtime — every unified method is async. There is no sync API.
  • ccxt alone is enough for REST. Add ccxt-pro only when you need watch_*; it is a separate crate so a REST-only build does not compile the whole WebSocket surface.

Quick Start

REST API

use ccxt::{Binance, Params, ExchangeBase, ExchangeRuntime};

#[tokio::main]
async fn main() -> Result<(), ccxt::ExchangeError> {
    let mut exchange = Binance::new(None);
    exchange.load_markets(false, ()).await?;

    let ticker = exchange.fetch_ticker("BTC/USDT", Params::none()).await?;
    println!("{} last={:?} bid={:?} ask={:?}", ticker.symbol, ticker.last, ticker.bid, ticker.ask);
    Ok(())
}

WebSocket API — real-time updates

use ccxt::Params;
use ccxt_pro::{Binance, ExchangeBase, ExchangeRuntime};

#[tokio::main]
async fn main() -> Result<(), ccxt::ExchangeError> {
    let mut exchange = Binance::new(None);
    exchange.load_markets(false, ()).await?;

    loop {
        let ticker = exchange.watch_ticker("BTC/USDT", Params::none()).await?;
        println!("{:?}", ticker.last); // live updates
    }
}

Each watch_* call resolves to one decoded update, so consuming a stream is just calling it in a loop.

Crate layout

Crate Contains Use when
ccxt REST exchanges (ccxt::Binance, …), Params, Config, types::*, TypedExchange. Re-exports the whole engine at its root. Always
ccxt-pro WebSocket exchanges (ccxt_pro::Binance, …) with watch_* plus the REST methods Streaming
ccxt-prediction Prediction-market exchanges (ccxt_prediction::Kalshi, …) Prediction markets
ccxt-base The transpiled exchange structs, on top of the ccxt-common runtime (Value, HTTP, crypto, rate limiter, WS infra) Rarely direct — ccxt re-exports it

ccxt re-exports ccxt-base at its root, so ccxt::Value, ccxt::runtime::… resolve there too. ccxt::Binance and ccxt::exchanges::binance::Binance are the same type — there is no separate wrapper around the transpiled exchange.

Coverage today: 105 REST venues, 76 WebSocket venues, 7 prediction venues.

REST vs WebSocket

Feature REST API WebSocket API
Use for One-time queries, placing orders Real-time monitoring, live price feeds
Crate ccxt ccxt-pro
Import use ccxt::Binance; use ccxt_pro::Binance;
Methods fetch_* (fetch_ticker, fetch_order_book) watch_* (watch_ticker, watch_order_book)
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

Both crates expose a type named Binance. When you use both in one file, alias one of them:

use ccxt::Binance as BinanceRest;
use ccxt_pro::Binance as BinanceWs;

Runtime setup

Two settings matter in real programs and are easy to miss:

fn main() {
    // 1. The transpiled exchange code signals errors by panicking across an
    //    internal catch_unwind; each unified method turns that back into `Result`. Silencing
    //    the default hook stops caught panics from printing to stderr.
    //    Set CCXT_SHOW_PANICS=1 to see them while debugging.
    if std::env::var("CCXT_SHOW_PANICS").is_err() {
        std::panic::set_hook(Box::new(|_| {}));
    }

    // 2. The generated exchange code is deeply nested — give worker threads a
    //    large stack. The default 2 MB can overflow on some venues.
    let rt = tokio::runtime::Builder::new_multi_thread()
        .worker_threads(2)
        .thread_stack_size(64 * 1024 * 1024)
        .enable_all()
        .build()
        .unwrap();

    rt.block_on(run());
}

#[tokio::main] is fine for short examples and scripts; use the explicit builder for anything long-running.

Creating an Exchange Instance

Полный SKILL.md на GitHub

Установить ccxt-rust в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл ccxt-rust?

CCXT cryptocurrency exchange library for Rust 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 Rust projects. Use when working with crypto exchanges in Rust applications, trading bots, or low-latency services. Async (tokio), typed unified methods returning Result<T, ExchangeError>.

Как установить скилл ccxt-rust?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл ccxt-rust запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить ccxt-rust с