Browse Source

修改cointr交易所

DESKTOP-NE65RNK\Citrus_limon 1 năm trước cách đây
mục cha
commit
efdf0c8ee7
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 4 2
      standard/src/cointr_swap_handle.rs

+ 4 - 2
standard/src/cointr_swap_handle.rs

@@ -40,12 +40,14 @@ pub fn format_trade_items(res_data: &ResponseData) -> Vec<Trade> {
     for item in result {
         let side = item["side"] == "BUY";
         let size = Decimal::from_str(item["sz"].as_str().unwrap()).unwrap();
+        let price = Decimal::from_str(item["px"].as_str().unwrap()).unwrap();
         trades.push(Trade {
             id: item["tradeId"].to_string(),
             time: Decimal::from_i64(item["mTime"].as_i64().unwrap()).unwrap(),
-            size: if side { size } else { -size },
-            price: Decimal::from_str(item["px"].as_str().unwrap()).unwrap(),
+            size: if side { size * price } else { -size * price },
+            price,
             symbol: res_data.data["instId"].as_str().unwrap().replace("USDT", "_USDT"),
+
         })
     }