pub struct PolymarketUsClient { /* private fields */ }Implementations§
Source§impl PolymarketUsClient
impl PolymarketUsClient
pub fn builder() -> PolymarketUsClientBuilder
pub fn with_reqwest(http: Client, auth: Option<UsAuth>) -> Self
pub fn auth(&self) -> Option<&UsAuth>
pub fn api_base_url(&self) -> &str
pub fn retry_config(&self) -> &RetryConfig
Sourcepub fn correlation_id_prefix(&self) -> &str
pub fn correlation_id_prefix(&self) -> &str
The prefix prepended to the X-Correlation-ID header of every request.
pub fn gateway_base_url(&self) -> &str
Sourcepub fn markets(&self) -> MarketsClient<'_>
pub fn markets(&self) -> MarketsClient<'_>
Access markets resource (discovery, order book, pricing)
Sourcepub fn events(&self) -> EventsClient<'_>
pub fn events(&self) -> EventsClient<'_>
Access events resource
Sourcepub fn orders(&self) -> OrdersClient<'_>
pub fn orders(&self) -> OrdersClient<'_>
Access orders resource (lifecycle management)
Sourcepub fn account(&self) -> AccountClient<'_>
pub fn account(&self) -> AccountClient<'_>
Access account resource (balances, buying power)
Sourcepub fn portfolio(&self) -> PortfolioClient<'_>
pub fn portfolio(&self) -> PortfolioClient<'_>
Access portfolio resource (positions, activity)
Sourcepub fn search(&self) -> SearchClient<'_>
pub fn search(&self) -> SearchClient<'_>
Access search resource (full-text search)
Sourcepub fn market_stream(&self) -> MarketStreamClient
pub fn market_stream(&self) -> MarketStreamClient
Build a client for the market-data socket, inheriting this client’s credentials.
The WebSocket endpoints live on the API host, not the gateway host used
for public REST traffic, so this does not derive its URL from
gateway_base_url. The returned client is independent of self and can
outlive it.
let client = PolymarketUsClient::builder().build()?;
let mut stream = client
.market_stream()
.connect(vec![MarketSubscription::market_data_lite(["btc-100k-2025"])])
.await?;Sourcepub fn private_stream(&self) -> Result<PrivateStreamClient, PolymarketUsError>
pub fn private_stream(&self) -> Result<PrivateStreamClient, PolymarketUsError>
Build a client for the private account socket (orders, positions, balances).
Fails with PolymarketUsError::MissingAuth if this client has no
credentials — the private endpoint rejects an unauthenticated upgrade,
so there is nothing useful to hand back.
let client = PolymarketUsClient::builder().auth(UsAuth::from_env()?).build()?;
let mut stream = client
.private_stream()?
.connect(vec![PrivateSubscription::orders()])
.await?;pub async fn health(&self) -> Result<HealthResponse, PolymarketUsError>
Trait Implementations§
Source§impl Clone for PolymarketUsClient
impl Clone for PolymarketUsClient
Source§fn clone(&self) -> PolymarketUsClient
fn clone(&self) -> PolymarketUsClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more