Skip to main content

Crate maxt

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 by Client::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§

AccountStream
A live private account subscription.
AssetNetwork
One asset’s transfer rules on one exchange network.
Balance
How much of one asset an account reports as available and locked.
CancelOrdersRequest
Orders to cancel by one identifier namespace.
CancelOrdersResult
Per-order outcome of one non-atomic batch cancellation request.
CancelledOrder
One order an exchange accepted for cancellation in a batch request.
Candle
One open-high-low-close-volume (OHLCV) candle.
CandleRequest
Which candles to read.
ChainDestination
A direct on-chain destination that was not issued by an exchange API.
ChainTransferRequest
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.
DepositAddress
A deposit address issued by a centralized exchange.
DepositAddressEntry
One exchange-issued deposit address returned by an account-wide listing.
DepositAddressRequest
Selects one deposit address for an asset and network.
ExchangeDestination
An exchange-issued destination ready to receive a withdrawal.
ExchangeTransferRequest
Inputs for a checked transfer between two exchange clients.
FundingPayment
One funding payment actually charged to or credited to an account.
FundingRate
One funding rate observation for a perpetual market.
HistoryRequest
A window of history to read, one page at a time.
Level
One price level in an order book.
MarginRequest
A change to how margin backs one market.
MarginSummary
Account-wide margin state.
Market
Identifies one tradable market on one exchange.
MarketInfo
One entry from Client::markets.
MarketStream
A live market data subscription.
Order
An order as the exchange currently reports it.
OrderAccount
Account values returned with dynamic order rules.
OrderBook
An order book snapshot.
OrderCancelFailure
One order an exchange did not cancel in a batch request.
OrderHistoryRequest
One newest-first page of completed or cancelled orders.
OrderLookupRequest
Looks up up to 100 orders by one identifier namespace.
OrderOption
One order type and time-in-force combination accepted by a market.
OrderRequest
An order to place.
OrderRules
Dynamic fees, limits, supported orders, and balances for one market.
Page
One page of a paginated history.
Position
An open derivatives position.
PreparedTransfer
A checked transfer plan tied to its source client.
StreamConfig
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.
TransferHistoryRequest
One page of deposit or withdrawal history.
TransferLookupRequest
Identifies one deposit or withdrawal by the exchange UUID or transaction ID.
TransferPlan
Data checked before a cross-exchange withdrawal is submitted.
Wallet
One asset on one exchange, optionally pinned to a network.
WithdrawRequest
A withdrawal to an exchange-issued or direct on-chain destination.
Withdrawal
A withdrawal reported by the source exchange.
WithdrawalQuote
Live source-exchange checks performed before a withdrawal.

Enums§

AccountEvent
Something that arrived on a private account subscription.
DepositStatus
Current state of a deposit.
Error
Local request, adapter, authentication, exchange, transport, and decoding failures.
Exchange
An exchange maxt can talk to.
ExchangeErrorKind
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.
MarginMode
How margin backs a position.
MarketEvent
Something that arrived on a market data subscription.
MarketKind
What kind of instrument a market is.
MarketStatus
Common listing and trading status.
Network
A canonical blockchain network used to compare provider-specific names.
OrderIdKind
Which identifier namespace to use for a multi-order lookup.
OrderStatus
Where an order stands.
OrderType
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.
TimeInForce
How long an order stays live.
TransferDestination
Where a withdrawal should arrive.
TransferErrorKind
Why a transfer was rejected before a withdrawal was submitted.
TravelRuleRequirement
Whether a withdrawal needs a provider-specific Travel Rule step.
WithdrawalFee
How an exchange calculates a withdrawal fee.
WithdrawalStatus
Current state of a withdrawal request.

Traits§

Adapter
Exchange adapter contract used by Client.

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.

Type Aliases§

BoxFuture
A boxed future used to keep Adapter dyn-compatible.
Result
Result type returned by every fallible maxt operation.