pub enum TradingRequest {
PostOrder,
PostOrders {
count: u32,
},
CancelOrder,
CancelOrders {
count: u32,
},
CancelAll,
CancelMarketOrders,
}Expand description
A trading request, carrying whatever its token cost depends on.
Variants§
PostOrder
POST /order — always 1 token.
PostOrders
POST /orders — one token per order in the batch.
CancelOrder
DELETE /order — always 1 token.
CancelOrders
DELETE /orders — one token per submitted order ID.
CancelAll
DELETE /cancel-all — costs 1 + orders canceled.
The true cost is not knowable client-side; see TradingRequest::cost.
CancelMarketOrders
DELETE /cancel-market-orders — costs 1 + matching orders canceled.
The true cost is not knowable client-side; see TradingRequest::cost.
Implementations§
Source§impl TradingRequest
impl TradingRequest
Sourcepub fn bucket(self) -> TradingBucket
pub fn bucket(self) -> TradingBucket
Which bucket this request draws from.
Sourcepub fn cost(self) -> u32
pub fn cost(self) -> u32
The token cost, as far as the client can know it.
Exact for the four request kinds whose cost is a function of the payload.
For CancelAll and
CancelMarketOrders the published cost is
1 + orders canceled, and the client does not know how many orders are
open — so this returns the floor of 1. Those two can therefore overdraw
the real bucket, and a resulting 429 is genuine rather than a client bug.
Sourcepub fn cost_is_exact(self) -> bool
pub fn cost_is_exact(self) -> bool
Whether this request’s cost is exactly known client-side.
Only requests where this is true can be safely rejected before sending; the rest must be attempted and may come back 429.
Trait Implementations§
Source§impl Clone for TradingRequest
impl Clone for TradingRequest
Source§fn clone(&self) -> TradingRequest
fn clone(&self) -> TradingRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more