ccxt-rust
यह क्या करती है
यह स्किल CCXT crates से Rust प्रोजेक्ट में क्रिप्टो एक्सचेंज फ़ीचर बनाने की गाइड है। यह उन डेवलपर्स के लिए है जो Rust में ट्रेडिंग बॉट या कम-विलंब सर्विस बना रहे हैं।
कब इस्तेमाल करें
- ✓जब आप Rust सर्विस बना रहे हों जो क्रिप्टो मार्केट डेटा पढ़ती है।
- ✓जब आपको Rust ट्रेडिंग बॉट से ऑर्डर देने या जाँचने हों।
- ✓जब आप Rust प्रोजेक्ट में लाइव WebSocket अपडेट चाहें।
Skill का लिंक
https://github.com/ccxt/ccxt/blob/master/.claude/skills/ccxt-rust/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“एक Rust प्रोग्राम लिखिए जो Binance का BTC/USDT टिकर प्रिंट करे।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
AI tokio के साथ ccxt crate जोड़ता है, एक टाइप्ड एक्सचेंज ऑब्जेक्ट बनाता है, और हर मेथड को await करता है, जो टाइप्ड नतीजा या एरर लौटाता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
CCXT for Rust
A comprehensive guide to using CCXT in Rust projects for cryptocurrency exchange integration.
Every exchange has a typed wrapper (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.75" # REST exchanges (typed) — required
ccxt-pro = "4.5.75" # WebSocket (watch*) exchanges — only if you stream
ccxt-prediction = "4.5.75" # 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. ccxtalone is enough for REST. Addccxt-proonly when you needwatch_*; 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};
#[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;
#[tokio::main]
async fn main() -> Result<(), ccxt::ExchangeError> {
let mut exchange = Binance::new(None);
exchange.try_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 |
Typed REST wrappers (ccxt::Binance, …), Params, Config, types::*, TypedExchange. Re-exports the whole engine at its root. |
Always |
ccxt-pro |
Typed WebSocket wrappers (ccxt_pro::Binance, …) with watch_* |
Streaming |
ccxt-prediction |
Typed prediction-market wrappers (ccxt_prediction::Kalshi, …) |
Prediction markets |
ccxt-base |
The untyped engine (Value, HTTP, crypto, rate limiter, Cores, WS infra) |
Rarely direct — ccxt re-exports it |
ccxt re-exports ccxt-base at its root, so ccxt::Value, ccxt::runtime::…,
ccxt::exchanges::binance::BinanceCore resolve alongside the typed ccxt::Binance.
Coverage today: 105 typed REST venues, 76 typed 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 core signals errors by panicking across an internal
// catch_unwind; the typed layer 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_th
अक्सर पूछे जाने वाले सवाल
क्या इसका सिंक्रोनस API है?
नहीं। स्किल कहती है कि हर एकीकृत मेथड async है और कोई sync API नहीं है।
क्या WebSocket crate चाहिए?
केवल तब, जब आप लाइव डेटा स्ट्रीम करें। स्किल कहती है कि ccxt-pro crate अलग है और watch फ़ंक्शन के लिए चाहिए।
कौन-सा रनटाइम चाहिए?
स्किल को tokio रनटाइम और स्थिर Rust वर्ज़न चाहिए, edition 2021 या उसके बाद का।
जानकारी
लेखक का मूल विवरण
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 wrappers returning Result<T, ExchangeError>.
repo: ccxt/ccxt
लोकप्रियता
- GitHub स्टार
- 45k
- रैंकिंग में स्थान
- #6386
- लाइसेंस
- MIT
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
binance-agentic-wallet
45kआपके एजेंट को baw कमांड लाइन से Binance Web3 वॉलेट मैनेज करने देती है, जिसमें साइन-इन, बैलेंस, ट्रांसफ़र, टोकन स्वैप और लिमिट ऑर्डर शामिल हैं।
binance-sports-ai-analyzer
45kआपके एजेंट को World Cup मैच की AI भविष्यवाणी, विश्लेषण और समाचार की जानकारी देखने में मदद करती है, और संकेत बदलने पर जीत की संभावना दोबारा गिनती है।
binance-tokenized-securities-info
45kआपके एजेंट को Binance Web3 पर Ondo टोकनाइज़्ड अमेरिकी स्टॉक की जानकारी देखने देती है, जिसमें टोकन सूची, कंपनी की जानकारी, ट्रेडिंग स्थिति और ऑन-चेन कीमतें शामिल हैं।
binance
45kआपके एजेंट को binance-cli टूल के ज़रिए Binance Spot, USD-M Futures और Convert इस्तेमाल करने देती है। पहले ऑथेंटिकेशन सेट करना ज़रूरी है।
मिलती-जुलती skills
api-connector-builder
280kयह आपके एजेंट को मौजूदा pattern के हिसाब से नए API connections बनाने देता है। जब बिना कोई नया तरीका बनाए एक और integration जोड़ना हो, तब इसका इस्तेमाल करें।
api-design
280kयह आपके एजेंट को best practices के हिसाब से REST APIs डिज़ाइन करने में मदद करता है। यह तय करने में काम आता है कि APIs आपस में कैसे बात करें, errors कैसे दिखें, और data को कैसे व्यवस्थित करें।
backend-patterns
280kआपके एजेंट को server-side architecture patterns और database optimization में मदद करता है। server पर चलने वाला code बनाने या review करने के लिए उपयोगी है।