作者 karlet

feat;增加查询订单

... ... @@ -787,4 +787,18 @@ class CmBroker
return $this->exBroker->cancelOrder($symbolOri, $cliOrdId, $orderId);
}
}
public function getOrder($symbol, $cliOrdId = "", $orderId = ""): ?WsDataOrder
{
$symbolOri = $this->getSymbolOri($symbol);
if ($this->plat == self::PLAT_OKX) {
$res = $this->exBroker->getOrder($symbolOri, $cliOrdId, $orderId);
if (isset($res['data']) && isset($res['data'][0])) {
$data = $res['data'][0];
return WsDataOrder::TransferOkxOrder($data, $this->symbolInfos, function ($symbol) {
return $this->getSymbolSt($symbol);
});
}
}
return null;
}
}
... ...
... ... @@ -86,6 +86,13 @@ class Api
$method = 'POST';
return $this->request($path, $method, $param, $this->apiInfo);
}
//查询订单
public function getOrder($param)
{
$path = '/api/v5/trade/order';
$method = 'GET';
return $this->request($path, $method, $param, $this->apiInfo);
}
//撤销订单
public function cancelOrder($param)
{
... ... @@ -121,6 +128,7 @@ class Api
$method = 'POST';
return $this->request($path, $method, $param, $this->apiInfo);
}
//获取账户配置
public function getAccountConfig($param = [])
{
$path = '/api/v5/account/config';
... ...
... ... @@ -400,4 +400,17 @@ class ExBroker
}
return $this->api->cancelOrder($param);
}
public function getOrder($symbol, $cliOrdId = "", $ordId = "")
{
$param = [
'instId' => $symbol
];
if ($cliOrdId != "") {
$param['clOrdId'] = $cliOrdId;
}
if ($ordId != "") {
$param['ordId'] = $ordId;
}
return $this->api->getOrder($param);
}
}
... ...