Browse Source

v4.1.1: 出场逻辑更新。

skyffire 8 months ago
parent
commit
12f4ffeb2e
2 changed files with 8 additions and 6 deletions
  1. 1 1
      Cargo.toml
  2. 7 5
      strategy/src/predictor.rs

+ 1 - 1
Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "as-rust"
-version = "4.1.0"
+version = "4.1.1"
 edition = "2021"
 
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

+ 7 - 5
strategy/src/predictor.rs

@@ -500,10 +500,12 @@ impl Predictor {
         let now = Decimal::from(Utc::now().timestamp_millis());
 
         let is_close_long = self.inventory > Decimal::ZERO && (
-            // 硬止损
-            (self.profit < dec!(-0.01))
+            // 硬止损,开单不久之后就在亏
+            (self.profit_high < dec!(0.001) && self.profit < dec!(-0.005))
+            // 浮动止损,如果profit_high较高产生了利润,但后续不给力
+            || (self.profit_high - self.profit > dec!(0.01) && self.profit < Decimal::ZERO)
             // 利润较大时,追踪止盈
-            || (self.profit > dec!(0.01) && self.profit < self.profit_high * dec!(0.75))
+            || (self.profit > dec!(0.005) && self.profit < self.profit_high * dec!(0.75))
         );
         let is_close_short = self.inventory < Decimal::ZERO && (
             // 硬止损
@@ -513,8 +515,8 @@ impl Predictor {
         );
 
         let is_open_long = self.inventory.is_zero()
-            && self.fair_price > self.mid_price * (Decimal::ONE + self.params.open)
-            && self.r_short < dec!(-0.0005)
+            && self.fair_price > self.mid_price * dec!(1.0001)
+            && self.r_short < -self.params.open
             // && self.trend < dec!(0.999)
             && self.speed < dec!(0.1)
         ;