Crate ccxt_core

Crate ccxt_core 

Source
Expand description

CCXT Core Library

This is the core library for CCXT Rust implementation, providing fundamental data structures, error types, and traits for cryptocurrency exchange integration.

§Features

  • Type Safety: Leverages Rust’s type system for compile-time guarantees
  • Precision: Uses rust_decimal::Decimal for accurate financial calculations
  • Async/Await: Built on tokio for high-performance async operations
  • Error Handling: Comprehensive error types with thiserror

§Example

use ccxt_core::prelude::*;

// Create a market
let market = Market::new_spot(
    "btc/usdt".to_string(),
    "BTC/USDT".to_string(),
    "BTC".to_string(),
    "USDT".to_string(),
);

// Create an order
let order = Order::new(
    "12345".to_string(),
    "BTC/USDT".to_string(),
    OrderType::Limit,
    OrderSide::Buy,
    rust_decimal_macros::dec!(0.1),
    Some(rust_decimal_macros::dec!(50000.0)),
    OrderStatus::Open,
);

Re-exports§

pub use base_exchange::BaseExchange;
pub use base_exchange::ExchangeConfig;
pub use base_exchange::ExchangeConfigBuilder;
pub use base_exchange::MarketCache;
pub use credentials::SecretBytes;
pub use credentials::SecretString;
pub use exchange::ArcExchange;
pub use exchange::BoxedExchange;
pub use exchange::Exchange;
pub use exchange::ExchangeExt;
pub use capability::Capabilities;
pub use capability::Capability;
pub use capability::ExchangeCapabilities;
pub use capability::ExchangeCapabilitiesBuilder;
pub use capability::TraitCategory;
pub use error::ContextExt;
pub use error::Error;
pub use error::ExchangeErrorDetails;
pub use error::NetworkError;
pub use error::OrderError;
pub use error::ParseError;
pub use error::Result;
pub use ws_exchange::FullExchange;
pub use ws_exchange::MessageStream;
pub use ws_exchange::WsExchange;
pub use error::ErrorContext;Deprecated
pub use types::Amount;
pub use types::Balance;
pub use types::BalanceEntry;
pub use types::Cost;
pub use types::Currency;
pub use types::CurrencyNetwork;
pub use types::DefaultSubType;
pub use types::DefaultType;
pub use types::DefaultTypeError;
pub use types::EndpointType;
pub use types::Fee;
pub use types::Market;
pub use types::MarketLimits;
pub use types::MarketPrecision;
pub use types::MarketType;
pub use types::MinMax;
pub use types::Ohlcv;
pub use types::Order;
pub use types::OrderBook;
pub use types::OrderBookEntry;
pub use types::OrderBookSide;
pub use types::OrderSide;
pub use types::OrderStatus;
pub use types::OrderType;
pub use types::PrecisionMode;
pub use types::Price;
pub use types::TakerOrMaker;
pub use types::Ticker;
pub use types::TickerParams;
pub use types::TickerParamsBuilder;
pub use types::Timeframe;
pub use types::Trade;
pub use types::TradingLimits;
pub use types::resolve_market_type;
pub use symbol::SymbolError;
pub use symbol::SymbolFormatter;
pub use symbol::SymbolParser;
pub use types::symbol::ContractType;
pub use types::symbol::ExpiryDate;
pub use types::symbol::ParsedSymbol;
pub use types::symbol::SymbolMarketType;
pub use ws_client::BackoffConfig;
pub use ws_client::BackoffStrategy;
pub use ws_client::DEFAULT_MAX_SUBSCRIPTIONS;
pub use ws_client::DEFAULT_SHUTDOWN_TIMEOUT;
pub use ws_client::Subscription;
pub use ws_client::SubscriptionManager;
pub use ws_client::WsClient;
pub use ws_client::WsConfig;
pub use ws_client::WsConnectionState;
pub use ws_client::WsError;
pub use ws_client::WsErrorKind;
pub use ws_client::WsEvent;
pub use ws_client::WsMessage;
pub use ws_client::WsStats;
pub use ws_client::WsStatsSnapshot;
pub use rust_decimal;
pub use serde;
pub use serde_json;

Modules§

auth
API authentication and cryptographic signing utilities.
base_exchange
Base exchange implementation
capability
Exchange Capabilities Module
config
Configuration types for exchanges.
credentials
Secure credential types with automatic memory zeroization.
error
Error Handling for CCXT Rust
exchange
Unified Exchange Trait
http_client
HTTP client abstraction layer
logging
Structured logging system.
precision
Financial-grade precision calculation utilities.
prelude
Prelude module for convenient imports
rate_limiter
Rate Limiter Module
retry_strategy
Retry strategy module.
symbol
Unified Symbol Format Module
test_config
Test configuration management utilities.
time
Time utilities for CCXT
traits
Exchange trait hierarchy for modular capability composition Exchange trait hierarchy for modular capability composition.
types
Core type definitions for CCXT
ws_client
WebSocket client module.
ws_exchange
WebSocket Exchange Trait

Macros§

capabilities
Macro for building Capabilities with a concise syntax
require_credentials
Requires exchange credentials to run a test.
skip_if
Conditionally skips a test based on a condition.

Structs§

CancellationToken
A token which can be used to signal a cancellation request to one or more tasks.

Constants§

NAME
Library name
VERSION
Library version