|
|
@@ -467,6 +467,7 @@ impl Platform for CoinexSwap {
|
|
|
// info!("cancel_order {} order_id {} custom_id {}", res_data_json, order_id, custom_id);
|
|
|
let mut result = format_order_item(res_data_json, ct_val, "canceled");
|
|
|
result.custom_id = custom_id.to_string();
|
|
|
+ result.id = order_id.to_string();
|
|
|
Ok(result)
|
|
|
} else {
|
|
|
let message = format!("撤单HTTP请求失败 order_id: {}, custom_id: {}, res_data: {:?}", order_id, custom_id, res_data);
|
|
|
@@ -684,11 +685,21 @@ pub fn format_order_item(order: Value, ct_val: Decimal, status :&str) -> Order {
|
|
|
trace_stack: TraceStack::new(0, Instant::now()).on_special("688 trace_stack".to_string()),
|
|
|
}
|
|
|
}
|
|
|
+ let size;
|
|
|
+ match order["amount"].as_str() {
|
|
|
+ Some(val) => {
|
|
|
+ size = Decimal::from_str(val).unwrap()
|
|
|
+ },
|
|
|
+ None => {
|
|
|
+ error!("coinex_swap:格式化订单大小错误!\nformat_order_item:order={:?} status={}", order, status);
|
|
|
+ panic!("coinex_swap:格式化订单大小失败,退出程序!");
|
|
|
+ }
|
|
|
+ }
|
|
|
// info!("order {}", order);
|
|
|
// 通过客户端id查询订单 只能查出未完成订单(没有状态字段)
|
|
|
let status = order["status"].as_str().unwrap_or(status);
|
|
|
let text = order["client_id"].as_str().unwrap_or("");
|
|
|
- let size = Decimal::from_str(&order["amount"].as_str().unwrap()).unwrap();
|
|
|
+
|
|
|
let deal_amount = Decimal::from_str(&order["filled_amount"].as_str().unwrap()).unwrap();
|
|
|
let filled_value = Decimal::from_str(&order["filled_value"].as_str().unwrap()).unwrap();
|
|
|
|