From 5f99308ab9d4223a31d7b313c3037a2551bf23d8 Mon Sep 17 00:00:00 2001 From: DevWonder01 Date: Mon, 20 Apr 2026 14:27:49 +0100 Subject: [PATCH 1/4] add : reduce only args into limit_buy/limit_sell --- src/futures/account.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/futures/account.rs b/src/futures/account.rs index a91c488e..5e4c3442 100644 --- a/src/futures/account.rs +++ b/src/futures/account.rs @@ -1,7 +1,6 @@ use std::collections::BTreeMap; use std::fmt::Display; - use crate::util::{build_signed_request, uuid_futures}; use crate::errors::Result; use crate::client::Client; @@ -248,6 +247,7 @@ impl FuturesAccount { pub fn limit_buy( &self, symbol: impl Into, qty: impl Into, price: f64, time_in_force: TimeInForce, + reduce_only : Option, ) -> Result { let buy = OrderRequest { symbol: symbol.into(), @@ -256,7 +256,7 @@ impl FuturesAccount { order_type: OrderType::Limit, time_in_force: Some(time_in_force), qty: Some(qty.into()), - reduce_only: None, + reduce_only: reduce_only, price: Some(price), stop_price: None, close_position: None, @@ -278,6 +278,7 @@ impl FuturesAccount { pub fn limit_sell( &self, symbol: impl Into, qty: impl Into, price: f64, time_in_force: TimeInForce, + reduce_only : Option ) -> Result { let sell = OrderRequest { symbol: symbol.into(), @@ -286,7 +287,7 @@ impl FuturesAccount { order_type: OrderType::Limit, time_in_force: Some(time_in_force), qty: Some(qty.into()), - reduce_only: None, + reduce_only: reduce_only, price: Some(price), stop_price: None, close_position: None, @@ -613,7 +614,7 @@ impl FuturesAccount { if let Some(API::Futures(Futures::AlgoOrder)) = api_type { parameters.insert("algoType".into(), "Conditional".into()); parameters.insert("clientAlgoId".into(), "Conditional".into()); - + if let Some(client_algo_id) = order.client_algo_id { parameters.insert("clientAlgoId".into(), client_algo_id.to_string()); } From e71efdb65a226961c608aff97673218d6d61afee Mon Sep 17 00:00:00 2001 From: DevWonder01 <55108486+DevWonder01@users.noreply.github.com> Date: Sat, 13 Jun 2026 11:43:53 +0100 Subject: [PATCH 2/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/futures/account.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/futures/account.rs b/src/futures/account.rs index 5e4c3442..2f63abbd 100644 --- a/src/futures/account.rs +++ b/src/futures/account.rs @@ -247,7 +247,7 @@ impl FuturesAccount { pub fn limit_buy( &self, symbol: impl Into, qty: impl Into, price: f64, time_in_force: TimeInForce, - reduce_only : Option, + reduce_only: Option, ) -> Result { let buy = OrderRequest { symbol: symbol.into(), From 6c3bbc0b255d22c5e9e59f77c6e1636c8a756e08 Mon Sep 17 00:00:00 2001 From: DevWonder01 Date: Sat, 18 Jul 2026 10:16:41 +0100 Subject: [PATCH 3/4] fix: add default_stop_price deserialization to cum_qty and cum_quote fields in futures models --- src/futures/model.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/futures/model.rs b/src/futures/model.rs index e6debac4..23d9e29c 100644 --- a/src/futures/model.rs +++ b/src/futures/model.rs @@ -212,7 +212,7 @@ pub struct Order { pub client_order_id: String, #[serde(with = "string_or_float", default = "default_stop_price")] pub cum_qty: f64, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub cum_quote: f64, #[serde(with = "string_or_float")] pub executed_qty: f64, @@ -248,9 +248,9 @@ pub struct Order { #[serde(rename_all = "camelCase")] pub struct Transaction { pub client_order_id: String, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub cum_qty: f64, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub cum_quote: f64, #[serde(with = "string_or_float")] pub executed_qty: f64, @@ -286,9 +286,9 @@ pub struct Transaction { #[serde(rename_all = "camelCase")] pub struct CanceledOrder { pub client_order_id: String, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub cum_qty: f64, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub cum_quote: f64, #[serde(with = "string_or_float")] pub executed_qty: f64, From 0c2c6fd051df76cba9b627ef170aa34cc3081916 Mon Sep 17 00:00:00 2001 From: DevWonder01 Date: Sat, 18 Jul 2026 10:34:27 +0100 Subject: [PATCH 4/4] fix: add default stop_price deserialization attribute to futures model fields --- src/futures/model.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/futures/model.rs b/src/futures/model.rs index 23d9e29c..514f44d4 100644 --- a/src/futures/model.rs +++ b/src/futures/model.rs @@ -214,14 +214,14 @@ pub struct Order { pub cum_qty: f64, #[serde(with = "string_or_float", default = "default_stop_price")] pub cum_quote: f64, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub executed_qty: f64, pub order_id: u64, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub avg_price: f64, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub orig_qty: f64, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub price: f64, pub side: String, pub reduce_only: bool, @@ -252,18 +252,18 @@ pub struct Transaction { pub cum_qty: f64, #[serde(with = "string_or_float", default = "default_stop_price")] pub cum_quote: f64, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub executed_qty: f64, pub order_id: u64, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub avg_price: f64, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub orig_qty: f64, pub reduce_only: bool, pub side: String, pub position_side: String, pub status: String, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub stop_price: f64, pub close_position: bool, pub symbol: String, @@ -290,19 +290,19 @@ pub struct CanceledOrder { pub cum_qty: f64, #[serde(with = "string_or_float", default = "default_stop_price")] pub cum_quote: f64, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub executed_qty: f64, pub order_id: u64, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub orig_qty: f64, pub orig_type: String, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub price: f64, pub reduce_only: bool, pub side: String, pub position_side: String, pub status: String, - #[serde(with = "string_or_float")] + #[serde(with = "string_or_float", default = "default_stop_price")] pub stop_price: f64, pub close_position: bool, pub symbol: String,