|
|
@@ -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"),
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
|