|
|
@@ -8,6 +8,7 @@ use tokio::sync::{mpsc, Mutex};
|
|
|
use tokio::try_join;
|
|
|
use tracing::{error, info};
|
|
|
use standard::Order;
|
|
|
+use strategy::model::OrderInfo;
|
|
|
use strategy::params::Params;
|
|
|
use strategy::quant;
|
|
|
use strategy::quant::Quant;
|
|
|
@@ -54,8 +55,26 @@ async fn main() {
|
|
|
loop {
|
|
|
match order_receiver.recv().await {
|
|
|
Some(order) => {
|
|
|
- let quant_obj = order_handler_quant_arc.lock().await;
|
|
|
- info!("你好{:?}", order);
|
|
|
+ let mut quant = order_handler_quant_arc.lock().await;
|
|
|
+
|
|
|
+ let mut order_info = OrderInfo {
|
|
|
+ symbol: "".to_string(),
|
|
|
+ amount: Default::default(),
|
|
|
+ side: "".to_string(),
|
|
|
+ price: Default::default(),
|
|
|
+ client_id: order.custom_id,
|
|
|
+ filled_price: Default::default(),
|
|
|
+ filled: Default::default(),
|
|
|
+ order_id: order.id,
|
|
|
+ local_time: 0,
|
|
|
+ create_time: 0,
|
|
|
+ status: order.status,
|
|
|
+ fee: Default::default(),
|
|
|
+ };
|
|
|
+
|
|
|
+ quant.update_local_order(order_info.clone());
|
|
|
+
|
|
|
+ info!("收到新的order{:?}", order_info.clone());
|
|
|
},
|
|
|
None => {
|
|
|
error!("Order channel has been closed!");
|
|
|
@@ -69,8 +88,9 @@ async fn main() {
|
|
|
loop {
|
|
|
match error_receiver.recv().await {
|
|
|
Some(error) => {
|
|
|
- let quant_obj = error_handler_quant_arc.lock().await;
|
|
|
- error!("你好{:?}", error);
|
|
|
+ let quant = error_handler_quant_arc.lock().await;
|
|
|
+
|
|
|
+ error!("出现错误{:?}", error);
|
|
|
},
|
|
|
None => {
|
|
|
error!("Error channel has been closed!");
|