|
|
@@ -6,11 +6,10 @@ use tokio::try_join;
|
|
|
use tracing::trace;
|
|
|
use exchanges::binance_swap_rest::BinanceSwapRest;
|
|
|
use exchanges::binance_swap_ws::{BinanceSubscribeType, BinanceSwapWs, BinanceWsType};
|
|
|
-use exchanges::proxy;
|
|
|
use exchanges::response_base::ResponseData;
|
|
|
|
|
|
-const ACCESS_KEY: &str = "";
|
|
|
-const SECRET_KEY: &str = "";
|
|
|
+const ACCESS_KEY: &str = "Z2KWEFuiTR26d0OrRh0UVnALiKwftEGKdaz6AHU7xAqZqkKwhb8OPWlG5uAGqGBI";
|
|
|
+const SECRET_KEY: &str = "w3HvCw17OHEDjpMwlfywtl3tLAfSOql81nXgLk4HTA2yQ4Qph0ilPkKiLgOOY7tQ";
|
|
|
|
|
|
|
|
|
//ws-订阅公共频道信息
|
|
|
@@ -18,7 +17,7 @@ const SECRET_KEY: &str = "";
|
|
|
async fn ws_custom_subscribe() {
|
|
|
global::log_utils::init_log_with_trace();
|
|
|
|
|
|
- let mut bool_v1 = Arc::new(AtomicBool::new(true));
|
|
|
+ let bool_v1 = Arc::new(AtomicBool::new(true));
|
|
|
let btree_map: BTreeMap<String, String> = BTreeMap::new();
|
|
|
let (tx, mut rx) = channel(1024);
|
|
|
let mut ws = get_ws(btree_map, tx);
|
|
|
@@ -71,17 +70,26 @@ async fn rest_get_account_test() {
|
|
|
trace!(?rep_data)
|
|
|
}
|
|
|
|
|
|
-//rest-查询订单
|
|
|
-#[tokio::test]
|
|
|
-async fn rest_get_order_test() {
|
|
|
+
|
|
|
+//rest-根据币对 撤销全部订单
|
|
|
+#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
|
|
+async fn rest_cancel_order_all_test() {
|
|
|
global::log_utils::init_log_with_trace();
|
|
|
|
|
|
let mut rest = get_rest();
|
|
|
+
|
|
|
+ let rep_data1 = rest.get_server_time().await;
|
|
|
+ trace!(?rep_data1);
|
|
|
+
|
|
|
+ trace!("开始时间:{:?}",chrono::Utc::now().timestamp_millis().to_string());
|
|
|
+ let rep_data = rest.cancel_order_all("BTCUSDT".to_string()).await;
|
|
|
+ trace!(?rep_data);
|
|
|
+ trace!("结束时间:{:?}",chrono::Utc::now().timestamp_millis().to_string());
|
|
|
}
|
|
|
|
|
|
|
|
|
fn get_ws(btree_map: BTreeMap<String, String>, tx: Sender<ResponseData>) -> BinanceSwapWs {
|
|
|
- let mut binance_ws = BinanceSwapWs::new(false,
|
|
|
+ let binance_ws = BinanceSwapWs::new(false,
|
|
|
btree_map,
|
|
|
BinanceWsType::PublicAndPrivate,
|
|
|
tx);
|
|
|
@@ -93,6 +101,6 @@ fn get_rest() -> BinanceSwapRest {
|
|
|
btree_map.insert("access_key".to_string(), ACCESS_KEY.to_string());
|
|
|
btree_map.insert("secret_key".to_string(), SECRET_KEY.to_string());
|
|
|
|
|
|
- let mut ba_exc = BinanceSwapRest::new(false, btree_map);
|
|
|
+ let ba_exc = BinanceSwapRest::new(false, btree_map);
|
|
|
ba_exc
|
|
|
}
|