DataClient

Struct DataClient 

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

Data API client

Implementations§

Source§

impl DataClient

Source

pub fn new() -> Self

Create a new Data API client

Source

pub async fn get_trades_by_event( &self, event_id: u64, limit: Option<usize>, offset: Option<usize>, filter_type: Option<&str>, filter_amount: Option<f64>, ) -> Result<Vec<DataTrade>>

Get trades for a specific event

Source

pub async fn get_trades_by_event_slug( &self, event_slug: &str, limit: Option<usize>, offset: Option<usize>, ) -> Result<Vec<DataTrade>>

Get trades for a specific event slug

Source

pub async fn get_trades_by_market( &self, condition_id: &str, limit: Option<usize>, offset: Option<usize>, ) -> Result<Vec<DataTrade>>

Get trades for a specific market (condition ID)

Source

pub async fn get_positions(&self, user_address: &str) -> Result<Vec<Position>>

Get user positions (requires authentication)

Source

pub async fn get_portfolio(&self, user_address: &str) -> Result<Portfolio>

Get portfolio for a user (requires authentication)

Source

pub async fn get_activity( &self, user_address: &str, limit: Option<usize>, offset: Option<usize>, market: Option<&str>, event_id: Option<u64>, activity_types: Option<Vec<ActivityType>>, start: Option<i64>, end: Option<i64>, sort_by: Option<ActivitySortBy>, sort_direction: Option<SortDirection>, side: Option<TradeSide>, ) -> Result<Vec<Activity>>

Get user activity (trades, splits, merges, redeems, rewards, conversions)

§Arguments
  • user_address - The user’s wallet address (0x-prefixed)
  • limit - Results per page (0-500, default 100)
  • offset - Pagination offset (0-10000, default 0)
  • market - Optional comma-separated condition IDs
  • event_id - Optional event ID (mutually exclusive with market)
  • activity_types - Optional filter by activity types
  • start - Optional start timestamp
  • end - Optional end timestamp
  • sort_by - Optional sort field (default: TIMESTAMP)
  • sort_direction - Optional sort direction (default: DESC)
  • side - Optional trade side filter
Source

pub async fn get_trades( &self, user_address: Option<&str>, market: Option<&str>, event_id: Option<u64>, limit: Option<usize>, offset: Option<usize>, taker_only: Option<bool>, filter_type: Option<&str>, filter_amount: Option<f64>, side: Option<TradeSide>, ) -> Result<Vec<DataTrade>>

Get trades with enhanced filtering options

§Arguments
  • user_address - Optional user wallet address
  • market - Optional comma-separated condition IDs
  • event_id - Optional event ID (mutually exclusive with market)
  • limit - Results per page (0-10000, default 100)
  • offset - Pagination offset (0-10000, default 0)
  • taker_only - Filter to taker-initiated trades (default true)
  • filter_type - Optional filter type (CASH or TOKENS)
  • filter_amount - Optional filter amount
  • side - Optional trade side filter
Source

pub async fn get_positions_filtered( &self, user_address: &str, market: Option<&str>, event_id: Option<u64>, size_threshold: Option<f64>, redeemable: Option<bool>, mergeable: Option<bool>, limit: Option<usize>, offset: Option<usize>, ) -> Result<Vec<Position>>

Get positions with enhanced filtering options

§Arguments
  • user_address - User wallet address
  • market - Optional comma-separated condition IDs
  • event_id - Optional event ID
  • size_threshold - Minimum position size (default 1)
  • redeemable - Filter redeemable positions
  • mergeable - Filter mergeable positions
  • limit - Results per page (0-500, default 100)
  • offset - Pagination offset (0-10000, default 0)

Trait Implementations§

Source§

impl Default for DataClient

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