作者 karlet

feat:获取挂单

@@ -802,4 +802,24 @@ class CmBroker @@ -802,4 +802,24 @@ class CmBroker
802 } 802 }
803 return null; 803 return null;
804 } 804 }
  805 + public function getOrderPending($symbol): array
  806 + {
  807 + if ($this->plat == self::PLAT_OKX) {
  808 + $symbolOri = $this->getSymbolOri($symbol);
  809 + $res = $this->exBroker->getOrderPending($symbolOri);
  810 + if (isset($res['data']) && isset($res['data'][0])) {
  811 + $orders = [];
  812 + foreach ($res['data'] as $key => $value) {
  813 + $order = WsDataOrder::TransferOkxOrder($value, $this->symbolInfos, function ($symbol) {
  814 + return $this->getSymbolSt($symbol);
  815 + });
  816 + $orders[] = $order;
  817 + }
  818 + return $orders;
  819 + }
  820 + } else {
  821 + new Exception("getOrderPending 该交易所未实现,请先实现代码");
  822 + }
  823 + return [];
  824 + }
805 } 825 }
@@ -93,6 +93,13 @@ class Api @@ -93,6 +93,13 @@ class Api
93 $method = 'GET'; 93 $method = 'GET';
94 return $this->request($path, $method, $param, $this->apiInfo); 94 return $this->request($path, $method, $param, $this->apiInfo);
95 } 95 }
  96 + //查询未成交订单
  97 + public function getOrderPending($param)
  98 + {
  99 + $path = '/api/v5/trade/order-pending';
  100 + $method = 'GET';
  101 + return $this->request($path, $method, $param, $this->apiInfo);
  102 + }
96 //撤销订单 103 //撤销订单
97 public function cancelOrder($param) 104 public function cancelOrder($param)
98 { 105 {
@@ -413,4 +413,12 @@ class ExBroker @@ -413,4 +413,12 @@ class ExBroker
413 } 413 }
414 return $this->api->getOrder($param); 414 return $this->api->getOrder($param);
415 } 415 }
  416 + public function getOrderPending($symbol)
  417 + {
  418 + $param = [
  419 + 'instId' => $symbol,
  420 + 'instType' => 'SWAP',
  421 + ];
  422 + return $this->api->getOrderPending($param);
  423 + }
416 } 424 }