|
|
@@ -166,9 +166,6 @@ impl Platform for BitgetSpot {
|
|
|
|
|
|
let tick_size = Decimal::from_str(&format!("0.{}", "0".repeat(usize::try_from(price_precision).unwrap()))).unwrap();
|
|
|
let amount_size = Decimal::from_str(&format!("0.{}", "0".repeat(usize::try_from(amount_precision).unwrap()))).unwrap();
|
|
|
- let ct_val = Decimal::ONE;
|
|
|
- let min_notional = min_qty * ct_val;
|
|
|
- let max_notional = max_qty * ct_val;
|
|
|
|
|
|
let result = Market {
|
|
|
symbol: format!("{}_{}", base_asset, quote_asset),
|
|
|
@@ -180,9 +177,9 @@ impl Platform for BitgetSpot {
|
|
|
amount_precision,
|
|
|
min_qty,
|
|
|
max_qty,
|
|
|
- min_notional,
|
|
|
- max_notional,
|
|
|
- ct_val,
|
|
|
+ min_notional: min_qty,
|
|
|
+ max_notional: max_qty,
|
|
|
+ ct_val: Decimal::ONE,
|
|
|
};
|
|
|
Ok(result)
|
|
|
}
|
|
|
@@ -214,9 +211,6 @@ impl Platform for BitgetSpot {
|
|
|
|
|
|
let tick_size = Decimal::from_str(&format!("0.{}", "0".repeat(usize::try_from(price_precision).unwrap()))).unwrap();
|
|
|
let amount_size = Decimal::from_str(&format!("0.{}", "0".repeat(usize::try_from(amount_precision).unwrap()))).unwrap();
|
|
|
- let ct_val = Decimal::ONE;
|
|
|
- let min_notional = min_qty * ct_val;
|
|
|
- let max_notional = max_qty * ct_val;
|
|
|
|
|
|
let result = Market {
|
|
|
symbol: format!("{}_{}", base_asset, quote_asset),
|
|
|
@@ -228,9 +222,9 @@ impl Platform for BitgetSpot {
|
|
|
amount_precision,
|
|
|
min_qty,
|
|
|
max_qty,
|
|
|
- min_notional,
|
|
|
- max_notional,
|
|
|
- ct_val,
|
|
|
+ min_notional: min_qty,
|
|
|
+ max_notional: max_qty,
|
|
|
+ ct_val: Decimal::ONE,
|
|
|
};
|
|
|
Ok(result)
|
|
|
}
|
|
|
@@ -273,12 +267,16 @@ impl Platform for BitgetSpot {
|
|
|
let mut params = json!({
|
|
|
"symbol": symbol_format.to_string(),
|
|
|
"clientOid": custom_id,
|
|
|
- "orderType": "limit",
|
|
|
"price": price.to_string(),
|
|
|
- "force": "gtc"
|
|
|
});
|
|
|
- let size = amount;
|
|
|
- params["size"] = json!(size);
|
|
|
+ if price.eq(&Decimal::ZERO) {
|
|
|
+ params["orderType"] = json!("market");
|
|
|
+ params["force"] = json!("post_only ");
|
|
|
+ } else {
|
|
|
+ params["orderType"] = json!("limit");
|
|
|
+ params["force"] = json!("gtc");
|
|
|
+ };
|
|
|
+ params["size"] = json!(amount);
|
|
|
match origin_side {
|
|
|
"kd" => {
|
|
|
params["side"] = json!("buy");
|
|
|
@@ -315,16 +313,21 @@ impl Platform for BitgetSpot {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async fn take_order_symbol(&mut self, symbol: String, custom_id: &str, origin_side: &str, price: Decimal, amount: Decimal) -> Result<Order, Error> {
|
|
|
+ async fn take_order_symbol(&mut self, symbol: String, ct_val: Decimal, custom_id: &str, origin_side: &str, price: Decimal, amount: Decimal) -> Result<Order, Error> {
|
|
|
let symbol_format = utils::format_symbol(symbol.clone(), "");
|
|
|
let mut params = json!({
|
|
|
"symbol": symbol_format.to_string(),
|
|
|
"clientOid": custom_id,
|
|
|
- "orderType": "limit",
|
|
|
"price": price.to_string(),
|
|
|
- "force": "gtc"
|
|
|
});
|
|
|
- let size = amount;
|
|
|
+ if price.eq(&Decimal::ZERO) {
|
|
|
+ params["orderType"] = json!("market");
|
|
|
+ params["force"] = json!("post_only");
|
|
|
+ } else {
|
|
|
+ params["orderType"] = json!("limit");
|
|
|
+ params["force"] = json!("gtc");
|
|
|
+ };
|
|
|
+ let size = (amount / ct_val).floor();
|
|
|
params["size"] = json!(size);
|
|
|
match origin_side {
|
|
|
"kd" => {
|