precolator-sdk
Async Rust client SDK for the Precolator perpetual futures trading platform on Solana.
Features
- Full API coverage — markets, portfolio, trades, leaderboard, tokens, statistics
- Strongly typed — every endpoint returns a concrete Rust struct
- Async-first — built on
tokio+reqwest - Configurable — point at mainnet, devnet, or your own deployment
- Rate-limit aware — detects 429 responses and surfaces them as typed errors
Quick Start
[]
= "1.0"
= { = "1", = ["full"] }
use PrecolatorClient;
async
Available Methods
| Method | Endpoint |
|---|---|
health() |
GET /api/v1/health |
health_detailed() |
GET /api/v1/health/detailed |
get_markets() |
GET /api/v1/markets |
get_market(id) |
GET /api/v1/markets/:id |
get_market_stats(id) |
GET /api/v1/markets/:id/stats |
get_trades() |
GET /api/v1/trades |
get_trade(id) |
GET /api/v1/trades/:tradeId |
get_user_trades(wallet) |
GET /api/v1/trades/user/:wallet |
get_portfolio(wallet) |
GET /api/v1/portfolio/:wallet |
get_portfolio_history(wallet) |
GET /api/v1/portfolio/:wallet/history |
get_portfolio_stats(wallet) |
GET /api/v1/portfolio/:wallet/stats |
get_leaderboard() |
GET /api/v1/leaderboard |
get_leaderboard_by_timeframe(tf) |
GET /api/v1/leaderboard/:timeframe |
get_tokens() |
GET /api/v1/tokens |
get_token(symbol) |
GET /api/v1/tokens/:symbol |
get_platform_stats() |
GET /api/v1/stats |
get_market_overview() |
GET /api/v1/stats/markets/overview |
get_exchange_metrics() |
GET /api/v1/stats/exchange/metrics |
Custom HTTP Client
use Client;
use PrecolatorClient;
use Duration;
let http = builder
.timeout
.build
.unwrap;
let client = with_client.unwrap;
Error Handling
The SDK uses PrecolatorError with variants for HTTP, API, rate-limits, and serialization errors:
use ;
match client.get_market.await
License
Apache License 2.0 — see LICENSE for details.