Public Methods
Client Initialization
Section titled “Client Initialization”Public methods require nothing beyond the host URL. No signer, no credentials.
use openfish_client_sdk::clob::{Client, Config};
let client = Client::new("https://api.openfish.fun", Config::default())?;
// Or use the default:let client = Client::default(); // https://api.openfish.funHealth Check
Section titled “Health Check”Confirm that the CLOB service is running.
let ok = client.ok().await?;println!("Service status: {ok}");REST: GET /
Server Time
Section titled “Server Time”server_time
Section titled “server_time”Returns the server’s current Unix timestamp in seconds.
let time = client.server_time().await?;println!("Server time: {time}");REST: GET /time
Markets
Section titled “Markets”market
Section titled “market”Fetch details for a single market by condition ID.
let market = client.market("CONDITION_ID").await?;println!("Question: {}", market.question);println!("Tick size: {}", market.minimum_tick_size);println!("Tokens: {:?}", market.tokens);REST: GET /market?condition_id=CONDITION_ID
Key response fields:
| Field | Type | Description |
|---|---|---|
condition_id | string | Unique market identifier |
question | string | Market question text |
minimum_tick_size | number | Minimum price increment |
neg_risk | boolean | Whether multi-outcome (neg risk) |
tokens | array | Outcome tokens with outcome, price, token_id, winner |
accepting_orders | boolean | Whether the market accepts orders |
taker_base_fee | number | Taker fee in basis points |
markets
Section titled “markets”Retrieve multiple markets with pagination support.
let page = client.markets().await?;println!("{} markets (limit {})", page.count, page.limit);for market in &page.data { println!(" {}: {}", market.condition_id, market.question);}REST: GET /markets
simplified_markets
Section titled “simplified_markets”A lighter response format optimized for faster loading. Returns only core fields: accepting_orders, active, condition_id, tokens, and rewards.
let page = client.simplified_markets().await?;REST: GET /simplified-markets
sampling_markets / sampling_simplified_markets
Section titled “sampling_markets / sampling_simplified_markets”Markets that qualify for liquidity rewards.
let page = client.sampling_markets().await?;let simplified = client.sampling_simplified_markets().await?;REST: GET /sampling-markets, GET /sampling-simplified-markets
Orderbooks and Prices
Section titled “Orderbooks and Prices”order_book
Section titled “order_book”Complete orderbook for a token.
use openfish_client_sdk::clob::types::request::OrderBookSummaryRequest;
let request = OrderBookSummaryRequest::builder() .token_id("TOKEN_ID".parse()?) .build();let book = client.order_book(&request).await?;println!("Bids: {:?}, Asks: {:?}", book.bids, book.asks);REST: GET /book?token_id=TOKEN_ID
Best available price for a given side.
use openfish_client_sdk::clob::types::{Side, request::PriceRequest};
let request = PriceRequest::builder() .token_id("TOKEN_ID".parse()?) .side(Side::Buy) .build();let price = client.price(&request).await?;println!("Best ask: {}", price.price);REST: GET /price?token_id=TOKEN_ID&side=BUY
midpoint
Section titled “midpoint”Mean of best bid and best ask.
use openfish_client_sdk::clob::types::request::MidpointRequest;
let request = MidpointRequest::builder() .token_id("TOKEN_ID".parse()?) .build();let mid = client.midpoint(&request).await?;println!("Midpoint: {}", mid.mid);REST: GET /midpoint?token_id=TOKEN_ID
spread
Section titled “spread”Gap between best ask and best bid.
use openfish_client_sdk::clob::types::request::SpreadRequest;
let request = SpreadRequest::builder() .token_id("TOKEN_ID".parse()?) .build();let spread = client.spread(&request).await?;println!("Spread: {}", spread.spread);REST: GET /spread?token_id=TOKEN_ID
last_trade_price
Section titled “last_trade_price”Most recent execution price and trade direction for a token.
use openfish_client_sdk::clob::types::request::LastTradePriceRequest;
let request = LastTradePriceRequest::builder() .token_id("TOKEN_ID".parse()?) .build();let last = client.last_trade_price(&request).await?;println!("Last: {} ({})", last.price, last.side);REST: GET /last-trade-price?token_id=TOKEN_ID
Batch Methods
Section titled “Batch Methods”Every orderbook query has a batch counterpart that accepts arrays of token parameters.
| Single | Batch | REST |
|---|---|---|
order_book() | order_books() | POST /books |
price() | prices() | POST /prices |
midpoint() | midpoints() | POST /midpoints |
spread() | spreads() | POST /spreads |
last_trade_price() | last_trades_prices() | POST /last-trades-prices |
use openfish_client_sdk::clob::types::{Side, request::PriceRequest};
let requests = vec![ PriceRequest::builder().token_id("TOKEN_A".parse()?).side(Side::Buy).build(), PriceRequest::builder().token_id("TOKEN_B".parse()?).side(Side::Buy).build(),];let prices = client.prices(&requests).await?;Market Parameters
Section titled “Market Parameters”fee_rate_bps
Section titled “fee_rate_bps”Fee rate in basis points for a token.
let fee = client.fee_rate_bps("TOKEN_ID".parse()?).await?;REST: GET /fee-rate?token_id=TOKEN_ID
tick_size
Section titled “tick_size”Minimum price increment for a market.
let tick = client.tick_size("TOKEN_ID".parse()?).await?;REST: GET /tick-size?token_id=TOKEN_ID
neg_risk
Section titled “neg_risk”Whether a market uses negative risk (multi-outcome).
let is_neg = client.neg_risk("TOKEN_ID".parse()?).await?;REST: GET /neg-risk?token_id=TOKEN_ID
See Also
Section titled “See Also”- L1 Methods — Derive API credentials -> l1
- L2 Methods — Place orders and manage trades -> l2
- Orderbook — Detailed orderbook guide -> ../orderbook