|
|
@@ -108,55 +108,6 @@ pub async fn on_special_depth(core_arc: Arc<Mutex<Core>>,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// pub async fn on_trade(trade: OriginalTradeBa,
|
|
|
-// core_arc_clone: Arc<Mutex<Core>>) {
|
|
|
- // let mut core = core_arc_clone.lock().await;
|
|
|
- // // 1. 塞入数据到core
|
|
|
- // core.trades.push(trade.clone());
|
|
|
- // // 2. 长度检查
|
|
|
- // if core.trades.len() > core.recall_max_count {
|
|
|
- // core.trades.remove(0);
|
|
|
- // }
|
|
|
- // // 3. 如果少于100条,不进行判断
|
|
|
- // if core.trades.len() < 100 {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // // 求最近的多空总和
|
|
|
- // let mut long_sum = Decimal::ZERO;
|
|
|
- // let mut short_sum = Decimal::ZERO;
|
|
|
- // let last_trade_t = trade.t.clone();
|
|
|
- // let mut rev = core.trades.clone();
|
|
|
- // rev.reverse();
|
|
|
- // for trade_o in rev {
|
|
|
- // // 如果该元素已过期,我们是按时间顺序插入的,说明前面的应该都过期了,跳出循环,停止检测
|
|
|
- // if trade_o.t < last_trade_t - core.recall_time {
|
|
|
- // continue;
|
|
|
- // }
|
|
|
- //
|
|
|
- // // 卖出订单
|
|
|
- // if trade_o.m {
|
|
|
- // short_sum += trade_o.q;
|
|
|
- // } else {
|
|
|
- // long_sum += trade_o.q;
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // // 做多主动性
|
|
|
- // if (long_sum / (long_sum + short_sum)) > core.long_volume_rate {
|
|
|
- // if core.side != "long".to_string() {
|
|
|
- // core.side = "long".to_string();
|
|
|
- // }
|
|
|
- // } else if (short_sum / (long_sum + short_sum)) > core.short_volume_rate {
|
|
|
- // if core.side != "short".to_string() {
|
|
|
- // core.side = "short".to_string();
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // if core.side != "normal".to_string() {
|
|
|
- // core.side = "normal".to_string();
|
|
|
- // }
|
|
|
- // }
|
|
|
-// }
|
|
|
-
|
|
|
pub async fn on_order() {}
|
|
|
|
|
|
pub async fn on_position() {}
|