skyfffire 3 settimane fa
parent
commit
346365b7fa
1 ha cambiato i file con 7 aggiunte e 4 eliminazioni
  1. 7 4
      src/exchange/extended_rest_client.rs

+ 7 - 4
src/exchange/extended_rest_client.rs

@@ -162,7 +162,7 @@ impl ExtendedRestClient {
         // qty
         // price
         let time_in_force = "GTT";
-        let expiry_epoch_millis = Utc::now().timestamp_millis() + (24 * 60 * 60 * 1000);
+        let expiry_epoch_millis = Utc::now().timestamp_millis() + (60 * 60 * 1000);
         let nonce_u32: u32 = rand::random();
         let nonce = nonce_u32.to_string();
         let self_trade_protection_level = "ACCOUNT";
@@ -265,11 +265,14 @@ impl ExtendedRestClient {
             "price": price,
             "timeInForce": time_in_force,
             "expiryEpochMillis": expiry_epoch_millis,
-            "fee": fee_amount,
-            "nonce": nonce,
+            "fee": total_fee_rate.to_string(),
+            "nonce": nonce_u32,
+            "postOnly": false,
+            "reduceOnly": false,
             "settlement": settlement,
             "selfTradeProtectionLevel": self_trade_protection_level,
         });
+        info!("{}", serde_json::to_string_pretty(&params)?);
 
         // 发送订单
         Ok(self.request("POST",
@@ -496,7 +499,7 @@ mod tests {
     async fn test_create_order() {
         let _guard = setup_logging().unwrap();
         let mut client = get_client().await;
-        let response_result = client.post_order("limit", "BUY", "0.0001", "90000").await;
+        let response_result = client.post_order("LIMIT", "BUY", "0.0001", "100000").await;
 
         match response_result {
             Ok(response) => {