bybit/models/fee_group_info_request.rs
1use crate::prelude::*;
2
3/// Parameters for requesting fee group information.
4///
5/// This struct defines the parameters for querying fee group structure and fee rates via Bybit's `/v5/market/fee-group-info` endpoint.
6/// The new grouped fee structure only applies to Pro-level and Market Maker clients and does not apply to retail traders.
7#[derive(Clone, Default)]
8pub struct FeeGroupInfoRequest<'a> {
9 /// The product type. Currently only "contract" is supported.
10 ///
11 /// Specifies the type of instrument for the fee group data. According to the API documentation,
12 /// only "contract" is accepted as a value for this parameter.
13 pub product_type: Cow<'a, str>,
14
15 /// The group ID. Optional parameter to filter by specific fee group.
16 ///
17 /// Valid values are: "1", "2", "3", "4", "5", "6", "7", "8".
18 /// If not specified, returns information for all fee groups.
19 pub group_id: Option<Cow<'a, str>>,
20}
21
22impl<'a> FeeGroupInfoRequest<'a> {
23 /// Creates a default fee group info request for contracts.
24 ///
25 /// Returns a `FeeGroupInfoRequest` with `product_type` set to `"contract"` and no group ID filter.
26 /// This is the standard request for getting all fee group information for contracts.
27 pub fn default() -> FeeGroupInfoRequest<'a> {
28 FeeGroupInfoRequest::new("contract", None)
29 }
30
31 /// Constructs a new fee group info request with specified parameters.
32 ///
33 /// # Arguments
34 /// * `product_type` - The product type (currently only "contract" is valid)
35 /// * `group_id` - Optional group ID to filter by specific fee group
36 pub fn new(product_type: &'a str, group_id: Option<&'a str>) -> FeeGroupInfoRequest<'a> {
37 FeeGroupInfoRequest {
38 product_type: Cow::Borrowed(product_type),
39 group_id: group_id.map(Cow::Borrowed),
40 }
41 }
42
43 /// Constructs a new fee group info request for a specific group ID.
44 ///
45 /// # Arguments
46 /// * `group_id` - The group ID to filter by (e.g., "1", "2", etc.)
47 pub fn with_group_id(group_id: &'a str) -> FeeGroupInfoRequest<'a> {
48 FeeGroupInfoRequest {
49 product_type: Cow::Borrowed("contract"),
50 group_id: Some(Cow::Borrowed(group_id)),
51 }
52 }
53}