作者 karlet

feat:获取挂单

... ... @@ -802,4 +802,24 @@ class CmBroker
}
return null;
}
public function getOrderPending($symbol): array
{
if ($this->plat == self::PLAT_OKX) {
$symbolOri = $this->getSymbolOri($symbol);
$res = $this->exBroker->getOrderPending($symbolOri);
if (isset($res['data']) && isset($res['data'][0])) {
$orders = [];
foreach ($res['data'] as $key => $value) {
$order = WsDataOrder::TransferOkxOrder($value, $this->symbolInfos, function ($symbol) {
return $this->getSymbolSt($symbol);
});
$orders[] = $order;
}
return $orders;
}
} else {
new Exception("getOrderPending 该交易所未实现,请先实现代码");
}
return [];
}
}
... ...
... ... @@ -93,6 +93,13 @@ class Api
$method = 'GET';
return $this->request($path, $method, $param, $this->apiInfo);
}
//查询未成交订单
public function getOrderPending($param)
{
$path = '/api/v5/trade/order-pending';
$method = 'GET';
return $this->request($path, $method, $param, $this->apiInfo);
}
//撤销订单
public function cancelOrder($param)
{
... ...
... ... @@ -413,4 +413,12 @@ class ExBroker
}
return $this->api->getOrder($param);
}
public function getOrderPending($symbol)
{
$param = [
'instId' => $symbol,
'instType' => 'SWAP',
];
return $this->api->getOrderPending($param);
}
}
... ...