binance_async/rest/usdm/
trade.rs

1use crate::models::{
2    CanceledOrder, NewOrderResponseType, OrderSide, OrderType, PositionSide, Product, TimeInForce,
3    WorkingType,
4};
5use reqwest::Method;
6use rust_decimal::Decimal;
7
8crate::define_request! {
9    Name => NewOrder;
10    Product => Product::UsdMFutures;
11    Endpoint => "/fapi/v1/order";
12    Method => Method::POST;
13    Signed => true;
14    Request => {
15        pub symbol: String,
16        pub side: OrderSide,
17        pub position_side: Option<PositionSide>,
18        pub r#type: OrderType,
19        pub time_in_force: Option<TimeInForce>,
20        pub quantity: Option<Decimal>,
21        pub reduce_only: Option<bool>,
22        pub price: Option<Decimal>,
23        pub new_client_order_id: Option<String>,
24        pub stop_price: Option<Decimal>,
25        pub close_position: Option<bool>,
26        pub activation_price: Option<Decimal>,
27        pub callback_rate: Option<Decimal>,
28        pub working_type: Option<WorkingType>,
29        pub price_protect: Option<Decimal>,
30        pub new_order_resp_type: Option<NewOrderResponseType>,
31    };
32    Response => CanceledOrder;
33}
34
35crate::define_request! {
36    Name => CancelOrder;
37    Product => Product::UsdMFutures;
38    Endpoint => "/fapi/v1/order";
39    Method => Method::DELETE;
40    Signed => true;
41    Request => {
42        pub symbol: String,
43        pub order_id: Option<u64>,
44        pub orig_client_order_id: Option<String>
45    };
46    Response => CanceledOrder;
47}
48
49crate::define_request! {
50    Name => CancelMultipleOrders;
51    Product => Product::UsdMFutures;
52    Endpoint => "/fapi/v1/batchOrders";
53    Method => Method::DELETE;
54    Signed => true;
55    Request => {
56        pub symbol: String,
57        pub order_id_list: Vec<u64>,
58        pub orig_client_order_id_list: Vec<String>,
59    };
60    Response => Vec<CanceledOrder>;
61}