|
|
@@ -30,16 +30,19 @@ pub async fn run_listener(is_shutdown_arc: Arc<AtomicBool>) {
|
|
|
// 订阅所有币种
|
|
|
let login = BTreeMap::new();
|
|
|
let mut coinex_rest = CoinexSwapRest::new(login);
|
|
|
- let response = coinex_rest.get_market_details("usdt".to_string()).await;
|
|
|
let mut symbols = vec![];
|
|
|
- if response.code == 200 {
|
|
|
- let data = response.data.as_array().unwrap();
|
|
|
- for info in data {
|
|
|
- let s = info["market"].as_str().unwrap();
|
|
|
- if !s.ends_with("USDT") { continue; }
|
|
|
- let symbol = s.to_string().replace("USDT", "_USDT");
|
|
|
- symbols.push(symbol)
|
|
|
+ loop {
|
|
|
+ let response = coinex_rest.get_market_details("usdt".to_string()).await;
|
|
|
+ if response.code == 200 {
|
|
|
+ let data = response.data.as_array().unwrap();
|
|
|
+ for info in data {
|
|
|
+ let s = info["market"].as_str().unwrap();
|
|
|
+ if !s.ends_with("USDT") { continue; }
|
|
|
+ let symbol = s.to_string().replace("USDT", "_USDT");
|
|
|
+ symbols.push(symbol)
|
|
|
+ }
|
|
|
}
|
|
|
+ if symbols.len() > 0 { break; } else { tokio::time::sleep(Duration::from_secs(2)).await; }
|
|
|
}
|
|
|
|
|
|
for chunk in symbols.chunks(20) {
|