|
|
@@ -7,7 +7,7 @@ use tracing::{error};
|
|
|
use exchanges::response_base::ResponseData;
|
|
|
use global::public_params;
|
|
|
use crate::exchange::ExchangeEnum;
|
|
|
-use crate::{Account, binance_swap_handle, gate_handle, MarketOrder, Position, SpecialDepth, SpecialOrder, SpecialTicker};
|
|
|
+use crate::{Account, binance_swap_handle, gate_swap_handle, MarketOrder, Position, SpecialDepth, SpecialOrder, SpecialTicker};
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
pub struct HandleSwapInfo;
|
|
|
@@ -30,7 +30,7 @@ impl HandleSwapInfo {
|
|
|
// panic!("暂未提供此交易所方法!handle_account_info:{:?}", exchange);
|
|
|
// }
|
|
|
ExchangeEnum::GateSwap => {
|
|
|
- gate_handle::handle_account_info(res_data, symbol)
|
|
|
+ gate_swap_handle::handle_account_info(res_data, symbol)
|
|
|
}
|
|
|
// ExchangeEnum::KucoinSwap => {
|
|
|
// kucoin_handle::handle_account_info(res_data, symbol)
|
|
|
@@ -54,7 +54,7 @@ impl HandleSwapInfo {
|
|
|
}
|
|
|
}
|
|
|
// 处理特殊Ticket信息
|
|
|
- pub fn handle_special_ticker(exchange: ExchangeEnum, res_data: ResponseData) -> SpecialDepth {
|
|
|
+ pub fn handle_special_ticker(exchange: ExchangeEnum, res_data: &ResponseData) -> SpecialDepth {
|
|
|
match exchange {
|
|
|
// ExchangeEnum::BinanceSpot => {
|
|
|
// binance_spot_handle::handle_special_ticker(res_data)
|
|
|
@@ -63,7 +63,7 @@ impl HandleSwapInfo {
|
|
|
binance_swap_handle::handle_special_ticker(res_data)
|
|
|
}
|
|
|
ExchangeEnum::GateSwap => {
|
|
|
- gate_handle::handle_special_ticker(res_data)
|
|
|
+ gate_swap_handle::handle_special_ticker(res_data)
|
|
|
}
|
|
|
// ExchangeEnum::KucoinSwap => {
|
|
|
// kucoin_handle::handle_special_ticker(res_data)
|
|
|
@@ -90,7 +90,7 @@ impl HandleSwapInfo {
|
|
|
panic!("暂未提供此交易所方法!handle_position:{:?}", exchange);
|
|
|
}
|
|
|
ExchangeEnum::GateSwap => {
|
|
|
- gate_handle::handle_position(res_data, ct_val)
|
|
|
+ gate_swap_handle::handle_position(res_data, ct_val)
|
|
|
}
|
|
|
// ExchangeEnum::KucoinSwap => {
|
|
|
// kucoin_handle::handle_position(res_data, ct_val)
|
|
|
@@ -119,7 +119,7 @@ impl HandleSwapInfo {
|
|
|
panic!("暂未提供此交易所方法!handle_order:{:?}", exchange);
|
|
|
}
|
|
|
ExchangeEnum::GateSwap => {
|
|
|
- gate_handle::handle_order(res_data, ct_val)
|
|
|
+ gate_swap_handle::handle_order(res_data, ct_val)
|
|
|
}
|
|
|
// ExchangeEnum::KucoinSwap => {
|
|
|
// kucoin_handle::handle_order(res_data, ct_val)
|
|
|
@@ -141,13 +141,12 @@ impl HandleSwapInfo {
|
|
|
|
|
|
// 处理深度信息
|
|
|
pub fn handle_special_depth(exchange: ExchangeEnum, res_data: ResponseData) -> SpecialDepth {
|
|
|
- let lable = res_data.label.clone();
|
|
|
+ let label = res_data.label.clone();
|
|
|
// 格式化
|
|
|
let mut format_depth = format_depth(exchange, res_data);
|
|
|
// 运算、组装
|
|
|
- make_special_depth(lable, &mut format_depth.depth_asks, &mut format_depth.depth_bids, format_depth.t, format_depth.create_at)
|
|
|
+ make_special_depth(label, &mut format_depth.depth_asks, &mut format_depth.depth_bids, format_depth.t, format_depth.create_at)
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -235,8 +234,8 @@ pub fn format_depth(exchange: ExchangeEnum, res_data: ResponseData) -> DepthPara
|
|
|
create_at = res_data_json["E"].as_i64().unwrap() * 1000;
|
|
|
}
|
|
|
ExchangeEnum::GateSwap => {
|
|
|
- depth_asks = gate_handle::format_depth_items(res_data_json["asks"].clone());
|
|
|
- depth_bids = gate_handle::format_depth_items(res_data_json["bids"].clone());
|
|
|
+ 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());
|
|
|
// todo! 有id可以取 保证与py一致
|
|
|
t = Decimal::from_str(&res_data_json["t"].to_string()).unwrap();
|
|
|
create_at = res_data_json["t"].as_i64().unwrap() * 1000;
|