Skip to main content

NewOrderExt

Trait NewOrderExt 

Source
pub trait NewOrderExt {
    // Required methods
    fn limit(price: PositiveDecimal, size: PositiveDecimal, side: Side) -> Self;
    fn post_only(
        price: PositiveDecimal,
        size: PositiveDecimal,
        side: Side,
    ) -> Self;
    fn ioc(price: PositiveDecimal, size: PositiveDecimal, side: Side) -> Self;
}
Expand description

Extension constructors for NewOrderArgs.

Removes the 4-field boilerplate from simple orders. For advanced fields (reduce_only, client_order_id, pending_tpsl_pair), construct NewOrderArgs directly.

use bullet_rust_sdk::*;

let order = NewOrderArgs::limit(price, size, Side::Bid);
client.place_orders(market_id, vec![order], false, None).await?;

Required Methods§

Source

fn limit(price: PositiveDecimal, size: PositiveDecimal, side: Side) -> Self

Create a limit order. Defaults: reduce_only: false, no client order ID, no TP/SL.

Source

fn post_only(price: PositiveDecimal, size: PositiveDecimal, side: Side) -> Self

Create a post-only (maker) order. Rejected if it would cross the book.

Source

fn ioc(price: PositiveDecimal, size: PositiveDecimal, side: Side) -> Self

Create an immediate-or-cancel order (market-order equivalent).

Fills what it can at the given price, cancels the rest.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§