Skip to main content

bybit/models/
batch_place_request.rs

1use crate::prelude::*;
2
3/// Parameters for batch placing multiple orders.
4///
5/// Used to construct a request to the `/v5/order/create-batch` endpoint to place multiple orders simultaneously. This is useful for bots executing complex strategies, such as placing multiple limit orders at different price levels in perpetual futures.
6#[derive(Clone, Default)]
7pub struct BatchPlaceRequest<'a> {
8    /// The product category (e.g., Linear, Inverse).
9    ///
10    /// Specifies the instrument type. Bots must set this to target the correct contract type for the batch orders.
11    pub category: Category,
12
13    /// A list of order requests to place.
14    ///
15    /// Contains the individual order details, such as symbol, price, and quantity. Bots should populate this with valid `OrderRequest` structs to execute multiple orders efficiently.
16    pub requests: Vec<OrderRequest<'a>>,
17}
18
19impl<'a> BatchPlaceRequest<'a> {
20    /// Constructs a new BatchPlace request with specified parameters.
21    ///
22    /// Allows customization of the batch order request. Bots should use this to define the category and list of orders to place.
23    pub fn new(category: Category, requests: Vec<OrderRequest<'a>>) -> BatchPlaceRequest<'a> {
24        BatchPlaceRequest { category, requests }
25    }
26}