pub struct Client { /* private fields */ }Expand description
The async client for interacting with the Datamaxi+ API.
This is the default surface. For a synchronous client, enable the
sync feature and use [sync::Client].
Cloning a Client is cheap: the shared state lives behind an Arc, so a
clone is a single refcount bump.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(api_key: impl Into<String>) -> Self
pub fn new(api_key: impl Into<String>) -> Self
Creates a new client authenticating with the given API key.
Uses the production base URL and the default timeout
([DEFAULT_TIMEOUT]). For control over the base URL, timeout, or
reading the API key from the environment, use ClientBuilder. Endpoint
groups are reached via accessors, e.g. Client::cex_candle.
Sourcepub async fn get<T: DeserializeOwned>(
&self,
endpoint: &str,
parameters: Option<BTreeMap<String, String>>,
) -> Result<T>
pub async fn get<T: DeserializeOwned>( &self, endpoint: &str, parameters: Option<BTreeMap<String, String>>, ) -> Result<T>
Sends a GET request to the specified endpoint with optional parameters.
Transient failures (timeouts, connection errors, 429, and 5xx) are
retried per the client’s [RetryConfig] with exponential backoff; a
429 honors its Retry-After header. Fatal statuses
(400/401/403/404) are returned without retry.
With the tracing feature enabled, each call is wrapped in a span
carrying method, endpoint, attempt, and the resolved status;
retries additionally emit a debug event with the backoff delay. The
API key is never recorded.
Sourcepub fn paginate<T>(
&self,
endpoint: impl Into<String>,
params: BTreeMap<String, String>,
) -> Paginator<T>where
T: Paginated + DeserializeOwned,
pub fn paginate<T>(
&self,
endpoint: impl Into<String>,
params: BTreeMap<String, String>,
) -> Paginator<T>where
T: Paginated + DeserializeOwned,
Returns an auto-paginator over a paged endpoint (see Paginated).
params seeds the query string for every page (e.g. limit, sort,
filters); a page key in params sets the starting page (defaults to
1) and is overwritten on each subsequent request as the paginator
advances. Call Paginator::next_page in a loop to walk forward.
Source§impl Client
impl Client
Sourcepub fn announcements(&self) -> Announcements
pub fn announcements(&self) -> Announcements
Returns a handle to the Announcements endpoint group.
Sourcepub fn cex_candle(&self) -> CexCandle
pub fn cex_candle(&self) -> CexCandle
Returns a handle to the CexCandle endpoint group.
Sourcepub fn cex_symbol(&self) -> CexSymbol
pub fn cex_symbol(&self) -> CexSymbol
Returns a handle to the CexSymbol endpoint group.
Sourcepub fn funding_rate(&self) -> FundingRate
pub fn funding_rate(&self) -> FundingRate
Returns a handle to the FundingRate endpoint group.
Sourcepub fn index_price(&self) -> IndexPrice
pub fn index_price(&self) -> IndexPrice
Returns a handle to the IndexPrice endpoint group.
Sourcepub fn liquidation(&self) -> Liquidation
pub fn liquidation(&self) -> Liquidation
Returns a handle to the Liquidation endpoint group.
Sourcepub fn margin_borrow(&self) -> MarginBorrow
pub fn margin_borrow(&self) -> MarginBorrow
Returns a handle to the MarginBorrow endpoint group.
Returns a handle to the NaverTrend endpoint group.
Sourcepub fn open_interest(&self) -> OpenInterest
pub fn open_interest(&self) -> OpenInterest
Returns a handle to the OpenInterest endpoint group.
Returns a handle to the Premium endpoint group.
Sourcepub fn trading_fees(&self) -> TradingFees
pub fn trading_fees(&self) -> TradingFees
Returns a handle to the TradingFees endpoint group.
Sourcepub fn wallet_status(&self) -> WalletStatus
pub fn wallet_status(&self) -> WalletStatus
Returns a handle to the WalletStatus endpoint group.