MCPcopy Index your code
hub / github.com/binance/binance-connector-rust

github.com/binance/binance-connector-rust @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
11,216 symbols 32,416 edges 2,707 files 1,108 documented · 10%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Binance Rust Connector

Build Status Open Issues Crates.io docs.rs Dependency Status License: MIT

Official collection of auto-generated Rust SDK modules for Binance APIs.

Migration Guide

If you're upgrading from the previous connector, refer to our Migration Guide for detailed steps on transitioning to the new modular structure. The legacy connector will still be available for a limited time. You can find the code for the old connector in the legacy branch.

Prerequisites

Before using the connector, ensure you have:

  • Rust (version 1.86.0 or later)
  • cargo (comes with Rust)

Install or update Rust via rustup:

rustup install 1.86.0
rustup default 1.86.0

Available Modules

All connectors are bundled within the single binance-sdk crate. Enable only the modules you need by specifying feature flags. Available features are:

Documentation

Installation

Add binance-sdk to your Cargo.toml, enabling only the features you need. For example, to include Spot and USDS-M Futures modules:

[dependencies]
binance-sdk = { version = "1.0.0", features = ["derivatives_trading_usds_futures", "spot"] }

If you require all available connectors:

[dependencies]
binance-sdk = { version = "1.0.0", features = ["all"] }

TLS Backend Selection

This library supports both OpenSSL (default) and Rustls backends.

Default (OpenSSL): Standard installation uses OpenSSL. This requires OpenSSL development headers to be installed on your system.

[dependencies]
binance-sdk = { version = "1.0.0", features = ["spot"] }

Using Rustls (Pure Rust): To use rustls (useful for cross-compilation or avoiding C-dependencies), you must disable default features and enable rustls-tls.

Note: Private key signing features currently require the openssl-tls feature.

[dependencies]
binance-sdk = { version = "1.0.0", default-features = false, features = ["rustls-tls", "spot"] }

Contributing

This repository contains auto-generated code using OpenAPI Generator. To contribute or request changes:

  1. Open a GitHub issue to discuss new features, bugs, or enhancements.
  2. Fork the repository, make your changes, and submit a pull request.
  3. Respect the code generation workflow — manual edits to generated files will be overwritten.

Please ensure all new code is covered by existing or new tests. We follow Rust API Guidelines for naming and documentation.

License

This project is licensed under the MIT License. See the LICENCE file for details.

Extension points exported contracts — how you extend this code

WebsocketHandler (Interface)
(no doc) [7 implementers]
src/common/websocket.rs
FiatApi (Interface)
(no doc) [2 implementers]
src/fiat/rest_api/apis/fiat_api.rs
PositionApi (Interface)
(no doc) [2 implementers]
src/w3w_prediction/rest_api/apis/position_api.rs
AccountApi (Interface)
(no doc) [2 implementers]
src/derivatives_trading_portfolio_margin_pro/rest_api/apis/account_api.rs
TravelRuleApi (Interface)
(no doc) [2 implementers]
src/wallet/rest_api/apis/travel_rule_api.rs
AssetManagementApi (Interface)
(no doc) [2 implementers]
src/sub_account/rest_api/apis/asset_management_api.rs
MiningApi (Interface)
(no doc) [2 implementers]
src/mining/rest_api/apis/mining_api.rs
StableRateApi (Interface)
(no doc) [2 implementers]
src/crypto_loan/rest_api/apis/stable_rate_api.rs

Core symbols most depended-on inside this repo

build
called by 3930
src/common/config.rs
data
called by 2383
src/common/models.rs
init
called by 882
src/common/logger.rs
on_message
called by 355
src/common/websocket.rs
replace_websocket_streams_placeholders
called by 258
src/common/utils.rs
connect
called by 158
src/common/websocket.rs
disconnect
called by 147
src/spot/websocket_api/mod.rs
into_iter
called by 102
src/common/websocket.rs

Shape

Method 3,971
Function 3,929
Class 2,720
Enum 501
Interface 95

Languages

Rust100%

Modules by API surface

src/derivatives_trading_portfolio_margin/rest_api/apis/trade_api.rs373 symbols
src/common/websocket.rs286 symbols
src/derivatives_trading_portfolio_margin/rest_api/apis/account_api.rs217 symbols
src/derivatives_trading_usds_futures/rest_api/apis/trade_api.rs194 symbols
src/spot/rest_api/apis/trade_api.rs190 symbols
src/spot/websocket_api/apis/trade_api.rs188 symbols
src/derivatives_trading_usds_futures/rest_api/apis/market_data_api.rs187 symbols
src/common/utils.rs158 symbols
src/derivatives_trading_coin_futures/rest_api/apis/market_data_api.rs150 symbols
src/margin_trading/rest_api/apis/trade_api.rs146 symbols
src/derivatives_trading_coin_futures/rest_api/apis/trade_api.rs133 symbols
src/simple_earn/rest_api/apis/flexible_locked_api.rs127 symbols

For agents

$ claude mcp add binance-connector-rust \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact