Browse Source

gate乘数标准化。

skyffire 1 year ago
parent
commit
41f913f2f1
2 changed files with 7 additions and 5 deletions
  1. 5 5
      standard/src/gate_swap.rs
  2. 2 0
      strategy/src/gate_usdt_swap.rs

+ 5 - 5
standard/src/gate_swap.rs

@@ -276,13 +276,13 @@ impl Platform for GateSwap {
                     let tick_size = Decimal::from_str(value["order_price_round"].as_str().unwrap()).unwrap();
                     let min_qty = Decimal::from_str(&value["order_size_min"].to_string()).unwrap();
                     let max_qty = Decimal::from_str(&value["order_size_max"].to_string()).unwrap();
-                    let ct_val = Decimal::from_str(value["quanto_multiplier"].as_str().unwrap()).unwrap();
+                    let multiplier = Decimal::from_str(value["quanto_multiplier"].as_str().unwrap()).unwrap();
 
-                    let amount_size = min_qty * ct_val;
+                    let amount_size = min_qty * multiplier;
                     let price_precision = Decimal::from_u32(tick_size.scale()).unwrap();
                     let amount_precision = Decimal::from_u32(amount_size.scale()).unwrap();
-                    let min_notional = min_qty * ct_val;
-                    let max_notional = max_qty * ct_val;
+                    let min_notional = min_qty * multiplier;
+                    let max_notional = max_qty * multiplier;
 
                     let result = Market {
                         symbol: name.to_string(),
@@ -296,7 +296,7 @@ impl Platform for GateSwap {
                         max_qty,
                         min_notional,
                         max_notional,
-                        multiplier: ct_val,
+                        multiplier,
                     };
                     Ok(result)
                 }

+ 2 - 0
strategy/src/gate_usdt_swap.rs

@@ -111,6 +111,8 @@ async fn on_data(core_arc: Arc<Mutex<Core>>,
             let depth = ExchangeStructHandler::book_ticker_handle(ExchangeEnum::GateSwap, response, multiplier);
             trace_stack.on_after_format();
 
+            let mp = (depth.asks[0].price + depth.bids[0].price) / Decimal::TWO;
+            core_arc.lock().await.strategy.min_amount_value = multiplier * mp;
             on_depth(core_arc, &response.label, &mut trace_stack, &depth).await;
         }
         "futures.trades" => {