@@ -131,7 +131,7 @@ fn build_order_body(
131131 if let Some ( t) = tif { body[ "timeInForce" ] = Value :: String ( t) ; }
132132 if let Some ( e) = exec_inst { body[ "execInst" ] = Value :: String ( e) ; }
133133 if let Some ( c) = cl_ord_id { body[ "clOrdID" ] = Value :: String ( c) ; }
134- if let Some ( t ) = text { body[ "text" ] = Value :: String ( t ) ; }
134+ body[ "text" ] = Value :: String ( text . unwrap_or_else ( || "Submitted via CLI." . to_string ( ) ) ) ;
135135 body
136136}
137137
@@ -179,7 +179,7 @@ pub(crate) async fn run(
179179 if let Some ( v) = qty { body[ "orderQty" ] = json ! ( v) ; }
180180 if let Some ( v) = price { body[ "price" ] = json ! ( v) ; }
181181 if let Some ( v) = stop_px { body[ "stopPx" ] = json ! ( v) ; }
182- if let Some ( v ) = text { body[ "text" ] = Value :: String ( v ) ; }
182+ body[ "text" ] = Value :: String ( text . unwrap_or_else ( || "Amended via CLI." . to_string ( ) ) ) ;
183183 let val = client. put ( "/order" , & body, creds) . await ?;
184184 Ok ( CommandOutput :: from_json ( val) )
185185 }
@@ -191,7 +191,7 @@ pub(crate) async fn run(
191191 let mut body = json ! ( { } ) ;
192192 if let Some ( v) = order_id { body[ "orderID" ] = Value :: String ( v) ; }
193193 if let Some ( v) = cl_ord_id { body[ "clOrdID" ] = Value :: String ( v) ; }
194- if let Some ( v ) = text { body[ "text" ] = Value :: String ( v ) ; }
194+ body[ "text" ] = Value :: String ( text . unwrap_or_else ( || "Canceled via CLI." . to_string ( ) ) ) ;
195195 let val = client. delete ( "/order" , "" , Some ( & body) , creds) . await ?;
196196 Ok ( CommandOutput :: from_json ( val) )
197197 }
@@ -202,7 +202,7 @@ pub(crate) async fn run(
202202 }
203203 let mut body = json ! ( { } ) ;
204204 if let Some ( v) = symbol { body[ "symbol" ] = Value :: String ( v) ; }
205- if let Some ( v ) = text { body[ "text" ] = Value :: String ( v ) ; }
205+ body[ "text" ] = Value :: String ( text . unwrap_or_else ( || "Canceled via CLI." . to_string ( ) ) ) ;
206206 let val = client. delete ( "/order/all" , "" , Some ( & body) , creds) . await ?;
207207 Ok ( CommandOutput :: from_json ( val) )
208208 }
0 commit comments