Jelajahi Sumber

添加方法类型

gepangpang 2 tahun lalu
induk
melakukan
db9ea1f9c4
1 mengubah file dengan 8 tambahan dan 8 penghapusan
  1. 8 8
      src/exchange_libs.rs

+ 8 - 8
src/exchange_libs.rs

@@ -249,7 +249,7 @@ impl OkxExc {
     }
 
     //带认证-get
-    async fn get_v(&self, request_path: String, params: BTreeMap<&str, &str>) -> Result<(ReqData), reqwest::Error> {
+    pub(crate) async fn get_v(&self, request_path: String, params: BTreeMap<&str, &str>) -> Result<(ReqData), reqwest::Error> {
         let mut req_data: ReqData;
 
         /*请求接口与 地址*/
@@ -537,7 +537,7 @@ impl SocketTool {
             subscription: subscription,
         }
     }
-    pub(crate) fn run(&self, parse_fn: impl Fn()) {
+    pub(crate) fn run(&self, parse_fn: impl Fn(String)) {
         while true {//一个粗糙的 断开重连操作
             /*****消息溜***/
             let mut stdout = io::stdout();
@@ -731,22 +731,22 @@ impl SocketTool {
     }
 
     //币安--自定义-订阅
-    pub fn binance_run_custom(b_array: Vec<&str>, parse_fn: impl Fn()) {}
+    pub fn binance_run_custom(b_array: Vec<&str>, parse_fn: impl Fn(String)) {}
 
 
     //币安--深度信息
-    pub fn binance_run_kline(b_array: Vec<&str>, parse_fn: impl Fn()) {
+    pub fn binance_run_kline(b_array: Vec<&str>, parse_fn: impl Fn(String)) {
         SocketTool::binance_run(b_array, "kline_1s".to_string(), parse_fn);
     }
 
     //币安--深度信息
-    pub fn binance_run_depth(b_array: Vec<&str>, levels: String, parse_fn: impl Fn()) {
+    pub fn binance_run_depth(b_array: Vec<&str>, levels: String, parse_fn: impl Fn(String)) {
         let str = format!("depth{}@100ms", levels);
         SocketTool::binance_run(b_array, str.to_string(), parse_fn);
     }
 
     //币安--订阅
-    pub fn binance_run(b_array: Vec<&str>, subscription_name: String, parse_fn: impl Fn()) {
+    pub fn binance_run(b_array: Vec<&str>, subscription_name: String, parse_fn: impl Fn(String)) {
         let mut params = vec![];
 
         for item in &b_array {
@@ -776,7 +776,7 @@ impl SocketTool {
         biance_socke.run(parse_fn);
     }
 
-    fn hook_fn_binance(message: String, parse_fn: impl Fn()) {
+    fn hook_fn_binance(message: String, parse_fn: impl Fn(String)) {
         println!("币安--回调函数:响应: {}", message);
         parse_fn(message);
     }
@@ -838,7 +838,7 @@ impl SocketTool {
 //     );
 //     biance_socke.run("binance".to_string(), parse_fn);
 // }
-    fn hook_fn_okx(message: String, parse_fn: impl Fn()) {
+    fn hook_fn_okx(message: String, parse_fn: impl Fn(String)) {
         println!("OKX--回调函数:响应: {}", message);
         parse_fn(message);
     }