|
|
@@ -140,7 +140,7 @@ impl HandleSwapInfo {
|
|
|
}
|
|
|
|
|
|
// 处理深度信息
|
|
|
- pub fn handle_special_depth(exchange: ExchangeEnum, res_data: ResponseData) -> SpecialDepth {
|
|
|
+ pub fn handle_special_depth(exchange: ExchangeEnum, res_data: &ResponseData) -> SpecialDepth {
|
|
|
let label = res_data.label.clone();
|
|
|
// 格式化
|
|
|
let mut format_depth = format_depth(exchange, res_data);
|
|
|
@@ -214,8 +214,7 @@ pub fn make_special_depth(label: String, depth_asks: &mut Vec<MarketOrder>, dept
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-pub fn format_depth(exchange: ExchangeEnum, res_data: ResponseData) -> DepthParam {
|
|
|
- let res_data_json = res_data.data;
|
|
|
+pub fn format_depth(exchange: ExchangeEnum, res_data: &ResponseData) -> DepthParam {
|
|
|
let depth_asks: Vec<MarketOrder>;
|
|
|
let depth_bids: Vec<MarketOrder>;
|
|
|
let t: Decimal;
|
|
|
@@ -228,17 +227,17 @@ pub fn format_depth(exchange: ExchangeEnum, res_data: ResponseData) -> DepthPara
|
|
|
// create_at = 0;
|
|
|
// }
|
|
|
ExchangeEnum::BinanceSwap => {
|
|
|
- depth_asks = binance_swap_handle::format_depth_items(res_data_json["a"].clone());
|
|
|
- depth_bids = binance_swap_handle::format_depth_items(res_data_json["b"].clone());
|
|
|
- t = Decimal::from_str(&res_data_json["u"].to_string()).unwrap();
|
|
|
- create_at = res_data_json["E"].as_i64().unwrap() * 1000;
|
|
|
+ depth_asks = binance_swap_handle::format_depth_items(res_data.data["a"].clone());
|
|
|
+ depth_bids = binance_swap_handle::format_depth_items(res_data.data["b"].clone());
|
|
|
+ t = Decimal::from_str(&res_data.data["u"].to_string()).unwrap();
|
|
|
+ create_at = res_data.data["E"].as_i64().unwrap() * 1000;
|
|
|
}
|
|
|
ExchangeEnum::GateSwap => {
|
|
|
- depth_asks = gate_swap_handle::format_depth_items(res_data_json["asks"].clone());
|
|
|
- depth_bids = gate_swap_handle::format_depth_items(res_data_json["bids"].clone());
|
|
|
+ depth_asks = gate_swap_handle::format_depth_items(res_data.data["asks"].clone());
|
|
|
+ depth_bids = gate_swap_handle::format_depth_items(res_data.data["bids"].clone());
|
|
|
// todo! 有id可以取 保证与py一致
|
|
|
- t = Decimal::from_str(&res_data_json["t"].to_string()).unwrap();
|
|
|
- create_at = res_data_json["t"].as_i64().unwrap() * 1000;
|
|
|
+ t = Decimal::from_str(&res_data.data["t"].to_string()).unwrap();
|
|
|
+ create_at = res_data.data["t"].as_i64().unwrap() * 1000;
|
|
|
}
|
|
|
// ExchangeEnum::KucoinSwap => {
|
|
|
// depth_asks = kucoin_handle::format_depth_items(res_data_json["asks"].clone());
|