skyffire 1 年間 前
コミット
c6bcaebcff
1 ファイル変更2 行追加2 行削除
  1. 2 2
      strategy/src/avellaneda_stoikov.rs

+ 2 - 2
strategy/src/avellaneda_stoikov.rs

@@ -269,13 +269,13 @@ impl AvellanedaStoikov {
     }
 
     pub fn update_optimal_ask_and_bid(&mut self) {
-        self.optimal_ask_price = if self.inventory < Decimal::ZERO {
+        self.optimal_ask_price = if self.inventory > Decimal::ZERO {
             self.ref_price + self.ask_delta / Decimal::TWO
         } else {
             max(self.ref_price + self.ask_delta / Decimal::TWO, self.ask_price)
         };
 
-        self.optimal_bid_price = if self.inventory > Decimal::ZERO {
+        self.optimal_bid_price = if self.inventory < Decimal::ZERO {
             self.ref_price + self.ask_delta / Decimal::TWO
         } else {
             min(self.ref_price - self.bid_delta / Decimal::TWO, self.bid_price)