|
|
@@ -25,6 +25,7 @@ use standard::exchange::ExchangeEnum::{BinanceSpot, BinanceSwap, BitgetSpot, Gat
|
|
|
use crate::model::{LocalPosition, OrderInfo, TokenParam, TraderMsg};
|
|
|
use crate::predictor::Predictor;
|
|
|
use crate::strategy::Strategy;
|
|
|
+use crate::utils;
|
|
|
use crate::utils::clip;
|
|
|
|
|
|
|
|
|
@@ -1128,10 +1129,6 @@ impl Quant {
|
|
|
let side;
|
|
|
let price= Decimal::ZERO;
|
|
|
let amount;
|
|
|
-
|
|
|
- if diff != Decimal::ZERO {
|
|
|
- info!("{}, 需要调整现货仓位 {} usdt", symbol, diff);
|
|
|
- }
|
|
|
if diff > Decimal::from(10) {
|
|
|
side = "kd";
|
|
|
// price = mp*1.001;
|
|
|
@@ -1143,8 +1140,9 @@ impl Quant {
|
|
|
} else {
|
|
|
continue;
|
|
|
}
|
|
|
+ info!("{}, 需要调整现货仓位 {} USDT(目标:{}USDT)", symbol, diff, _hold_coin);
|
|
|
// 价格0,市价单
|
|
|
- match self.platform_rest.take_order_symbol(symbol.clone(), Decimal::ONE, "t-123", side, price, amount).await{
|
|
|
+ match self.platform_rest.take_order_symbol(symbol.clone(), Decimal::ONE, utils::generate_client_id(None).as_str(), side, price, amount).await{
|
|
|
Ok(v)=>{
|
|
|
info!("side: {}, {} 下单,{:?}", side, symbol, v);
|
|
|
// 执行完当前币对 结束循环
|
|
|
@@ -1355,7 +1353,7 @@ impl Quant {
|
|
|
let hand_min_limit = Decimal::new(5, 0);
|
|
|
if (long_one_hand_amount.is_zero() && short_one_hand_amount.is_zero()) ||
|
|
|
(long_one_hand_value < hand_min_limit && short_one_hand_value < hand_min_limit) {
|
|
|
- self.exit_msg = format!("{}{}{}{}", "初始下单量太少 buy: ", long_one_hand_amount, " sell: ", short_one_hand_amount);
|
|
|
+ self.exit_msg = format!("初始下单量太少 buy: {} sell: {}", long_one_hand_amount, short_one_hand_amount);
|
|
|
// 停止程序
|
|
|
self.stop().await;
|
|
|
return false;
|