|
|
@@ -413,12 +413,17 @@ impl Platform for BybitSwap {
|
|
|
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_upper = symbol.replace("_", "").trim().to_uppercase();
|
|
|
let size = (amount / ct_val).floor();
|
|
|
+ let order_type = if price == Decimal::ZERO {
|
|
|
+ "Market"
|
|
|
+ } else {
|
|
|
+ "Limit"
|
|
|
+ };
|
|
|
let mut params = json!({
|
|
|
"orderLinkId": format!("t-{}", custom_id),
|
|
|
"symbol": symbol_upper,
|
|
|
"price": price.to_string(),
|
|
|
"category": "linear",
|
|
|
- "orderType":"Limit",
|
|
|
+ "orderType": order_type,
|
|
|
"qty": json!(size),
|
|
|
// 0.單向持倉 1.買側雙向持倉 2.賣側雙向持倉
|
|
|
"positionIdx": json!(1),
|
|
|
@@ -577,7 +582,7 @@ impl Platform for BybitSwap {
|
|
|
result_sd.send(order).await.unwrap();
|
|
|
}
|
|
|
Err(_err) => {
|
|
|
- // error!("撤单失败,而且查单也失败了,gate_io_swap,oid={}, cid={}。", order_id.clone(), custom_id.clone());
|
|
|
+ error!("bybit:撤单失败,而且查单也失败了,oid={}, cid={}。", order_id.clone(), custom_id.clone());
|
|
|
// panic!("撤单失败,而且查单也失败了,gate_io_swap,oid={}, cid={}。", order_id.clone(), custom_id.clone());
|
|
|
}
|
|
|
}
|
|
|
@@ -617,6 +622,8 @@ impl Platform for BybitSwap {
|
|
|
result_sd.send(result).await.unwrap();
|
|
|
}
|
|
|
Err(error) => {
|
|
|
+ error!("bybit:下单失败:{:?}", error);
|
|
|
+
|
|
|
let mut err_order = Order::new();
|
|
|
err_order.custom_id = cid.clone();
|
|
|
err_order.status = "REMOVE".to_string();
|