pub struct DataClient { /* private fields */ }Available on crate feature
client only.Expand description
Data API client for trader data, positions, and leaderboards
Implementations§
Source§impl DataClient
impl DataClient
Sourcepub fn new(config: DataConfig) -> Result<Self>
pub fn new(config: DataConfig) -> Result<Self>
Create a new Data API client
Sourcepub fn with_defaults() -> Result<Self>
pub fn with_defaults() -> Result<Self>
Create client with default configuration
Sourcepub fn from_env() -> Result<Self>
👎Deprecated since 0.1.0: Use DataClient::with_defaults() instead
pub fn from_env() -> Result<Self>
Create client from environment variables.
Deprecated: Use DataClient::with_defaults() instead.
Sourcepub async fn get_trader_profile(&self, address: &str) -> Result<DataApiTrader>
pub async fn get_trader_profile(&self, address: &str) -> Result<DataApiTrader>
Get trader profile by wallet address
Sourcepub async fn get_positions(&self, address: &str) -> Result<Vec<DataApiPosition>>
pub async fn get_positions(&self, address: &str) -> Result<Vec<DataApiPosition>>
Get positions for a wallet address
Sourcepub async fn get_trades(
&self,
address: &str,
limit: Option<u32>,
) -> Result<Vec<DataApiTrade>>
pub async fn get_trades( &self, address: &str, limit: Option<u32>, ) -> Result<Vec<DataApiTrade>>
Get trades for a wallet address
Sourcepub async fn get_user_activity(
&self,
address: &str,
limit: Option<u32>,
offset: Option<u32>,
) -> Result<Vec<DataApiActivity>>
pub async fn get_user_activity( &self, address: &str, limit: Option<u32>, offset: Option<u32>, ) -> Result<Vec<DataApiActivity>>
Get user activity (trades, position changes)
Sourcepub async fn get_closed_positions(
&self,
address: &str,
limit: Option<u32>,
offset: Option<u32>,
) -> Result<Vec<ClosedPosition>>
pub async fn get_closed_positions( &self, address: &str, limit: Option<u32>, offset: Option<u32>, ) -> Result<Vec<ClosedPosition>>
Get closed positions for a user (for PnL calculation)
Sourcepub async fn get_biggest_winners(
&self,
query: &BiggestWinnersQuery,
) -> Result<Vec<BiggestWinner>>
pub async fn get_biggest_winners( &self, query: &BiggestWinnersQuery, ) -> Result<Vec<BiggestWinner>>
Get biggest winners by category and time period
Sourcepub async fn get_top_biggest_winners(
&self,
category: &str,
time_period: &str,
total_limit: usize,
) -> Result<Vec<BiggestWinner>>
pub async fn get_top_biggest_winners( &self, category: &str, time_period: &str, total_limit: usize, ) -> Result<Vec<BiggestWinner>>
Get top biggest winners with auto-pagination
Fetches winners in batches of 100 until reaching total_limit
Sourcepub async fn get_token_midpoint(&self, token_id: &str) -> Result<f64>
pub async fn get_token_midpoint(&self, token_id: &str) -> Result<f64>
Get token midpoint price from CLOB
Sourcepub async fn get_order_book(&self, token_id: &str) -> Result<Value>
pub async fn get_order_book(&self, token_id: &str) -> Result<Value>
Get order book for a token
Trait Implementations§
Source§impl Clone for DataClient
impl Clone for DataClient
Source§fn clone(&self) -> DataClient
fn clone(&self) -> DataClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DataClient
impl !RefUnwindSafe for DataClient
impl Send for DataClient
impl Sync for DataClient
impl Unpin for DataClient
impl !UnwindSafe for DataClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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