|
@@ -654,26 +654,26 @@ impl Core {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- pub async fn on_trade(&mut self, trade: &Trade, _name_ref: &String, trace_stack: &mut TraceStack, index: usize) {
|
|
|
|
|
|
|
+ pub async fn on_trade(&mut self, trade: &Trade, _name_ref: &String, _trace_stack: &mut TraceStack, index: usize) {
|
|
|
if self.mode_signal == 0 && self.ready == 1 {
|
|
if self.mode_signal == 0 && self.ready == 1 {
|
|
|
self.predictor.on_trade(trade, index).await;
|
|
self.predictor.on_trade(trade, index).await;
|
|
|
|
|
|
|
|
- // 产生交易信号
|
|
|
|
|
- if trade.value > Decimal::ONE_HUNDRED {
|
|
|
|
|
- let mut orders = self.strategy.do_strategy(&mut self.predictor, &self.local_orders, &self.local_position, &self.local_coin, &self.local_cash);
|
|
|
|
|
- trace_stack.on_after_strategy();
|
|
|
|
|
-
|
|
|
|
|
- if orders.is_not_empty() {
|
|
|
|
|
- let mut platform_rest_fb = self.platform_rest.clone_box();
|
|
|
|
|
- // 先更新本地记录再发单。
|
|
|
|
|
- self._update_local_orders(&mut orders);
|
|
|
|
|
- // info!("订单指令:{:?}", orders);
|
|
|
|
|
- let mut ts = trace_stack.clone();
|
|
|
|
|
- spawn(async move {
|
|
|
|
|
- platform_rest_fb.command_order(&mut orders, &mut ts).await;
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // // 产生交易信号
|
|
|
|
|
+ // if trade.value > Decimal::ONE_HUNDRED {
|
|
|
|
|
+ // let mut orders = self.strategy.do_strategy(&mut self.predictor, &self.local_orders, &self.local_position, &self.local_coin, &self.local_cash);
|
|
|
|
|
+ // trace_stack.on_after_strategy();
|
|
|
|
|
+ //
|
|
|
|
|
+ // if orders.is_not_empty() {
|
|
|
|
|
+ // let mut platform_rest_fb = self.platform_rest.clone_box();
|
|
|
|
|
+ // // 先更新本地记录再发单。
|
|
|
|
|
+ // self._update_local_orders(&mut orders);
|
|
|
|
|
+ // // info!("订单指令:{:?}", orders);
|
|
|
|
|
+ // let mut ts = trace_stack.clone();
|
|
|
|
|
+ // spawn(async move {
|
|
|
|
|
+ // platform_rest_fb.command_order(&mut orders, &mut ts).await;
|
|
|
|
|
+ // });
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|