Skip to main content

ClobClient

Struct ClobClient 

Source
pub struct ClobClient {
    pub host: String,
    pub chain_id: i64,
    pub http_client: Client,
    pub signer: Option<Arc<EthersSigner>>,
    pub creds: Option<ApiKeyCreds>,
    pub use_server_time: bool,
    pub geo_block_token: Option<String>,
    pub tick_sizes: DashMap<String, String>,
    pub neg_risk: DashMap<String, bool>,
    pub fee_rates: DashMap<String, Decimal>,
    pub builder_signer: Option<BuilderSigner>,
    pub builder_config: Option<BuilderConfig>,
}

Fields§

§host: String§chain_id: i64§http_client: Client

HTTP 客户端实例。

  • 调用方传入 Some(client) 时使用该实例(可自定义代理、超时等)。
  • 传入 None 时使用全局共享默认实例(http_helpers::default_client() clone), 所有未自定义的 ClobClient 共享同一连接池。
§signer: Option<Arc<EthersSigner>>§creds: Option<ApiKeyCreds>§use_server_time: bool§geo_block_token: Option<String>

Optional geo block token passed as query parameter geo_block_token.

§tick_sizes: DashMap<String, String>§neg_risk: DashMap<String, bool>§fee_rates: DashMap<String, Decimal>§builder_signer: Option<BuilderSigner>

Optional Builder signer for builder-authenticated flows

§builder_config: Option<BuilderConfig>

Optional default builder config for order creation

Implementations§

Source§

impl ClobClient

Source

pub async fn getMarkets( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Market>, ClobError>

TS parity alias for get_markets (camelCase). Prefer get_markets in Rust.

Source

pub async fn getMarket( &self, market_id: &str, params: Option<HashMap<String, String>>, ) -> Result<Market, ClobError>

TS parity alias for getMarket -> get_market.

Source

pub async fn getOrderBook( &self, token_id: &str, ) -> Result<OrderBookSummary, ClobError>

Source

pub async fn getTickSize(&self, token_id: &str) -> Result<String, ClobError>

Source

pub async fn getNegRisk(&self, token_id: &str) -> Result<bool, ClobError>

Source

pub async fn getFeeRate(&self, token_id: &str) -> Result<Decimal, ClobError>

Source

pub async fn getOpenOrders( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<SignedOrder>, ClobError>

Source

pub async fn getOrder(&self, order_id: &str) -> Result<OpenOrder, ClobError>

Source

pub async fn postSignedOrder( &self, signed_order: &SignedOrder, ) -> Result<OrderResponse, ClobError>

Source

pub async fn postOrders( &self, orders: Vec<PostOrdersArgs>, defer_exec: bool, default_post_only: bool, ) -> Result<Vec<Order>, ClobError>

Source

pub async fn createOrder( &self, user_order: UserOrder, options_tick: Option<&str>, ) -> Result<SignedOrder, ClobError>

Source

pub async fn createMarketOrder( &self, user_market_order: UserMarketOrder, options_tick: Option<&str>, ) -> Result<SignedOrder, ClobError>

Source

pub async fn createAndPostOrder( &self, user_order: UserOrder, options_tick: Option<&str>, order_type: Option<OrderType>, defer_exec: bool, post_only: bool, ) -> Result<OrderResponse, ClobError>

Source

pub async fn createAndPostMarketOrder( &self, user_market_order: UserMarketOrder, options_tick: Option<&str>, order_type: Option<OrderType>, defer_exec: bool, ) -> Result<OrderResponse, ClobError>

Source

pub async fn cancelOrder( &self, payload: OrderPayloadParity, ) -> Result<Value, ClobError>

TypeScript parity: cancelOrder({ orderID }) 发送 DELETE /orders 携带 JSON body。

Source

pub async fn cancelOrders( &self, order_ids: Vec<String>, ) -> Result<Vec<Order>, ClobError>

Source

pub async fn cancelAll(&self) -> Result<Vec<Order>, ClobError>

Source

pub async fn cancelMarketOrders( &self, payload: OrderMarketCancelParams, ) -> Result<Vec<Order>, ClobError>

Source

pub async fn isOrderScoring( &self, params: Option<HashMap<String, String>>, ) -> Result<OrderScoring, ClobError>

Source

pub async fn areOrdersScoring( &self, order_ids: Option<Vec<String>>, ) -> Result<OrdersScoring, ClobError>

Source

pub async fn getTrades( &self, params: Option<HashMap<String, String>>, only_first_page: bool, next_cursor: Option<String>, ) -> Result<Vec<Value>, ClobError>

Source

pub async fn getTradesTyped( &self, params: Option<HashMap<String, String>>, only_first_page: bool, next_cursor: Option<String>, ) -> Result<Vec<Trade>, ClobError>

Source

pub async fn getNotifications(&self) -> Result<Vec<Notification>, ClobError>

Source

pub async fn dropNotifications( &self, ids: Option<&Vec<String>>, ) -> Result<(), ClobError>

Source

pub async fn getBalanceAllowance( &self, params: Option<HashMap<String, String>>, ) -> Result<BalanceAllowanceResponse, ClobError>

Source

pub async fn updateBalanceAllowance( &self, params: Option<HashMap<String, String>>, ) -> Result<(), ClobError>

Source

pub async fn getTime(&self) -> Result<u64, ClobError>

Source

pub async fn getApiKeys(&self) -> Result<Vec<ApiKeyCreds>, ClobError>

Source

pub async fn deleteApiKey(&self) -> Result<(), ClobError>

Source

pub async fn getClosedOnlyMode(&self) -> Result<BanStatus, ClobError>

Source

pub async fn createApiKey( &self, nonce: Option<u64>, ) -> Result<ApiKeyCreds, ClobError>

Source

pub async fn deriveApiKey( &self, params: Option<HashMap<String, String>>, ) -> Result<ApiKeyCreds, ClobError>

Source

pub async fn createBuilderApiKey(&self) -> Result<ApiKeyCreds, ClobError>

Source

pub async fn getBuilderApiKeys(&self) -> Result<Vec<ApiKeyCreds>, ClobError>

Source

pub async fn revokeBuilderApiKey(&self) -> Result<(), ClobError>

Source

pub async fn getSimplifiedMarkets( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Market>, ClobError>

Source

pub async fn getSamplingMarkets( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Market>, ClobError>

Source

pub async fn getSamplingSimplifiedMarkets( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Market>, ClobError>

Source

pub async fn getOrderBooks( &self, params: &[BookParams], ) -> Result<Vec<OrderBookSummary>, ClobError>

Source

pub async fn getMidpoint( &self, params: Option<HashMap<String, String>>, ) -> Result<MidpointResponse, ClobError>

Source

pub async fn getMidpoints( &self, params: &[BookParams], ) -> Result<Value, ClobError>

Source

pub async fn getPrices(&self, params: &[BookParams]) -> Result<Value, ClobError>

Source

pub async fn getSpreads( &self, params: &[BookParams], ) -> Result<Value, ClobError>

Source

pub async fn getLastTradesPrices( &self, params: &[BookParams], ) -> Result<Value, ClobError>

Source

pub async fn getPricesHistory( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<MarketPrice>, ClobError>

Source

pub async fn getMarketTradesEvents( &self, market_id: &str, params: Option<HashMap<String, String>>, ) -> Result<Vec<Trade>, ClobError>

Source

pub async fn getBuilderTrades( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<BuilderTrade>, ClobError>

Source

pub async fn getEarningsForUserForDay( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Source

pub async fn getEarningsForUserForDayTyped( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Source

pub async fn getTotalEarningsForUserForDay( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Source

pub async fn getLiquidityRewardPercentages( &self, params: Option<HashMap<String, String>>, ) -> Result<HashMap<String, f64>, ClobError>

Source

pub async fn getRewardsMarketsCurrent( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<RewardsMarket>, ClobError>

Source

pub async fn getRewardsEarningsPercentages( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Source

pub fn new( host: &str, chain_id: i64, signer: Option<Arc<EthersSigner>>, creds: Option<ApiKeyCreds>, use_server_time: bool, http_client: Option<Client>, ) -> Self

创建 ClobClient。

http_client:

  • None — 使用全局共享默认连接池(所有传 None 的实例共享同一个池,与原有行为一致)
  • Some(client) — 使用调用方自定义的 reqwest::Client(可配置代理、独立连接池等)
Source

pub fn with_geo_block_token(self, token: String) -> Self

Source

pub fn set_geo_block_token(&mut self, token: Option<String>)

Source

pub fn with_builder_signer( self, key: String, secret_b64: String, passphrase: String, ) -> Self

Configure Builder API signer (builder auth). Secret must be base64 encoded.

Source

pub fn with_builder_config(self, cfg: ObBuilderConfig) -> Self

Set a default builder config for order creation (tick size, neg risk, signature type, funder).

Source

pub fn rfq(&self) -> RfqClient<'_>

RFQ entrypoint.

使用方式:client.rfq().get_rfq_quotes(...)

注意:RFQ 的 accept/approve 需要在本地创建并签名订单,因此会对 self 持有可变借用。

Source

pub async fn get_order_book( &self, token_id: &str, ) -> Result<OrderBookSummary, ClobError>

Source

pub async fn get_tick_size(&self, token_id: &str) -> Result<String, ClobError>

Source

pub async fn get_neg_risk(&self, token_id: &str) -> Result<bool, ClobError>

Source

pub async fn get_fee_rate(&self, token_id: &str) -> Result<Decimal, ClobError>

Source

pub async fn post_order( &self, signed_order: &SignedOrder, ) -> Result<OrderResponse, ClobError>

Convenience method that accepts a typed SignedOrder and posts it to the API. Delegates to post_signed_order which performs serialization, header creation and response parsing. Uses default orderType=GTC.

Source

pub async fn get_api_keys(&self) -> Result<Vec<ApiKeyCreds>, ClobError>

Source

pub async fn create_readonly_api_key( &self, ) -> Result<ReadonlyApiKeyResponse, ClobError>

Creates a new readonly API key for the current (L2 authenticated) user.

TS parity: createReadonlyApiKey(): Promise<{ apiKey: string }>

Source

pub async fn get_readonly_api_keys(&self) -> Result<Vec<String>, ClobError>

Lists readonly API keys for the current (L2 authenticated) user.

TS parity: getReadonlyApiKeys(): Promise<string[]>

Source

pub async fn delete_readonly_api_key( &self, key: &str, ) -> Result<bool, ClobError>

Deletes a readonly API key for the current (L2 authenticated) user.

TS parity: deleteReadonlyApiKey(key: string): Promise<boolean>

Source

pub async fn validate_readonly_api_key( &self, address: &str, key: &str, ) -> Result<String, ClobError>

Validates a readonly API key for a given address.

TS parity: validateReadonlyApiKey(address: string, key: string): Promise<string>

Note: This endpoint is treated as public (no L1/L2 auth headers).

Source

pub async fn createReadonlyApiKey( &self, ) -> Result<ReadonlyApiKeyResponse, ClobError>

Source

pub async fn getReadonlyApiKeys(&self) -> Result<Vec<String>, ClobError>

Source

pub async fn deleteReadonlyApiKey(&self, key: &str) -> Result<bool, ClobError>

Source

pub async fn validateReadonlyApiKey( &self, address: &str, key: &str, ) -> Result<String, ClobError>

Source

pub async fn get_closed_only_mode(&self) -> Result<BanStatus, ClobError>

Source

pub async fn delete_api_key(&self) -> Result<(), ClobError>

Source

pub async fn get_trades( &self, params: Option<HashMap<String, String>>, only_first_page: bool, next_cursor: Option<String>, ) -> Result<Vec<Value>, ClobError>

Source

pub async fn get_trades_typed( &self, params: Option<HashMap<String, String>>, only_first_page: bool, next_cursor: Option<String>, ) -> Result<Vec<Trade>, ClobError>

Typed variant of get_trades that deserializes each trade into Trade.

Source

pub async fn get_notifications(&self) -> Result<Vec<Notification>, ClobError>

Source

pub async fn get_notifications_typed( &self, ) -> Result<Vec<Notification>, ClobError>

Typed variant of get_notifications that deserializes notifications into Notification.

Source

pub async fn drop_notifications( &self, ids: Option<&Vec<String>>, ) -> Result<(), ClobError>

Source

pub async fn get_balance_allowance( &self, params: Option<HashMap<String, String>>, ) -> Result<BalanceAllowanceResponse, ClobError>

Source

pub async fn update_balance_allowance( &self, params: Option<HashMap<String, String>>, ) -> Result<(), ClobError>

Source

pub async fn get_rewards_user_for_day_typed( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Typed helper to fetch user rewards for a day (deserializes into Reward). This endpoint may be public or require params depending on server; we accept optional query params.

Source

pub async fn create_order( &self, user_order: UserOrder, options_tick: Option<&str>, ) -> Result<SignedOrder, ClobError>

Source

pub async fn create_market_order( &self, user_market_order: UserMarketOrder, options_tick: Option<&str>, ) -> Result<SignedOrder, ClobError>

Source

pub async fn post_orders( &self, orders: Vec<PostOrdersArgs>, defer_exec: bool, default_post_only: bool, ) -> Result<Vec<Order>, ClobError>

Post multiple orders to the API (v5.2.0 signature)

This method matches the TypeScript SDK’s postOrders signature. It supports PostOrdersArgs which includes post_only support.

§Arguments
  • orders - Vector of PostOrdersArgs containing signed orders with their options
  • defer_exec - Whether to defer execution (default: false)
  • default_post_only - Default post_only value if not specified per-order (default: false)
§Returns
  • Vector of Order responses
Source

pub async fn post_signed_order( &self, signed_order: &SignedOrder, order_type: OrderType, defer_exec: bool, post_only: Option<bool>, ) -> Result<OrderResponse, ClobError>

Helper: post a single SignedOrder (typed) to the API. Wraps SignedOrder in NewOrder with orderType and performs L2-authenticated POST to POST_ORDER endpoint.

§Arguments
  • signed_order - The signed order to post
  • order_type - Type of order (GTC, FOK, GTD, FAK)
  • defer_exec - Whether to defer execution
  • post_only - If true, order will be rejected if it would immediately match (v5.2.0). Only supported for GTC and GTD orders.
Source

pub async fn post_signed_order_typed( &self, signed_order: &SignedOrder, order_type: OrderType, defer_exec: bool, post_only: Option<bool>, ) -> Result<OrderResponse, ClobError>

Typed variant of posting a signed order: posts the signed order and attempts to deserialize the response into an OrderResponse (or into the data field if present).

Source

pub async fn create_and_post_order( &self, user_order: UserOrder, options_tick: Option<&str>, order_type: Option<OrderType>, defer_exec: bool, post_only: Option<bool>, ) -> Result<OrderResponse, ClobError>

Convenience: create (build & sign) then immediately post a limit order. orderType defaults to GTC (Good Till Cancelled). Matches TypeScript SDK signature: createAndPostOrder(userOrder, options, orderType, deferExec, postOnly)

Source

pub async fn create_and_post_market_order( &self, user_market_order: UserMarketOrder, options_tick: Option<&str>, order_type: Option<OrderType>, defer_exec: bool, ) -> Result<OrderResponse, ClobError>

Convenience: create (build & sign) then immediately post a market order. orderType defaults to FOK (Fill Or Kill). Matches TypeScript SDK signature: createAndPostMarketOrder(userMarketOrder, options, orderType, deferExec)

Source

pub async fn post_orders_typed( &self, orders: Vec<SignedOrder>, _defer_exec: bool, ) -> Result<Value, ClobError>

Helper: accept typed SignedOrder list and post them to POST_ORDERS endpoint.

Source

pub async fn post_orders_typed_parsed( &self, orders: Vec<SignedOrder>, _defer_exec: bool, ) -> Result<Vec<Order>, ClobError>

Post typed orders and return parsed Vec<Order> from the response. This wraps the existing post_orders_typed which returns a raw JSON Value and attempts to parse either a top-level array or data field into Vec<Order>.

Source

pub async fn cancel_all(&self) -> Result<Vec<Order>, ClobError>

Source

pub async fn cancel_market_orders( &self, payload: OrderMarketCancelParams, ) -> Result<Vec<Order>, ClobError>

Source

pub async fn is_order_scoring( &self, params: Option<HashMap<String, String>>, ) -> Result<OrderScoring, ClobError>

Source

pub async fn are_orders_scoring( &self, order_ids: Option<Vec<String>>, ) -> Result<OrdersScoring, ClobError>

Source

pub async fn cancel_order_payload( &self, payload: OrderPayloadParity, ) -> Result<Order, ClobError>

Parity version using JSON body { orderID } instead of query param.

Source

pub async fn cancel_order_payload_raw( &self, payload: OrderPayloadParity, ) -> Result<Value, ClobError>

Raw JSON variant: return the API response as serde_json::Value (parity with TS any).

Source

pub async fn cancel_orders( &self, order_ids: Vec<String>, ) -> Result<Vec<Order>, ClobError>

Source

pub async fn get_order(&self, order_id: &str) -> Result<OpenOrder, ClobError>

Source

pub async fn get_order_typed( &self, order_id: &str, ) -> Result<OpenOrder, ClobError>

Typed variant: try to deserialize an order response into OpenOrder.

Source

pub async fn get_open_orders( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<SignedOrder>, ClobError>

Source

pub async fn get_open_orders_typed( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<SignedOrder>, ClobError>

Typed variant: try to deserialize open orders data into Vec`.

Source

pub async fn get_markets( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Market>, ClobError>

Source

pub async fn get_market( &self, market_id: &str, params: Option<HashMap<String, String>>, ) -> Result<Market, ClobError>

Source

pub async fn get_simplified_markets( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Market>, ClobError>

Source

pub async fn get_sampling_markets( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Market>, ClobError>

Source

pub async fn get_server_time(&self) -> Result<u64, ClobError>

Source

pub async fn create_api_key( &self, nonce: Option<u64>, ) -> Result<ApiKeyCreds, ClobError>

Source

pub async fn derive_api_key( &self, params: Option<HashMap<String, String>>, ) -> Result<ApiKeyCreds, ClobError>

Source

pub async fn create_builder_api_key(&self) -> Result<ApiKeyCreds, ClobError>

Source

pub async fn get_builder_api_keys(&self) -> Result<Vec<ApiKeyCreds>, ClobError>

Source

pub async fn revoke_builder_api_key(&self) -> Result<(), ClobError>

Source

pub async fn get_sampling_simplified_markets( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Market>, ClobError>

Source

pub async fn get_order_books( &self, params: &[BookParams], ) -> Result<Vec<OrderBookSummary>, ClobError>

POST /books with [{"token_id":"..."}] → array of OrderBookSummary

Source

pub async fn get_midpoint( &self, params: Option<HashMap<String, String>>, ) -> Result<MidpointResponse, ClobError>

GET /midpoint?token_id=...{"mid": "0.77"}

Source

pub async fn get_midpoints( &self, params: &[BookParams], ) -> Result<Value, ClobError>

POST /midpoints with [{"token_id":"..."}]{"TOKEN_ID": "0.77"}

Source

pub async fn get_price( &self, token_id: &str, side: &str, ) -> Result<PriceResponse, ClobError>

GET /price?token_id=...&side=BUY{"price": "0.76"}

Source

pub async fn get_prices( &self, params: &[BookParams], ) -> Result<Value, ClobError>

POST /prices with [{"token_id":"...","side":"BUY"}]{"TOKEN_ID": {"BUY": "0.76"}}

Source

pub async fn get_spread( &self, token_id: &str, ) -> Result<SpreadResponse, ClobError>

GET /spread?token_id=...{"spread": "0.02"}

Source

pub async fn get_spreads( &self, params: &[BookParams], ) -> Result<Value, ClobError>

POST /spreads with [{"token_id":"..."}]{"TOKEN_ID": "0.02"}

Source

pub async fn get_last_trade_price( &self, token_id: &str, ) -> Result<LastTradePriceResponse, ClobError>

GET /last-trade-price?token_id=...{"price": "0.8", "side": "BUY"}

Source

pub async fn get_last_trades_prices( &self, params: &[BookParams], ) -> Result<Value, ClobError>

POST /last-trades-prices with [{"token_id":"..."}][{"price":"0.8","side":"BUY","token_id":"..."}]

Source

pub async fn get_prices_history( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<MarketPrice>, ClobError>

GET /prices-history?market=TOKEN_ID&interval=...&fidelity=...{"history": [{t, p}]}

Source

pub async fn get_market_trades_events( &self, market_id: &str, params: Option<HashMap<String, String>>, ) -> Result<Vec<Trade>, ClobError>

Source

pub async fn get_earnings_for_user_for_day( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Source

pub async fn get_total_earnings_for_user_for_day( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Source

pub async fn get_total_earnings_for_user_for_day_typed( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Typed wrapper for total earnings for user for day. Attempts to parse an array of Reward.

Source

pub async fn get_liquidity_reward_percentages( &self, params: Option<HashMap<String, String>>, ) -> Result<HashMap<String, f64>, ClobError>

Source

pub async fn get_liquidity_reward_percentages_typed( &self, params: Option<HashMap<String, String>>, ) -> Result<HashMap<String, f64>, ClobError>

Typed wrapper for liquidity reward percentages. Attempts to parse into a map of market -> percentage.

Source

pub async fn get_rewards_markets_current( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<RewardsMarket>, ClobError>

Source

pub async fn get_rewards_markets( &self, market_id: &str, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Source

pub async fn get_rewards_markets_typed( &self, market_id: &str, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Typed wrapper for get_rewards_markets (per-market rewards). Returns Vec.

Source

pub async fn get_rewards_earnings_percentages( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Source

pub async fn get_rewards_earnings_percentages_typed( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Typed wrapper for rewards earnings percentages. Returns Vec or object parsed into map.

Source

pub async fn get_builder_trades( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<BuilderTrade>, ClobError>

Source

pub async fn get_builder_trades_typed( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<BuilderTrade>, ClobError>

Typed variant for builder trades (kept for compatibility)

Source

pub async fn get_earnings_for_user_for_day_typed( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<Reward>, ClobError>

Typed wrapper for get_earnings_for_user_for_day -> Vec

Source

pub async fn get_rewards_markets_current_typed( &self, params: Option<HashMap<String, String>>, ) -> Result<Vec<RewardsMarket>, ClobError>

Typed wrapper for current rewards markets

Source

pub async fn post_heartbeat( &self, heartbeat_id: Option<&str>, ) -> Result<HeartbeatResponse, ClobError>

Post a heartbeat to keep the session alive (added in v5.2.0)

Heartbeats must be sent within 10 seconds of each other. If a heartbeat is not received within 10 seconds, all orders will be cancelled.

Use heartbeat_id=None for the first heartbeat, then chain subsequent heartbeats using the returned heartbeat_id.

§Arguments
  • heartbeat_id - Optional heartbeat ID from a previous heartbeat to chain them
§Returns
  • HeartbeatResponse containing the heartbeat_id to use for the next heartbeat

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more