正在显示
3 个修改的文件
包含
27 行增加
和
0 行删除
| @@ -780,4 +780,11 @@ class CmBroker | @@ -780,4 +780,11 @@ class CmBroker | ||
| 780 | $this->posMode = $config['posMode'] == 'long_short_mode' ? self::MODE_TWO_SIDE : self::MODE_ONE_SIDE; | 780 | $this->posMode = $config['posMode'] == 'long_short_mode' ? self::MODE_TWO_SIDE : self::MODE_ONE_SIDE; |
| 781 | } | 781 | } |
| 782 | } | 782 | } |
| 783 | + public function cancelOrder($symbol, $cliOrdId = "", $orderId = "") | ||
| 784 | + { | ||
| 785 | + $symbolOri = $this->getSymbolOri($symbol); | ||
| 786 | + if ($this->plat == self::PLAT_OKX) { | ||
| 787 | + $this->exBroker->cancelOrder($symbolOri, $cliOrdId, $orderId); | ||
| 788 | + } | ||
| 789 | + } | ||
| 783 | } | 790 | } |
| @@ -86,6 +86,13 @@ class Api | @@ -86,6 +86,13 @@ class Api | ||
| 86 | $method = 'POST'; | 86 | $method = 'POST'; |
| 87 | return $this->request($path, $method, $param, $this->apiInfo); | 87 | return $this->request($path, $method, $param, $this->apiInfo); |
| 88 | } | 88 | } |
| 89 | + //撤销订单 | ||
| 90 | + public function cancelOrder($param) | ||
| 91 | + { | ||
| 92 | + $path = '/api/v5/trade/cancel-order'; | ||
| 93 | + $method = 'POST'; | ||
| 94 | + return $this->request($path, $method, $param, $this->apiInfo); | ||
| 95 | + } | ||
| 89 | //查看账户余额 | 96 | //查看账户余额 |
| 90 | public function accountBalance($param) | 97 | public function accountBalance($param) |
| 91 | { | 98 | { |
| @@ -387,4 +387,17 @@ class ExBroker | @@ -387,4 +387,17 @@ class ExBroker | ||
| 387 | { | 387 | { |
| 388 | return $this->api->getAccountConfig(); | 388 | return $this->api->getAccountConfig(); |
| 389 | } | 389 | } |
| 390 | + public function cancelOrder($symbol, $cliOrdId = "", $ordId = "") | ||
| 391 | + { | ||
| 392 | + $param = [ | ||
| 393 | + 'instId' => $symbol | ||
| 394 | + ]; | ||
| 395 | + if ($cliOrdId != "") { | ||
| 396 | + $param['clOrdId'] = $cliOrdId; | ||
| 397 | + } | ||
| 398 | + if ($ordId != "") { | ||
| 399 | + $param['ordId'] = $ordId; | ||
| 400 | + } | ||
| 401 | + return $this->api->cancelOrder($param); | ||
| 402 | + } | ||
| 390 | } | 403 | } |
-
请 注册 或 登录 后发表评论