Skip to main content

LimitlessClient

Struct LimitlessClient 

Source
pub struct LimitlessClient { /* private fields */ }
Expand description

The primary entry point for all Limitless Exchange API operations.

Every REST endpoint and convenience method is available directly on this struct. The internal manager types (Markets, Trader, Portfolio, Navigation, Stream) are still available through accessor methods when you need them, but for the common case you never have to think about them.

§Authentication

Credentials are read automatically from environment variables LIMITLESS_API_KEY and LIMITLESS_API_SECRET when not explicitly set on the builder.

Implementations§

Source§

impl LimitlessClient

Source

pub fn builder() -> LimitlessClientBuilder

Create a new LimitlessClientBuilder.

Source

pub fn raw_client(&self) -> &Client

Access the underlying HTTP client for custom / advanced requests.

Source

pub fn set_credentials( &mut self, api_key: Option<String>, secret_key: Option<String>, )

Update credentials at runtime.

Source

pub fn retry_config(&self) -> &RetryConfig

The current retry configuration.

Source

pub fn base_url(&self) -> &str

The current REST API base URL.

Source

pub fn markets(&self) -> Markets

Access the raw Markets manager.

Source

pub fn trader(&self) -> Trader

Access the raw Trader manager.

Source

pub fn portfolio(&self) -> Portfolio

Access the raw Portfolio manager.

Source

pub fn navigation(&self) -> Navigation

Access the raw Navigation manager.

Source

pub fn stream(&self) -> Stream

Access the raw Stream manager for WebSocket subscriptions.

Source

pub async fn browse_active( &self, category_id: Option<u64>, page: Option<u64>, limit: Option<u64>, sort_by: Option<String>, trade_type: Option<String>, automation_type: Option<String>, ) -> Result<ActiveMarketsResponse, LimitlessError>

Browse all active (unresolved) markets with optional filters.

Source

pub async fn get_category_counts( &self, ) -> Result<CategoryCountResponse, LimitlessError>

Get the count of active markets per category.

Source

pub async fn get_active_slugs(&self) -> Result<Vec<ActiveSlug>, LimitlessError>

Get all active market slugs with metadata.

Source

pub async fn get_market( &self, address_or_slug: &str, ) -> Result<MarketDetail, LimitlessError>

Get detailed market information by address or slug.

Source

pub async fn get_oracle_candles( &self, address_or_slug: &str, interval: Option<&str>, from: Option<u64>, to: Option<u64>, ) -> Result<OracleCandlesResponse, LimitlessError>

Get Chainlink oracle candlestick data for a market.

Source

pub async fn get_feed_events( &self, slug: &str, page: Option<u64>, limit: Option<u64>, ) -> Result<FeedEventsResponse, LimitlessError>

Get feed events (trades, orders, liquidity) for a market.

Source

pub async fn search_markets( &self, query: &str, limit: Option<u64>, page: Option<u64>, similarity_threshold: Option<f64>, ) -> Result<SearchResponse, LimitlessError>

Semantic search for markets using natural language queries.

Source

pub async fn create_order( &self, order_request: &str, ) -> Result<CreateOrderResponse, LimitlessError>

Create a new order from a raw JSON body.

Source

pub async fn order_status_batch( &self, request_body: &str, ) -> Result<OrderStatusBatchResponse, LimitlessError>

Fetch statuses for multiple orders in batch.

Source

pub async fn cancel_combined( &self, request_body: &str, ) -> Result<CancelOrderResponse, LimitlessError>

Cancel a single order by orderId or clientOrderId.

Source

pub async fn cancel_batch( &self, request_body: &str, ) -> Result<CancelBatchResponse, LimitlessError>

Cancel multiple orders by internal orderIds.

Source

pub async fn cancel_order_by_id( &self, order_id: &str, ) -> Result<CancelOrderResponse, LimitlessError>

Cancel a single order by internal orderId.

Source

pub async fn cancel_all_in_market( &self, slug: &str, ) -> Result<CancelAllResponse, LimitlessError>

Cancel all orders for the authenticated user in a specific market.

Source

pub async fn get_orderbook( &self, slug: &str, ) -> Result<OrderbookResponse, LimitlessError>

Get the current orderbook for a market.

Source

pub async fn get_historical_prices( &self, slug: &str, interval: Option<&str>, ) -> Result<Vec<HistoricalPriceData>, LimitlessError>

Get historical price data for a market.

Source

pub async fn get_locked_balance( &self, slug: &str, ) -> Result<LockedBalanceResponse, LimitlessError>

Get the amount of funds locked in open orders.

Source

pub async fn get_user_orders( &self, slug: &str, statuses: Option<&[&str]>, limit: Option<u64>, ) -> Result<UserOrdersResponse, LimitlessError>

Get all orders placed by the authenticated user in a market.

Source

pub async fn get_market_events( &self, slug: &str, page: Option<u64>, limit: Option<u64>, ) -> Result<MarketEventsResponse, LimitlessError>

Get recent market events (trades, orders, liquidity changes).

Source

pub async fn buy_gtc( &self, private_key: &str, market_slug: &str, token_id: &str, price: f64, size: f64, owner_id: u64, ) -> Result<CreateOrderResponse, LimitlessError>

Place a GTC buy limit order — one call does it all.

Automatically fetches the venue contract, builds, signs, and submits.

Source

pub async fn sell_gtc( &self, private_key: &str, market_slug: &str, token_id: &str, price: f64, size: f64, owner_id: u64, ) -> Result<CreateOrderResponse, LimitlessError>

Place a GTC sell limit order — one call does it all.

Source

pub async fn buy_fok( &self, private_key: &str, market_slug: &str, token_id: &str, usdc_amount: f64, owner_id: u64, ) -> Result<CreateOrderResponse, LimitlessError>

Place a FOK buy market order — one call does it all.

Source

pub async fn sell_fok( &self, private_key: &str, market_slug: &str, token_id: &str, share_amount: f64, owner_id: u64, ) -> Result<CreateOrderResponse, LimitlessError>

Place a FOK sell market order — one call does it all.

Source

pub async fn cancel_all( &self, slug: &str, ) -> Result<CancelAllResponse, LimitlessError>

Cancel all open orders in a market (convenience alias).

Source

pub async fn get_profile( &self, account: &str, ) -> Result<ProfileResponse, LimitlessError>

Get your own profile by wallet address.

Source

pub async fn get_trades(&self) -> Result<Vec<TradeEntry>, LimitlessError>

Retrieve all AMM trades for the authenticated user.

Source

pub async fn get_positions(&self) -> Result<PositionsResponse, LimitlessError>

Retrieve all active positions with P&L and market values.

Source

pub async fn get_pnl_chart( &self, timeframe: Option<&str>, ) -> Result<PnlChartResponse, LimitlessError>

Get PnL chart data.

Source

pub async fn get_points(&self) -> Result<PointsResponse, LimitlessError>

Get points breakdown for the authenticated user.

Source

pub async fn get_history( &self, cursor: Option<&str>, limit: Option<u64>, ) -> Result<HistoryResponse, LimitlessError>

Get cursor-paginated portfolio history.

Source

pub async fn get_allowance( &self, allowance_type: &str, spender: Option<&str>, ) -> Result<AllowanceResponse, LimitlessError>

Check USDC allowance for CLOB or NegRisk trading.

Source

pub async fn get_navigation_tree( &self, ) -> Result<Vec<NavigationNode>, LimitlessError>

Get the full hierarchical navigation tree.

Source

pub async fn get_page_by_path( &self, path: &str, ) -> Result<MarketPage, LimitlessError>

Resolve a URL path to a market page configuration.

Source

pub async fn list_page_markets( &self, page_id: &str, cursor: Option<&str>, page: Option<u64>, limit: Option<u64>, sort_by: Option<&str>, filters: Option<&BTreeMap<String, String>>, ) -> Result<PageMarketsResponse, LimitlessError>

List markets belonging to a specific market page.

Source

pub async fn list_property_keys( &self, ) -> Result<Vec<PropertyKey>, LimitlessError>

List all property keys with their options.

Source

pub async fn get_property_key( &self, key_id: &str, ) -> Result<PropertyKey, LimitlessError>

Get a specific property key by ID.

Source

pub async fn list_property_options( &self, key_id: &str, parent_id: Option<&str>, ) -> Result<Vec<PropertyOption>, LimitlessError>

List options for a specific property key.

Source

pub async fn ws_ping(&self) -> Result<(), LimitlessError>

Test WebSocket connectivity with a ping/pong.

Source

pub async fn ws_subscribe<F>(&self, handler: F) -> Result<(), LimitlessError>
where F: FnMut(Value) -> Result<(), LimitlessError> + 'static + Send,

Subscribe to WebSocket events with a handler callback.

Source

pub async fn ws_subscribe_with_commands<F>( &self, cmd_receiver: UnboundedReceiver<String>, handler: F, ) -> Result<(), LimitlessError>
where F: FnMut(Value) -> Result<(), LimitlessError> + 'static + Send,

Subscribe to WebSocket events with dynamic command support.

Source

pub async fn ws_subscribe_authenticated_with_commands<F>( &self, cmd_receiver: UnboundedReceiver<String>, handler: F, ) -> Result<(), LimitlessError>
where F: FnMut(Value) -> Result<(), LimitlessError> + 'static + Send,

Subscribe to WebSocket events with dynamic command support and authentication.

Enables private channels: subscribe_positions, subscribe_order_events.

Source

pub async fn ws_subscribe_authenticated_events<F>( &self, handler: F, ) -> Result<(), LimitlessError>
where F: FnMut(WsEventKind) -> Result<(), LimitlessError> + 'static + Send,

Subscribe to typed WebSocket events with authentication.

Enables private channels: positions, orderEvent.

Trait Implementations§

Source§

impl Clone for LimitlessClient

Source§

fn clone(&self) -> LimitlessClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for LimitlessClient

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Limitless for LimitlessClient

Source§

fn new(api_key: Option<String>, secret: Option<String>) -> Self

Create a new manager instance with optional API key and secret. Read more
Source§

fn new_with_config( config: &Config, api_key: Option<String>, secret: Option<String>, ) -> Self

Create a new manager instance with a custom Config.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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