作者 karlet

feat:币安增加撤销订单

@@ -819,6 +819,12 @@ class CmBroker @@ -819,6 +819,12 @@ class CmBroker
819 if ($this->plat == self::PLAT_OKX) { 819 if ($this->plat == self::PLAT_OKX) {
820 return $this->exBroker->cancelOrder($symbolOri, $cliOrdId, $orderId); 820 return $this->exBroker->cancelOrder($symbolOri, $cliOrdId, $orderId);
821 } 821 }
  822 + if ($this->plat == self::PLAT_BINANCE) {
  823 + if ($cliOrdId != "") {
  824 + $cliOrdId = self::BN_FEE_KEY . $cliOrdId;
  825 + }
  826 + return $this->exBroker->cancelOrder($symbolOri, $cliOrdId, $orderId);
  827 + }
822 } 828 }
823 public function getOrder($symbol, $cliOrdId = "", $orderId = ""): ?WsDataOrder 829 public function getOrder($symbol, $cliOrdId = "", $orderId = ""): ?WsDataOrder
824 { 830 {
@@ -102,6 +102,13 @@ class Api @@ -102,6 +102,13 @@ class Api
102 $method = "GET"; 102 $method = "GET";
103 return $this->request($method, $url, $params, $this->apiInfo); 103 return $this->request($method, $url, $params, $this->apiInfo);
104 } 104 }
  105 + //取消订单
  106 + public function cancelOrder($params)
  107 + {
  108 + $url = "/fapi/v1/order";
  109 + $method = "DELETE";
  110 + return $this->request($method, $url, $params, $this->apiInfo);
  111 + }
105 112
106 //------------------------------------ 113 //------------------------------------
107 114
@@ -297,4 +297,18 @@ class ExBroker @@ -297,4 +297,18 @@ class ExBroker
297 $res = $this->apiSpot->account([]); 297 $res = $this->apiSpot->account([]);
298 var_dump($res); 298 var_dump($res);
299 } 299 }
  300 + //取消订单
  301 + public function cancelOrder($symbol, $cliOrdId = "", $ordId = "")
  302 + {
  303 + $param = [
  304 + 'symbol' => $symbol
  305 + ];
  306 + if ($cliOrdId != "") {
  307 + $param['origClientOrderId'] = $cliOrdId;
  308 + }
  309 + if ($ordId != "") {
  310 + $param['orderId'] = $ordId;
  311 + }
  312 + return $this->api->cancelOrder($param);
  313 + }
300 } 314 }