Skip to content

Public Methods

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.fun

Confirm that the CLOB service is running.

let ok = client.ok().await?;
println!("Service status: {ok}");

REST: GET /


Returns the server’s current Unix timestamp in seconds.

let time = client.server_time().await?;
println!("Server time: {time}");

REST: GET /time


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:

FieldTypeDescription
condition_idstringUnique market identifier
questionstringMarket question text
minimum_tick_sizenumberMinimum price increment
neg_riskbooleanWhether multi-outcome (neg risk)
tokensarrayOutcome tokens with outcome, price, token_id, winner
accepting_ordersbooleanWhether the market accepts orders
taker_base_feenumberTaker fee in basis points

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

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


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

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

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

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


Every orderbook query has a batch counterpart that accepts arrays of token parameters.

SingleBatchREST
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?;

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

Minimum price increment for a market.

let tick = client.tick_size("TOKEN_ID".parse()?).await?;

REST: GET /tick-size?token_id=TOKEN_ID

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


  • L1 Methods — Derive API credentials -> l1
  • L2 Methods — Place orders and manage trades -> l2
  • Orderbook — Detailed orderbook guide -> ../orderbook