|
|
@@ -500,16 +500,20 @@ impl Predictor {
|
|
|
let now = Decimal::from(Utc::now().timestamp_millis());
|
|
|
|
|
|
let is_close_long = self.inventory > Decimal::ZERO && (
|
|
|
- // 硬止损
|
|
|
- (self.profit < dec!(-0.01))
|
|
|
+ // 5分钟后收益率最大值在0.01以内但收益率超过0.0012
|
|
|
+ (now - self.prev_open_time > dec!(300_000) && self.profit > dec!(0.0012) && self.profit_high < dec!(0.01))
|
|
|
+ // 10分钟以后收益率还在0以下直接走
|
|
|
+ || (now - self.prev_open_time > dec!(600_000) && self.profit < dec!(0.0012))
|
|
|
// 利润较大时,追踪止盈
|
|
|
- || (self.profit > dec!(0.01) && self.profit < self.profit_high * dec!(0.75))
|
|
|
+ || (self.profit_high > dec!(0.01) && self.profit < self.profit_high * dec!(0.75))
|
|
|
);
|
|
|
let is_close_short = self.inventory < Decimal::ZERO && (
|
|
|
- // 硬止损
|
|
|
- (self.profit < dec!(-0.01))
|
|
|
+ // 5分钟后收益率最大值在0.01以内但收益率超过0.0012
|
|
|
+ (now - self.prev_open_time > dec!(300_000) && self.profit > dec!(0.0012) && self.profit_high < dec!(0.01))
|
|
|
+ // 10分钟以后收益率还在0以下直接走
|
|
|
+ || (now - self.prev_open_time > dec!(600_000) && self.profit < dec!(0.0012))
|
|
|
// 利润较大时,追踪止盈
|
|
|
- || (self.profit > dec!(0.01) && self.profit < self.profit_high * dec!(0.75))
|
|
|
+ || (self.profit_high > dec!(0.01) && self.profit < self.profit_high * dec!(0.75))
|
|
|
);
|
|
|
|
|
|
let is_open_long = self.inventory.is_zero()
|
|
|
@@ -539,9 +543,9 @@ impl Predictor {
|
|
|
self.trade_condition_time = now;
|
|
|
}
|
|
|
|
|
|
- // 开仓信号要过期,只保留2秒
|
|
|
+ // 开仓信号要过期,只保留60秒
|
|
|
if (self.trade_condition == dec!(3) || self.trade_condition == dec!(4))
|
|
|
- && now - self.trade_condition_time > dec!(2_000) {
|
|
|
+ && now - self.trade_condition_time > dec!(60_000) {
|
|
|
self.trade_condition = Decimal::ZERO;
|
|
|
}
|
|
|
|
|
|
@@ -567,13 +571,13 @@ impl Predictor {
|
|
|
self.bid_delta = dec!(0);
|
|
|
self.ask_delta = dec!(-2);
|
|
|
|
|
|
- self.optimal_bid_price = max(self.fair_price, self.mid_price) * dec!(1.005);
|
|
|
+ self.optimal_bid_price = self.fair_price;
|
|
|
self.optimal_ask_price = Self::DONT_VIEW;
|
|
|
} else if self.trade_condition == dec!(4) {
|
|
|
self.ask_delta = dec!(0);
|
|
|
self.bid_delta = dec!(-2);
|
|
|
|
|
|
- self.optimal_ask_price = min(self.fair_price, self.mid_price) * dec!(0.995);
|
|
|
+ self.optimal_ask_price = self.fair_price;
|
|
|
self.optimal_bid_price = Self::DONT_VIEW;
|
|
|
}
|
|
|
|