Skip to main content

RequestBuilder

Struct RequestBuilder 

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

Request builder for WebSocket messages

Implementations§

Source§

impl RequestBuilder

Source

pub fn new() -> Self

Create a new request builder

Source

pub fn build_request( &mut self, method: &str, params: Option<Value>, ) -> JsonRpcRequest

Build a JSON-RPC request

Source

pub fn build_auth_request( &mut self, client_id: &str, client_secret: &str, ) -> JsonRpcRequest

Build authentication request

Source

pub fn build_subscribe_request( &mut self, channels: Vec<String>, ) -> JsonRpcRequest

Build subscription request

Source

pub fn build_unsubscribe_request( &mut self, channels: Vec<String>, ) -> JsonRpcRequest

Build unsubscription request

Source

pub fn build_public_unsubscribe_all_request(&mut self) -> JsonRpcRequest

Build public unsubscribe_all request

Unsubscribes from all public channels. Takes no parameters.

§Returns

A JSON-RPC request for unsubscribing from all public channels

Source

pub fn build_private_unsubscribe_all_request(&mut self) -> JsonRpcRequest

Build private unsubscribe_all request

Unsubscribes from all private channels. Takes no parameters. Requires authentication.

§Returns

A JSON-RPC request for unsubscribing from all private channels

Source

pub fn build_test_request(&mut self) -> JsonRpcRequest

Build test request

Source

pub fn build_set_heartbeat_request(&mut self, interval: u64) -> JsonRpcRequest

Build set_heartbeat request

Enables heartbeat with specified interval. The server will send a heartbeat message every interval seconds, and expects a response within the same interval.

§Arguments
  • interval - Heartbeat interval in seconds (10-3600)
§Returns

A JSON-RPC request for setting the heartbeat interval

Source

pub fn build_disable_heartbeat_request(&mut self) -> JsonRpcRequest

Build disable_heartbeat request

Disables heartbeat messages. The server will stop sending heartbeat messages and test_request notifications.

§Returns

A JSON-RPC request for disabling heartbeats

Source

pub fn build_hello_request( &mut self, client_name: &str, client_version: &str, ) -> JsonRpcRequest

Build hello request

Sends client identification to the server. This is used for client tracking and debugging purposes.

§Arguments
  • client_name - Name of the client application
  • client_version - Version of the client application
§Returns

A JSON-RPC request for client identification

Source

pub fn build_get_time_request(&mut self) -> JsonRpcRequest

Build get time request

Source

pub fn build_enable_cancel_on_disconnect_request(&mut self) -> JsonRpcRequest

Build enable_cancel_on_disconnect request

Enables automatic cancellation of all open orders when the WebSocket connection is lost. This is a safety feature to prevent unintended order execution when the client loses connectivity.

§Returns

A JSON-RPC request for enabling cancel-on-disconnect

Source

pub fn build_disable_cancel_on_disconnect_request(&mut self) -> JsonRpcRequest

Build disable_cancel_on_disconnect request

Disables automatic cancellation of orders on disconnect. Orders will remain active even if the WebSocket connection is lost.

§Returns

A JSON-RPC request for disabling cancel-on-disconnect

Source

pub fn build_get_cancel_on_disconnect_request(&mut self) -> JsonRpcRequest

Build get_cancel_on_disconnect request

Retrieves the current cancel-on-disconnect status for the session.

§Returns

A JSON-RPC request for getting the cancel-on-disconnect status

Source

pub fn build_mass_quote_request( &mut self, request: MassQuoteRequest, ) -> JsonRpcRequest

Build mass quote request

Source

pub fn build_cancel_quotes_request( &mut self, request: CancelQuotesRequest, ) -> JsonRpcRequest

Build cancel quotes request

Source

pub fn build_set_mmp_config_request( &mut self, config: MmpGroupConfig, ) -> JsonRpcRequest

Build set MMP config request

Source

pub fn build_get_mmp_config_request( &mut self, mmp_group: Option<String>, ) -> JsonRpcRequest

Build get MMP config request

Source

pub fn build_reset_mmp_request( &mut self, mmp_group: Option<String>, ) -> JsonRpcRequest

Build reset MMP request

Source

pub fn build_get_open_orders_request( &mut self, currency: Option<String>, kind: Option<String>, type_filter: Option<String>, ) -> JsonRpcRequest

Build get open orders request

Source

pub fn build_buy_request(&mut self, request: &OrderRequest) -> JsonRpcRequest

Build buy order request

Source

pub fn build_sell_request(&mut self, request: &OrderRequest) -> JsonRpcRequest

Build sell order request

Source

pub fn build_cancel_request(&mut self, order_id: &str) -> JsonRpcRequest

Build cancel order request

Source

pub fn build_cancel_all_request(&mut self) -> JsonRpcRequest

Build cancel all orders request

Source

pub fn build_cancel_all_by_currency_request( &mut self, currency: &str, ) -> JsonRpcRequest

Build cancel all orders by currency request

Source

pub fn build_cancel_all_by_instrument_request( &mut self, instrument_name: &str, ) -> JsonRpcRequest

Build cancel all orders by instrument request

Source

pub fn build_edit_request( &mut self, request: &EditOrderRequest, ) -> JsonRpcRequest

Build edit order request

Source

pub fn build_get_positions_request( &mut self, currency: Option<&str>, kind: Option<&str>, ) -> JsonRpcRequest

Build a get_positions request

§Arguments
  • currency - Currency filter (BTC, ETH, USDC, etc.) - optional
  • kind - Kind filter (future, option, spot, etc.) - optional
§Returns

A JSON-RPC request for getting positions

Source

pub fn build_get_account_summary_request( &mut self, currency: &str, extended: Option<bool>, ) -> JsonRpcRequest

Build a get_account_summary request

§Arguments
  • currency - Currency to get summary for (BTC, ETH, USDC, etc.)
  • extended - Whether to include extended information
§Returns

A JSON-RPC request for getting account summary

Source

pub fn build_get_order_state_request( &mut self, order_id: &str, ) -> JsonRpcRequest

Build a get_order_state request

§Arguments
  • order_id - The order ID to get state for
§Returns

A JSON-RPC request for getting order state

Source

pub fn build_get_order_history_by_currency_request( &mut self, currency: &str, kind: Option<&str>, count: Option<u32>, ) -> JsonRpcRequest

Build a get_order_history_by_currency request

§Arguments
  • currency - Currency to get order history for
  • kind - Kind filter (future, option, spot, etc.) - optional
  • count - Number of items to return - optional
§Returns

A JSON-RPC request for getting order history

Source

pub fn build_close_position_request( &mut self, instrument_name: &str, order_type: &str, price: Option<f64>, ) -> JsonRpcRequest

Build a close_position request

§Arguments
  • instrument_name - The instrument to close position for
  • order_type - Order type: “limit” or “market”
  • price - Price for limit orders (required if order_type is “limit”)
§Returns

A JSON-RPC request for closing a position

Source

pub fn build_move_positions_request( &mut self, currency: &str, source_uid: u64, target_uid: u64, trades: &[MovePositionTrade], ) -> JsonRpcRequest

Build a move_positions request

§Arguments
  • currency - Currency for the positions (BTC, ETH, etc.)
  • source_uid - Source subaccount ID
  • target_uid - Target subaccount ID
  • trades - List of positions to move
§Returns

A JSON-RPC request for moving positions between subaccounts

Trait Implementations§

Source§

impl Clone for RequestBuilder

Source§

fn clone(&self) -> RequestBuilder

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RequestBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RequestBuilder

Source§

fn default() -> Self

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

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