pub struct ClientAccount {
pub latency: Duration,
pub fees_percent: f64,
pub event_account_tx: UnboundedSender<AccountEvent>,
pub balances: ClientBalances,
pub orders: ClientOrders,
}Expand description
Simulated account state containing ClientBalances and ClientOrders. Details the
simulated account fees and latency.
Fields§
§latency: Duration§fees_percent: f64§event_account_tx: UnboundedSender<AccountEvent>§balances: ClientBalances§orders: ClientOrdersImplementations§
source§impl ClientAccount
impl ClientAccount
sourcepub fn builder() -> ClientAccountBuilder
pub fn builder() -> ClientAccountBuilder
Construct a ClientAccountBuilder for configuring a new ClientAccount.
sourcepub fn fetch_orders_open(
&self,
response_tx: Sender<Result<Vec<Order<Open>>, ExecutionError>>,
)
pub fn fetch_orders_open( &self, response_tx: Sender<Result<Vec<Order<Open>>, ExecutionError>>, )
Send every Order<Open> for every Instrument to the client.
sourcepub fn fetch_balances(
&self,
response_tx: Sender<Result<Vec<SymbolBalance>, ExecutionError>>,
)
pub fn fetch_balances( &self, response_tx: Sender<Result<Vec<SymbolBalance>, ExecutionError>>, )
sourcepub fn open_orders(
&mut self,
open_requests: Vec<Order<RequestOpen>>,
response_tx: Sender<Vec<Result<Order<Open>, ExecutionError>>>,
)
pub fn open_orders( &mut self, open_requests: Vec<Order<RequestOpen>>, response_tx: Sender<Vec<Result<Order<Open>, ExecutionError>>>, )
Execute open order requests and send the response via the provided oneshot::Sender.
sourcepub fn try_open_order_atomic(
&mut self,
request: Order<RequestOpen>,
) -> Result<Order<Open>, ExecutionError>
pub fn try_open_order_atomic( &mut self, request: Order<RequestOpen>, ) -> Result<Order<Open>, ExecutionError>
Execute an open order request, adding it to ClientOrders and updating the associated
Balance. Sends an AccountEvent for both the new order and balance update.
sourcepub fn check_order_kind_support(kind: OrderKind) -> Result<(), ExecutionError>
pub fn check_order_kind_support(kind: OrderKind) -> Result<(), ExecutionError>
Check if the Order<RequestOpen> OrderKind is supported.
sourcepub fn cancel_orders(
&mut self,
cancel_requests: Vec<Order<RequestCancel>>,
response_tx: Sender<Vec<Result<Order<Cancelled>, ExecutionError>>>,
)
pub fn cancel_orders( &mut self, cancel_requests: Vec<Order<RequestCancel>>, response_tx: Sender<Vec<Result<Order<Cancelled>, ExecutionError>>>, )
Execute cancel order requests and send the response via the provided oneshot::Sender.
sourcepub fn try_cancel_order_atomic(
&mut self,
request: Order<RequestCancel>,
) -> Result<Order<Cancelled>, ExecutionError>
pub fn try_cancel_order_atomic( &mut self, request: Order<RequestCancel>, ) -> Result<Order<Cancelled>, ExecutionError>
Execute a cancel order request, removing it from the ClientOrders and updating the
associated Balance. Sends an AccountEvent for both the order cancel and balance
update.
sourcepub fn cancel_orders_all(
&mut self,
response_tx: Sender<Result<Vec<Order<Cancelled>>, ExecutionError>>,
)
pub fn cancel_orders_all( &mut self, response_tx: Sender<Result<Vec<Order<Cancelled>>, ExecutionError>>, )
Execute a cancel all orders request and send the response via the provided
oneshot::Sender.
sourcepub fn match_orders(&mut self, instrument: Instrument, trade: PublicTrade)
pub fn match_orders(&mut self, instrument: Instrument, trade: PublicTrade)
Determine if the incoming PublicTrade liquidity matches any ClientOrders relating
to the Instrument. If there are matches, trades are simulated by client orders being
taken.
Trait Implementations§
source§impl Clone for ClientAccount
impl Clone for ClientAccount
source§fn clone(&self) -> ClientAccount
fn clone(&self) -> ClientAccount
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ClientAccount
impl RefUnwindSafe for ClientAccount
impl Send for ClientAccount
impl Sync for ClientAccount
impl Unpin for ClientAccount
impl UnwindSafe for ClientAccount
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)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>
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>
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