pub struct CryptocomRestClient { /* private fields */ }Expand description
Crypto.com public REST client.
Construct once and clone cheaply — the underlying HTTP client pools
connections. All methods are &self and async.
Implementations§
Source§impl CryptocomRestClient
impl CryptocomRestClient
Sourcepub fn with_base_url(base_url: impl Into<String>) -> Result<Self>
pub fn with_base_url(base_url: impl Into<String>) -> Result<Self>
Build a client with a caller-supplied base URL (tests, proxies).
Sourcepub async fn get_instruments(&self) -> Result<Vec<CryptocomInstrument>>
pub async fn get_instruments(&self) -> Result<Vec<CryptocomInstrument>>
GET /public/get-instruments — every tradable instrument.
Sourcepub async fn get_orderbook(
&self,
instrument: &str,
depth: u32,
) -> Result<CryptocomOrderBook>
pub async fn get_orderbook( &self, instrument: &str, depth: u32, ) -> Result<CryptocomOrderBook>
GET /public/get-book — order book snapshot for instrument.
depth is clamped server-side to a supported value (e.g. 10, 50).
Sourcepub async fn get_candlestick(
&self,
instrument: &str,
timeframe: &str,
) -> Result<Vec<CryptocomCandle>>
pub async fn get_candlestick( &self, instrument: &str, timeframe: &str, ) -> Result<Vec<CryptocomCandle>>
GET /public/get-candlestick — OHLC bars for instrument.
timeframe follows Crypto.com’s wire values — "1m", "5m",
"15m", "30m", "1h", "4h", "6h", "12h", "1D",
"7D", "14D", "1M".
Sourcepub async fn get_ticker(
&self,
instrument: Option<&str>,
) -> Result<Vec<CryptocomTicker>>
pub async fn get_ticker( &self, instrument: Option<&str>, ) -> Result<Vec<CryptocomTicker>>
GET /public/get-tickers — 24-hour rolling ticker for one or all
instruments. Pass None to fetch every instrument.
Sourcepub async fn get_recent_trades(
&self,
instrument: &str,
) -> Result<Vec<CryptocomTrade>>
pub async fn get_recent_trades( &self, instrument: &str, ) -> Result<Vec<CryptocomTrade>>
GET /public/get-trades — recent trades for instrument.
Sourcepub async fn get_valuations(
&self,
instrument: &str,
valuation_type: &str,
) -> Result<Vec<CryptocomValuation>>
pub async fn get_valuations( &self, instrument: &str, valuation_type: &str, ) -> Result<Vec<CryptocomValuation>>
GET /public/get-valuations — mark/index price or funding rate
time series for a perpetual.
valuation_type is one of "index_price", "mark_price",
"funding_rate", "estimated_funding_rate". Returns a time
series; the latest value is the last element.
Trait Implementations§
Source§impl Clone for CryptocomRestClient
impl Clone for CryptocomRestClient
Source§fn clone(&self) -> CryptocomRestClient
fn clone(&self) -> CryptocomRestClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more