pub struct OrderSubmitter { /* private fields */ }Implementations§
Source§impl OrderSubmitter
impl OrderSubmitter
pub fn new( grpc_client: DydxGrpcClient, wallet_address: String, subaccount_number: u32, ) -> Self
Sourcepub async fn submit_market_order(
&self,
_wallet: &Wallet,
client_order_id: u32,
side: OrderSide,
quantity: Quantity,
_block_height: u32,
) -> Result<(), DydxError>
pub async fn submit_market_order( &self, _wallet: &Wallet, client_order_id: u32, side: OrderSide, quantity: Quantity, _block_height: u32, ) -> Result<(), DydxError>
Submits a market order to dYdX via gRPC.
Market orders execute immediately at the best available price.
§Errors
Returns DydxError if gRPC submission fails.
Sourcepub async fn submit_limit_order(
&self,
_wallet: &Wallet,
client_order_id: u32,
side: OrderSide,
price: Price,
quantity: Quantity,
time_in_force: TimeInForce,
post_only: bool,
reduce_only: bool,
_block_height: u32,
_expire_time: Option<i64>,
) -> Result<(), DydxError>
pub async fn submit_limit_order( &self, _wallet: &Wallet, client_order_id: u32, side: OrderSide, price: Price, quantity: Quantity, time_in_force: TimeInForce, post_only: bool, reduce_only: bool, _block_height: u32, _expire_time: Option<i64>, ) -> Result<(), DydxError>
Submits a limit order to dYdX via gRPC.
Limit orders execute only at the specified price or better.
§Errors
Returns DydxError if gRPC submission fails.
Sourcepub async fn cancel_order(
&self,
_wallet: &Wallet,
client_order_id: u32,
_block_height: u32,
) -> Result<(), DydxError>
pub async fn cancel_order( &self, _wallet: &Wallet, client_order_id: u32, _block_height: u32, ) -> Result<(), DydxError>
Sourcepub async fn cancel_orders_batch(
&self,
_wallet: &Wallet,
client_order_ids: &[u32],
_block_height: u32,
) -> Result<(), DydxError>
pub async fn cancel_orders_batch( &self, _wallet: &Wallet, client_order_ids: &[u32], _block_height: u32, ) -> Result<(), DydxError>
Cancels multiple orders via individual gRPC transactions.
dYdX v4 requires separate blockchain transactions for each cancellation.
§Errors
Returns DydxError if any gRPC cancellation fails.
Sourcepub async fn submit_stop_market_order(
&self,
_wallet: &Wallet,
_client_order_id: u32,
_side: OrderSide,
_trigger_price: Price,
_quantity: Quantity,
_reduce_only: bool,
_block_height: u32,
_expire_time: Option<i64>,
) -> Result<(), DydxError>
pub async fn submit_stop_market_order( &self, _wallet: &Wallet, _client_order_id: u32, _side: OrderSide, _trigger_price: Price, _quantity: Quantity, _reduce_only: bool, _block_height: u32, _expire_time: Option<i64>, ) -> Result<(), DydxError>
Submits a stop market order to dYdX via gRPC.
§Errors
Returns DydxError::NotImplemented until conditional order support is added.
Sourcepub async fn submit_stop_limit_order(
&self,
_wallet: &Wallet,
_client_order_id: u32,
_side: OrderSide,
_trigger_price: Price,
_limit_price: Price,
_quantity: Quantity,
_time_in_force: TimeInForce,
_post_only: bool,
_reduce_only: bool,
_block_height: u32,
_expire_time: Option<i64>,
) -> Result<(), DydxError>
pub async fn submit_stop_limit_order( &self, _wallet: &Wallet, _client_order_id: u32, _side: OrderSide, _trigger_price: Price, _limit_price: Price, _quantity: Quantity, _time_in_force: TimeInForce, _post_only: bool, _reduce_only: bool, _block_height: u32, _expire_time: Option<i64>, ) -> Result<(), DydxError>
Submits a stop limit order to dYdX via gRPC.
§Errors
Returns DydxError::NotImplemented until conditional order support is added.
Sourcepub async fn submit_take_profit_market_order(
&self,
_wallet: &Wallet,
_client_order_id: u32,
_side: OrderSide,
_trigger_price: Price,
_quantity: Quantity,
_reduce_only: bool,
_block_height: u32,
_expire_time: Option<i64>,
) -> Result<(), DydxError>
pub async fn submit_take_profit_market_order( &self, _wallet: &Wallet, _client_order_id: u32, _side: OrderSide, _trigger_price: Price, _quantity: Quantity, _reduce_only: bool, _block_height: u32, _expire_time: Option<i64>, ) -> Result<(), DydxError>
Submits a take profit market order to dYdX via gRPC.
§Errors
Returns DydxError::NotImplemented until conditional order support is added.
Sourcepub async fn submit_take_profit_limit_order(
&self,
_wallet: &Wallet,
_client_order_id: u32,
_side: OrderSide,
_trigger_price: Price,
_limit_price: Price,
_quantity: Quantity,
_time_in_force: TimeInForce,
_post_only: bool,
_reduce_only: bool,
_block_height: u32,
_expire_time: Option<i64>,
) -> Result<(), DydxError>
pub async fn submit_take_profit_limit_order( &self, _wallet: &Wallet, _client_order_id: u32, _side: OrderSide, _trigger_price: Price, _limit_price: Price, _quantity: Quantity, _time_in_force: TimeInForce, _post_only: bool, _reduce_only: bool, _block_height: u32, _expire_time: Option<i64>, ) -> Result<(), DydxError>
Submits a take profit limit order to dYdX via gRPC.
§Errors
Returns DydxError::NotImplemented until conditional order support is added.
Sourcepub async fn submit_trailing_stop_order(
&self,
_wallet: &Wallet,
_client_order_id: u32,
_side: OrderSide,
_trailing_offset: Price,
_quantity: Quantity,
_reduce_only: bool,
_block_height: u32,
_expire_time: Option<i64>,
) -> Result<(), DydxError>
pub async fn submit_trailing_stop_order( &self, _wallet: &Wallet, _client_order_id: u32, _side: OrderSide, _trailing_offset: Price, _quantity: Quantity, _reduce_only: bool, _block_height: u32, _expire_time: Option<i64>, ) -> Result<(), DydxError>
Submits a trailing stop order to dYdX via gRPC.
§Errors
Returns DydxError::NotImplemented - trailing stops not yet supported by dYdX v4 protocol.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OrderSubmitter
impl RefUnwindSafe for OrderSubmitter
impl Send for OrderSubmitter
impl Sync for OrderSubmitter
impl Unpin for OrderSubmitter
impl UnwindSafe for OrderSubmitter
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<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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].