|
@@ -29,7 +29,6 @@ async fn ws_custom_subscribe_pu() {
|
|
|
// BybitSwapSubscribeType::PuOrderBook50,
|
|
// BybitSwapSubscribeType::PuOrderBook50,
|
|
|
// BybitSwapSubscribeType::PuBlicTrade,
|
|
// BybitSwapSubscribeType::PuBlicTrade,
|
|
|
BybitSwapSubscribeType::PuTickers,
|
|
BybitSwapSubscribeType::PuTickers,
|
|
|
-
|
|
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -93,9 +92,9 @@ async fn ws_custom_subscribe_pr() {
|
|
|
let (write_tx, write_rx) = futures_channel::mpsc::unbounded();
|
|
let (write_tx, write_rx) = futures_channel::mpsc::unbounded();
|
|
|
let (read_tx, mut read_rx) = futures_channel::mpsc::unbounded();
|
|
let (read_tx, mut read_rx) = futures_channel::mpsc::unbounded();
|
|
|
|
|
|
|
|
- let logparam = BybitSwapLogin{
|
|
|
|
|
- api_key:ACCESS_KEY.to_string(),
|
|
|
|
|
- secret_key :SECRET_KEY.to_string(),
|
|
|
|
|
|
|
+ let logparam = BybitSwapLogin {
|
|
|
|
|
+ api_key: ACCESS_KEY.to_string(),
|
|
|
|
|
+ secret_key: SECRET_KEY.to_string(),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
let mut ws = get_ws(Option::from(logparam), BybitSwapWsType::Private).await;
|
|
let mut ws = get_ws(Option::from(logparam), BybitSwapWsType::Private).await;
|
|
@@ -168,6 +167,7 @@ async fn rest_get_server_time_test() {
|
|
|
let req_data = ret.get_server_time().await;
|
|
let req_data = ret.get_server_time().await;
|
|
|
println!("Bybit--服務器時間--{:?}", req_data);
|
|
println!("Bybit--服務器時間--{:?}", req_data);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//rest-查詢最新行情信息
|
|
//rest-查詢最新行情信息
|
|
|
#[tokio::test]
|
|
#[tokio::test]
|
|
|
async fn rest_get_tickers_test() {
|
|
async fn rest_get_tickers_test() {
|
|
@@ -177,6 +177,7 @@ async fn rest_get_tickers_test() {
|
|
|
let req_data = ret.get_tickers("DOGEUSDT".to_string()).await;
|
|
let req_data = ret.get_tickers("DOGEUSDT".to_string()).await;
|
|
|
println!("Bybit--查詢最新行情信息--{:?}", req_data);
|
|
println!("Bybit--查詢最新行情信息--{:?}", req_data);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
//rest-查詢市場價格K線數據
|
|
//rest-查詢市場價格K線數據
|
|
|
#[tokio::test]
|
|
#[tokio::test]
|
|
|
async fn rest_get_kline_test() {
|
|
async fn rest_get_kline_test() {
|
|
@@ -225,7 +226,7 @@ async fn rest_get_positions_test() {
|
|
|
global::log_utils::init_log_with_trace();
|
|
global::log_utils::init_log_with_trace();
|
|
|
|
|
|
|
|
let mut ret = get_rest();
|
|
let mut ret = get_rest();
|
|
|
- let req_data = ret.get_positions("DOGEUSDT".to_string()).await;
|
|
|
|
|
|
|
+ let req_data = ret.get_positions("DOGEUSDT".to_string(), "".to_string()).await;
|
|
|
println!("Bybit--查看持仓信息--{:?}", req_data);
|
|
println!("Bybit--查看持仓信息--{:?}", req_data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -304,7 +305,6 @@ async fn rest_cancel_orders_test() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
async fn get_ws(btree_map: Option<BybitSwapLogin>, type_v: BybitSwapWsType) -> BybitSwapWs {
|
|
async fn get_ws(btree_map: Option<BybitSwapLogin>, type_v: BybitSwapWsType) -> BybitSwapWs {
|
|
|
let ku_ws = BybitSwapWs::new(false, btree_map, type_v);
|
|
let ku_ws = BybitSwapWs::new(false, btree_map, type_v);
|
|
|
ku_ws
|
|
ku_ws
|