|
|
@@ -873,7 +873,7 @@ pub async fn run_refer(quant_arc: Arc<Mutex<Quant>>, name: String, symbol: Vec<S
|
|
|
let ref_names = quant_arc.lock().await.params.ref_pair.clone();
|
|
|
tokio::spawn( async move {
|
|
|
let mut ba_exc = BinanceSwapWs::new_label(name, false, exchange_param, BinanceWsType::PublicAndPrivate, tx);
|
|
|
- ba_exc.set_subscribe(vec![BinanceSubscribeType::PuDepth20levels100ms]);
|
|
|
+ ba_exc.set_subscribe(vec![ BinanceSubscribeType::PuAggTrade]);
|
|
|
ba_exc.custom_subscribe(ref_names).await;
|
|
|
});
|
|
|
tokio::spawn(async move {
|
|
|
@@ -895,16 +895,16 @@ pub async fn run_refer(quant_arc: Arc<Mutex<Quant>>, name: String, symbol: Vec<S
|
|
|
if decimal == 99 {
|
|
|
decimal = trade.p.scale();
|
|
|
}
|
|
|
- if trade.p > max_buy {
|
|
|
+ if trade.p > max_buy || max_buy == Decimal::ZERO{
|
|
|
max_buy = trade.p
|
|
|
}
|
|
|
- if trade.p < min_sell {
|
|
|
+ if trade.p < min_sell || min_sell == Decimal::ZERO{
|
|
|
min_sell = trade.p
|
|
|
}
|
|
|
{
|
|
|
let mut quant = bot_arc_clone.lock().await;
|
|
|
- quant.max_buy_min_sell_cache.insert(trade.name, vec![max_buy, min_sell]);
|
|
|
-
|
|
|
+ quant.max_buy_min_sell_cache.insert(data.lable, vec![max_buy, min_sell]);
|
|
|
+ info!(?quant.max_buy_min_sell_cache);
|
|
|
}
|
|
|
} else if data.channel == "bookTicker" {
|
|
|
let ticker: OriginalTicker = serde_json::from_str(data.data.as_str()).unwrap();
|