Make parallel operation of setting future
This commit is contained in:
parent
b9621ccc72
commit
229a4c38ae
|
|
@ -77,12 +77,18 @@ async fn future_setup() {
|
|||
.build()
|
||||
.unwrap();
|
||||
|
||||
let mut task_vec = Vec::new();
|
||||
let mut future_exchange_info_map: HashMap<String, FuturesExchangeInfo> = HashMap::new();
|
||||
request_future_exchange_infomation(&client, &mut future_exchange_info_map).await;
|
||||
for (symbol, futures_exchange_info) in future_exchange_info_map {
|
||||
set_margin_type(&symbol, MarginType::Isolated, &client).await; // Default: Isolated
|
||||
set_initial_leverage(&symbol, 1, &client).await; // Default: x1
|
||||
let symbol_c = symbol.clone();
|
||||
let client_c = client.clone();
|
||||
task_vec.push(tokio::spawn(async move {
|
||||
set_margin_type(&symbol_c, MarginType::Isolated, &client_c).await; // Default: Isolated
|
||||
set_initial_leverage(&symbol_c, 1, &client_c).await; // Default: x1
|
||||
}));
|
||||
}
|
||||
try_join_all(task_vec).await;
|
||||
|
||||
set_position_mode(&client).await; // Default: One-way Mode
|
||||
set_asset_mode(&client).await; // Default: Single-Asset Mode
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user