|
|
@@ -305,7 +305,7 @@ impl Platform for BitgetSpot {
|
|
|
avg_price: Decimal::ZERO,
|
|
|
status: "NEW".to_string(),
|
|
|
order_type: "".to_string(),
|
|
|
- trace_stack: TraceStack::default().on_special("310 bitget_spot".to_string()),
|
|
|
+ trace_stack: TraceStack::default().on_special("308 bitget_spot".to_string()),
|
|
|
};
|
|
|
Ok(result)
|
|
|
} else {
|
|
|
@@ -357,7 +357,7 @@ impl Platform for BitgetSpot {
|
|
|
avg_price: Decimal::ZERO,
|
|
|
status: "NEW".to_string(),
|
|
|
order_type: "".to_string(),
|
|
|
- trace_stack: TraceStack::default().on_special("357 bitget_spot".to_string()),
|
|
|
+ trace_stack: TraceStack::default().on_special("360 bitget_spot".to_string()),
|
|
|
};
|
|
|
Ok(result)
|
|
|
} else {
|
|
|
@@ -380,7 +380,7 @@ impl Platform for BitgetSpot {
|
|
|
avg_price: Decimal::ZERO,
|
|
|
status: "REMOVE".to_string(),
|
|
|
order_type: "".to_string(),
|
|
|
- trace_stack: TraceStack::default().on_special("380 bitget_spot".to_string()),
|
|
|
+ trace_stack: TraceStack::default().on_special("383 bitget_spot".to_string()),
|
|
|
};
|
|
|
Ok(result)
|
|
|
} else {
|
|
|
@@ -390,31 +390,37 @@ impl Platform for BitgetSpot {
|
|
|
|
|
|
async fn cancel_orders(&mut self) -> Result<Vec<Order>, Error> {
|
|
|
let symbol_format = utils::format_symbol(self.symbol.clone(), "");
|
|
|
- let res_data = self.request.spot_cancel_symbol_orders(symbol_format.to_string()).await;
|
|
|
- if res_data.code == "200" {
|
|
|
- // 1. 获取当前委托列表
|
|
|
- // 2. 取消委托列表,不然就不会传详情回来
|
|
|
-
|
|
|
- // let res_data_str = &res_data.data;
|
|
|
- // let res_data_json: serde_json::Value = serde_json::from_str(res_data_str).unwrap();
|
|
|
- // info!(?res_data);
|
|
|
- // let order_info_list: Vec<serde_json::Value> = res_data_json["successList"].as_array().unwrap().clone();
|
|
|
- // let result = order_info_list.iter().map(|item|
|
|
|
- // Order {
|
|
|
- // id: item["orderId"].as_str().unwrap().to_string(),
|
|
|
- // custom_id: item["clientOid"].as_str().unwrap().to_string(),
|
|
|
- // price: Decimal::ZERO,
|
|
|
- // amount: Decimal::ZERO,
|
|
|
- // deal_amount: Decimal::ZERO,
|
|
|
- // avg_price: Decimal::ZERO,
|
|
|
- // status: "REMOVE".to_string(),
|
|
|
- // order_type: "".to_string(),
|
|
|
- // trace_stack: TraceStack::default().on_special("405 bitget_spot".to_string()),
|
|
|
- // }
|
|
|
- // ).collect();
|
|
|
- Ok(vec![])
|
|
|
+ let orders_res_data = self.request.get_unfilled_orders(symbol_format.to_string(), "".to_string(), "".to_string(), "".to_string(), "100".to_string(), "".to_string()).await;
|
|
|
+ if orders_res_data.code == "200" {
|
|
|
+ let mut result = vec![];
|
|
|
+ let orders_res_data_str = &orders_res_data.data;
|
|
|
+ let orders_res_data_json: Vec<serde_json::Value> = serde_json::from_str(orders_res_data_str).unwrap();
|
|
|
+ for order in orders_res_data_json {
|
|
|
+ let cancel_symbol = order["symbol"].as_str().unwrap().to_uppercase();
|
|
|
+ let cancel_res_data = self.request.spot_cancel_symbol_orders(cancel_symbol).await;
|
|
|
+ if cancel_res_data.code == "200" {
|
|
|
+ let cancel_res_data_str = &cancel_res_data.data;
|
|
|
+ let cancel_res_data_json: Vec<serde_json::Value> = serde_json::from_str(cancel_res_data_str).unwrap();
|
|
|
+ for cancel in cancel_res_data_json {
|
|
|
+ result.push(Order {
|
|
|
+ id: cancel["orderId"].as_str().unwrap().to_string(),
|
|
|
+ custom_id: cancel["clientOid"].as_str().unwrap().to_string(),
|
|
|
+ price: Decimal::ZERO,
|
|
|
+ amount: Decimal::ZERO,
|
|
|
+ deal_amount: Decimal::ZERO,
|
|
|
+ avg_price: Decimal::ZERO,
|
|
|
+ status: "REMOVE".to_string(),
|
|
|
+ order_type: "".to_string(),
|
|
|
+ trace_stack: TraceStack::default().on_special("414 bitget_spot".to_string()),
|
|
|
+ });
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ return Err(Error::new(ErrorKind::Other, cancel_res_data.to_string()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Ok(result)
|
|
|
} else {
|
|
|
- Err(Error::new(ErrorKind::Other, res_data.to_string()))
|
|
|
+ Err(Error::new(ErrorKind::Other, orders_res_data.to_string()))
|
|
|
}
|
|
|
}
|
|
|
|