pub struct OrderRequestState { /* private fields */ }Implementations§
Source§impl OrderRequestState
impl OrderRequestState
Sourcepub fn new(
cmd_tx_handle: Arc<RwLock<UnboundedSender<SpotHandlerCommand>>>,
event_tx: UnboundedSender<OrderEventAny>,
dispatch_state: Arc<WsDispatchState>,
req_id_counter: Arc<AtomicU64>,
timeout: Duration,
trader_id: TraderId,
account_id: AccountId,
auth_token: Arc<RwLock<Option<String>>>,
cancellation_token: CancellationToken,
clock: &'static AtomicTime,
) -> Self
pub fn new( cmd_tx_handle: Arc<RwLock<UnboundedSender<SpotHandlerCommand>>>, event_tx: UnboundedSender<OrderEventAny>, dispatch_state: Arc<WsDispatchState>, req_id_counter: Arc<AtomicU64>, timeout: Duration, trader_id: TraderId, account_id: AccountId, auth_token: Arc<RwLock<Option<String>>>, cancellation_token: CancellationToken, clock: &'static AtomicTime, ) -> Self
Creates a new OrderRequestState.
Sourcepub fn next_req_id(&self) -> u64
pub fn next_req_id(&self) -> u64
Returns the next request ID and advances the counter.
Sourcepub fn submit(
self: &Arc<Self>,
params: KrakenWsAddOrderParams,
identity: PendingRequest,
ts_now_ns: u64,
) -> Result<u64>
pub fn submit( self: &Arc<Self>, params: KrakenWsAddOrderParams, identity: PendingRequest, ts_now_ns: u64, ) -> Result<u64>
Sends an add_order request over the WebSocket transport.
§Errors
Returns an error if the JSON envelope fails to serialise or if the handler command channel is closed.
Sourcepub fn amend(
self: &Arc<Self>,
params: KrakenWsAmendOrderParams,
identity: PendingRequest,
ts_now_ns: u64,
) -> Result<u64>
pub fn amend( self: &Arc<Self>, params: KrakenWsAmendOrderParams, identity: PendingRequest, ts_now_ns: u64, ) -> Result<u64>
Sends an amend_order request over the WebSocket transport.
§Errors
Returns an error if serialisation fails or the handler command channel is closed.
Sourcepub fn cancel(
self: &Arc<Self>,
params: KrakenWsCancelOrderParams,
identity: PendingRequest,
ts_now_ns: u64,
) -> Result<u64>
pub fn cancel( self: &Arc<Self>, params: KrakenWsCancelOrderParams, identity: PendingRequest, ts_now_ns: u64, ) -> Result<u64>
Sends a cancel_order request over the WebSocket transport.
§Errors
Returns an error if serialisation fails or the handler command channel is closed.
Sourcepub fn batch_add(
self: &Arc<Self>,
params: KrakenWsBatchAddParams,
identity: PendingRequest,
ts_now_ns: u64,
) -> Result<u64>
pub fn batch_add( self: &Arc<Self>, params: KrakenWsBatchAddParams, identity: PendingRequest, ts_now_ns: u64, ) -> Result<u64>
Sends a batch_add request over the WebSocket transport.
§Errors
Returns an error if serialisation fails or the handler command channel is closed.
Sourcepub fn handle_response(
&self,
response: &KrakenWsOrderResponse,
ts_event_ns: u64,
)
pub fn handle_response( &self, response: &KrakenWsOrderResponse, ts_event_ns: u64, )
Routes an order-method WebSocket response to the correct event emitter.
ts_event_ns is the local receipt time. Kraken’s time_in/time_out
are ignored to keep event ordering monotonic against the local clock.
Late responses (after timeout eviction) are logged and dropped.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for OrderRequestState
impl !UnwindSafe for OrderRequestState
impl Freeze for OrderRequestState
impl Send for OrderRequestState
impl Sync for OrderRequestState
impl Unpin for OrderRequestState
impl UnsafeUnpin for OrderRequestState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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