|
@@ -162,7 +162,7 @@ impl ExtendedRestClient {
|
|
|
// qty
|
|
// qty
|
|
|
// price
|
|
// price
|
|
|
let time_in_force = "GTT";
|
|
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_u32: u32 = rand::random();
|
|
|
let nonce = nonce_u32.to_string();
|
|
let nonce = nonce_u32.to_string();
|
|
|
let self_trade_protection_level = "ACCOUNT";
|
|
let self_trade_protection_level = "ACCOUNT";
|
|
@@ -265,11 +265,14 @@ impl ExtendedRestClient {
|
|
|
"price": price,
|
|
"price": price,
|
|
|
"timeInForce": time_in_force,
|
|
"timeInForce": time_in_force,
|
|
|
"expiryEpochMillis": expiry_epoch_millis,
|
|
"expiryEpochMillis": expiry_epoch_millis,
|
|
|
- "fee": fee_amount,
|
|
|
|
|
- "nonce": nonce,
|
|
|
|
|
|
|
+ "fee": total_fee_rate.to_string(),
|
|
|
|
|
+ "nonce": nonce_u32,
|
|
|
|
|
+ "postOnly": false,
|
|
|
|
|
+ "reduceOnly": false,
|
|
|
"settlement": settlement,
|
|
"settlement": settlement,
|
|
|
"selfTradeProtectionLevel": self_trade_protection_level,
|
|
"selfTradeProtectionLevel": self_trade_protection_level,
|
|
|
});
|
|
});
|
|
|
|
|
+ info!("{}", serde_json::to_string_pretty(¶ms)?);
|
|
|
|
|
|
|
|
// 发送订单
|
|
// 发送订单
|
|
|
Ok(self.request("POST",
|
|
Ok(self.request("POST",
|
|
@@ -496,7 +499,7 @@ mod tests {
|
|
|
async fn test_create_order() {
|
|
async fn test_create_order() {
|
|
|
let _guard = setup_logging().unwrap();
|
|
let _guard = setup_logging().unwrap();
|
|
|
let mut client = get_client().await;
|
|
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 {
|
|
match response_result {
|
|
|
Ok(response) => {
|
|
Ok(response) => {
|