pub struct PrecolatorClient { /* private fields */ }Expand description
Async client for interacting with the Precolator API.
§Example
use precolator_sdk::PrecolatorClient;
#[tokio::main]
async fn main() -> precolator_sdk::Result<()> {
let client = PrecolatorClient::new("https://precolator.xyz");
let markets = client.get_markets().await?;
Ok(())
}Implementations§
Source§impl PrecolatorClient
impl PrecolatorClient
Sourcepub fn new(base_url: &str) -> Self
pub fn new(base_url: &str) -> Self
Create a new client pointing at the given base URL.
let client = precolator_sdk::PrecolatorClient::new("https://precolator.xyz");Sourcepub fn with_client(base_url: &str, http: Client) -> Result<Self>
pub fn with_client(base_url: &str, http: Client) -> Result<Self>
Create a client with a custom reqwest::Client (e.g. custom timeouts).
Sourcepub async fn health(&self) -> Result<HealthStatus>
pub async fn health(&self) -> Result<HealthStatus>
GET /api/v1/health
Sourcepub async fn health_detailed(&self) -> Result<DetailedHealth>
pub async fn health_detailed(&self) -> Result<DetailedHealth>
GET /api/v1/health/detailed
Sourcepub async fn get_markets(&self) -> Result<Vec<Market>>
pub async fn get_markets(&self) -> Result<Vec<Market>>
GET /api/v1/markets – list all markets.
Sourcepub async fn get_market(&self, id: &str) -> Result<Market>
pub async fn get_market(&self, id: &str) -> Result<Market>
GET /api/v1/markets/:id – single market details.
Sourcepub async fn get_market_stats(&self, id: &str) -> Result<MarketStats>
pub async fn get_market_stats(&self, id: &str) -> Result<MarketStats>
GET /api/v1/markets/:id/stats – market statistics.
Sourcepub async fn get_trades(&self) -> Result<Vec<Trade>>
pub async fn get_trades(&self) -> Result<Vec<Trade>>
GET /api/v1/trades – recent trades across all markets.
Sourcepub async fn get_user_trades(&self, wallet: &str) -> Result<Vec<Trade>>
pub async fn get_user_trades(&self, wallet: &str) -> Result<Vec<Trade>>
GET /api/v1/trades/user/:wallet
Sourcepub async fn get_portfolio(&self, wallet: &str) -> Result<Portfolio>
pub async fn get_portfolio(&self, wallet: &str) -> Result<Portfolio>
GET /api/v1/portfolio/:wallet
Sourcepub async fn get_portfolio_history(
&self,
wallet: &str,
) -> Result<PortfolioHistory>
pub async fn get_portfolio_history( &self, wallet: &str, ) -> Result<PortfolioHistory>
GET /api/v1/portfolio/:wallet/history
Sourcepub async fn get_portfolio_stats(&self, wallet: &str) -> Result<PortfolioStats>
pub async fn get_portfolio_stats(&self, wallet: &str) -> Result<PortfolioStats>
GET /api/v1/portfolio/:wallet/stats
Sourcepub async fn get_leaderboard(&self) -> Result<Vec<LeaderboardEntry>>
pub async fn get_leaderboard(&self) -> Result<Vec<LeaderboardEntry>>
GET /api/v1/leaderboard
Sourcepub async fn get_leaderboard_by_timeframe(
&self,
timeframe: &str,
) -> Result<Vec<LeaderboardEntry>>
pub async fn get_leaderboard_by_timeframe( &self, timeframe: &str, ) -> Result<Vec<LeaderboardEntry>>
GET /api/v1/leaderboard/:timeframe (e.g. 7d, 30d, all)
Sourcepub async fn get_tokens(&self) -> Result<Vec<Token>>
pub async fn get_tokens(&self) -> Result<Vec<Token>>
GET /api/v1/tokens
Sourcepub async fn get_platform_stats(&self) -> Result<PlatformStats>
pub async fn get_platform_stats(&self) -> Result<PlatformStats>
GET /api/v1/stats – platform-wide statistics.
Sourcepub async fn get_market_overview(&self) -> Result<MarketOverview>
pub async fn get_market_overview(&self) -> Result<MarketOverview>
GET /api/v1/stats/markets/overview
Sourcepub async fn get_exchange_metrics(&self) -> Result<ExchangeMetrics>
pub async fn get_exchange_metrics(&self) -> Result<ExchangeMetrics>
GET /api/v1/stats/exchange/metrics
Trait Implementations§
Source§impl Clone for PrecolatorClient
impl Clone for PrecolatorClient
Source§fn clone(&self) -> PrecolatorClient
fn clone(&self) -> PrecolatorClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PrecolatorClient
impl !RefUnwindSafe for PrecolatorClient
impl Send for PrecolatorClient
impl Sync for PrecolatorClient
impl Unpin for PrecolatorClient
impl UnsafeUnpin for PrecolatorClient
impl !UnwindSafe for PrecolatorClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more