Crate maxt
Expand description
A common Rust API for Upbit, Bithumb, Binance, and Hyperliquid.
Client exposes operations with common semantics. Exchange-specific
operations remain on the concrete types in adapters, and unavailable
operations return Error::Unsupported.
§Getting started
Pick an adapter, wrap it in a Client, and call the common API.
use maxt::{Client, Exchange, Market, adapters::UpbitAdapter};
let client = Client::new(UpbitAdapter::new());
let book = client
.order_book(&Market::spot(Exchange::Upbit, "BTC", "KRW"), Some(5))
.await?;
if let Some(spread) = book.spread() {
println!("spread: {spread}");
}Public market data needs no credentials. Account and order operations do; each adapter documents the credential form it accepts.
§Main types
Client: common market-data, account, order, and derivatives operations.adapters: exchange constructors and exchange-specific operations.Feature: capabilities reported byClient::supports.Error: validation, capability, authentication, exchange, transport, and decoding failures.
Re-exports§
pub use adapters::BinanceAggregateTrade;pub use adapters::BinanceAggregateTradesRequest;pub use adapters::BinanceMarkPrice;pub use adapters::BinanceOpenInterest;pub use adapters::BithumbApiKey;pub use adapters::BithumbAssetFee;pub use adapters::BithumbBatchOrder;pub use adapters::BithumbBatchOrderFailure;pub use adapters::BithumbBatchOrderOutcome;pub use adapters::BithumbBatchOrdersRequest;pub use adapters::BithumbBatchOrdersResult;pub use adapters::BithumbKrwDeposit;pub use adapters::BithumbKrwDepositsRequest;pub use adapters::BithumbKrwTransferRequest;pub use adapters::BithumbKrwWithdrawal;pub use adapters::BithumbKrwWithdrawalsRequest;pub use adapters::BithumbNetworkFee;pub use adapters::BithumbNotice;pub use adapters::BithumbOrderDirection;pub use adapters::BithumbPendingOrderState;pub use adapters::BithumbPendingOrdersRequest;pub use adapters::BithumbTwapOrder;pub use adapters::BithumbTwapOrderDirection;pub use adapters::BithumbTwapOrderRequest;pub use adapters::BithumbTwapOrdersRequest;pub use adapters::BithumbTwapState;pub use adapters::HyperliquidMidPrice;pub use adapters::UpbitBatchCancelRequest;pub use adapters::UpbitBatchCancelScope;pub use adapters::UpbitCancelAndNewOrder;pub use adapters::UpbitCancelAndNewOrderRequest;pub use adapters::UpbitCancelAndNewOrderResult;pub use adapters::UpbitDepositInfo;pub use adapters::UpbitOrderBookInstrument;pub use adapters::UpbitOrderDirection;pub use adapters::UpbitOrderReference;pub use adapters::UpbitOrderVolume;pub use adapters::UpbitSmpType;pub use adapters::UpbitTravelRuleVasp;pub use adapters::UpbitTravelRuleVerification;pub use adapters::UpbitYearCandle;
Modules§
- adapters
- Exchange adapter implementations.
Structs§
- Account
Stream - A live private account subscription.
- Asset
Network - One asset’s transfer rules on one exchange network.
- Balance
- How much of one asset an account reports as available and locked.
- Cancel
Orders Request - Orders to cancel by one identifier namespace.
- Cancel
Orders Result - Per-order outcome of one non-atomic batch cancellation request.
- Cancelled
Order - One order an exchange accepted for cancellation in a batch request.
- Candle
- One open-high-low-close-volume (OHLCV) candle.
- Candle
Request - Which candles to read.
- Chain
Destination - A direct on-chain destination that was not issued by an exchange API.
- Chain
Transfer Request - Inputs for a checked transfer to an explicit on-chain destination.
- Client
- The common API over one exchange adapter.
- Cursor
- An opaque position in a paginated history.
- Decimal
- The exact decimal type used for every price, quantity, and amount.
- Deposit
- A deposit reported by the destination exchange.
- Deposit
Address - A deposit address issued by a centralized exchange.
- Deposit
Address Entry - One exchange-issued deposit address returned by an account-wide listing.
- Deposit
Address Request - Selects one deposit address for an asset and network.
- Exchange
Destination - An exchange-issued destination ready to receive a withdrawal.
- Exchange
Transfer Request - Inputs for a checked transfer between two exchange clients.
- Funding
Payment - One funding payment actually charged to or credited to an account.
- Funding
Rate - One funding rate observation for a perpetual market.
- History
Request - A window of history to read, one page at a time.
- Level
- One price level in an order book.
- Margin
Request - A change to how margin backs one market.
- Margin
Summary - Account-wide margin state.
- Market
- Identifies one tradable market on one exchange.
- Market
Info - One entry from
Client::markets. - Market
Stream - A live market data subscription.
- Order
- An order as the exchange currently reports it.
- Order
Account - Account values returned with dynamic order rules.
- Order
Book - An order book snapshot.
- Order
Cancel Failure - One order an exchange did not cancel in a batch request.
- Order
History Request - One newest-first page of completed or cancelled orders.
- Order
Lookup Request - Looks up up to 100 orders by one identifier namespace.
- Order
Option - One order type and time-in-force combination accepted by a market.
- Order
Request - An order to place.
- Order
Rules - Dynamic fees, limits, supported orders, and balances for one market.
- Page
- One page of a paginated history.
- Position
- An open derivatives position.
- Prepared
Transfer - A checked transfer plan tied to its source client.
- Stream
Config - How a live connection should behave when it degrades.
- Subscription
- What to subscribe to, across markets and feeds.
- Ticker
- A provider ticker summary for one market.
- Timestamp
- A point in time, as nanoseconds since the Unix epoch, UTC.
- Trade
- A single executed trade.
- Transfer
History Request - One page of deposit or withdrawal history.
- Transfer
Lookup Request - Identifies one deposit or withdrawal by the exchange UUID or transaction ID.
- Transfer
Plan - Data checked before a cross-exchange withdrawal is submitted.
- Wallet
- One asset on one exchange, optionally pinned to a network.
- Withdraw
Request - A withdrawal to an exchange-issued or direct on-chain destination.
- Withdrawal
- A withdrawal reported by the source exchange.
- Withdrawal
Quote - Live source-exchange checks performed before a withdrawal.
Enums§
- Account
Event - Something that arrived on a private account subscription.
- Deposit
Status - Current state of a deposit.
- Error
- Local request, adapter, authentication, exchange, transport, and decoding failures.
- Exchange
- An exchange
maxtcan talk to. - Exchange
Error Kind - How an exchange-side error classifies for retry purposes.
- Feature
- A capability an exchange may or may not offer.
- Feed
- A kind of live market data to subscribe to.
- Interval
- A candle interval.
- Margin
Mode - How margin backs a position.
- Market
Event - Something that arrived on a market data subscription.
- Market
Kind - What kind of instrument a market is.
- Market
Status - Common listing and trading status.
- Network
- A canonical blockchain network used to compare provider-specific names.
- Order
IdKind - Which identifier namespace to use for a multi-order lookup.
- Order
Status - Where an order stands.
- Order
Type - How an order is priced and matched.
- Overflow
- What a live connection does when its consumer falls behind.
- Side
- Which side of the book a trade or an order sits on.
- Size
- An order size expressed in either the base or quote asset.
- Time
InForce - How long an order stays live.
- Transfer
Destination - Where a withdrawal should arrive.
- Transfer
Error Kind - Why a transfer was rejected before a withdrawal was submitted.
- Travel
Rule Requirement - Whether a withdrawal needs a provider-specific Travel Rule step.
- Withdrawal
Fee - How an exchange calculates a withdrawal fee.
- Withdrawal
Status - Current state of a withdrawal request.
Traits§
Functions§
- execute_
transfer_ plan - Executes one checked transfer plan exactly once.
- parse_
decimal_ exact - Parses decimal text without rounding or truncating it.
- prepare_
chain_ transfer - Checks a source adapter and returns a plan for an explicit chain address.
- prepare_
exchange_ transfer - Checks both exchange adapters and returns a detached transfer plan.