作者 karlet

feat:增加取消订单

... ... @@ -780,4 +780,11 @@ class CmBroker
$this->posMode = $config['posMode'] == 'long_short_mode' ? self::MODE_TWO_SIDE : self::MODE_ONE_SIDE;
}
}
public function cancelOrder($symbol, $cliOrdId = "", $orderId = "")
{
$symbolOri = $this->getSymbolOri($symbol);
if ($this->plat == self::PLAT_OKX) {
$this->exBroker->cancelOrder($symbolOri, $cliOrdId, $orderId);
}
}
}
... ...
... ... @@ -86,6 +86,13 @@ class Api
$method = 'POST';
return $this->request($path, $method, $param, $this->apiInfo);
}
//撤销订单
public function cancelOrder($param)
{
$path = '/api/v5/trade/cancel-order';
$method = 'POST';
return $this->request($path, $method, $param, $this->apiInfo);
}
//查看账户余额
public function accountBalance($param)
{
... ...
... ... @@ -387,4 +387,17 @@ class ExBroker
{
return $this->api->getAccountConfig();
}
public function cancelOrder($symbol, $cliOrdId = "", $ordId = "")
{
$param = [
'instId' => $symbol
];
if ($cliOrdId != "") {
$param['clOrdId'] = $cliOrdId;
}
if ($ordId != "") {
$param['ordId'] = $ordId;
}
return $this->api->cancelOrder($param);
}
}
... ...