From 122810939e5efd92311d52c5ae7aca40ff2b9ff3 Mon Sep 17 00:00:00 2001 From: Fieyum Date: Tue, 28 May 2024 15:38:15 +0800 Subject: [PATCH] fix readme --- README.md | 180 ++++++++++++++++++++------------------- phpunit.xml | 2 +- src/Api.php | 4 +- src/PrivateApi/Order.php | 15 ++++ tests/OrderTest.php | 26 ++++++ 5 files changed, 138 insertions(+), 89 deletions(-) diff --git a/README.md b/README.md index 43bb2e5..be6219d 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,13 @@ ## Requirements -| Dependency | Requirement | -| -------- | -------- | -| [PHP](https://secure.php.net/manual/en/install.php) | `>=5.5.0` `Recommend PHP7+` | -| [guzzlehttp/guzzle](https://github.com/guzzle/guzzle) | `~6.0` | +| Dependency | Requirement | +|-------------------------------------------------------|-----------------------------| +| [PHP](https://secure.php.net/manual/en/install.php) | `>=5.5.0` `Recommend PHP7+` | +| [guzzlehttp/guzzle](https://github.com/guzzle/guzzle) | `~6.0` | ## Install + > Install package via [Composer](https://getcomposer.org/). ```shell @@ -26,10 +27,9 @@ composer require "kucoin/kucoin-futures-php-sdk:~1.0.0" ### Choose environment -| Environment | BaseUri | -| -------- | -------- | +| Environment | BaseUri | +|--------------|-------------------------------------------| | *Production* | `https://api-futures.kucoin.com(DEFAULT)` | -| *Sandbox* | `https://api-sandbox-futures.kucoin.com` | ```php use KuCoin\Futures\SDK\KuCoinFuturesApi; @@ -51,6 +51,7 @@ KuCoinFuturesApi::getLogger()->debug("I'm a debug message"); ``` ### Examples + > See the [test case](tests) for more examples. #### Example of API `without` authentication @@ -66,8 +67,9 @@ var_dump($timestamp); #### Example of API `with` authentication ##### **Note** -To reinforce the security of the API, KuCoin upgraded the API key to version 2.0, the validation logic has also been changed. It is recommended to create(https://www.kucoin.com/account/api) and update your API key to version 2.0. The API key of version 1.0 will be still valid until May 1, 2021 +To reinforce the security of the API, KuCoin upgraded the API key to version 2.0, the validation logic has also been changed. It is recommended to create(https://www.kucoin.com/account/api) and update your API key to version 2.0. The API key of +version 1.0 will be still valid until May 1, 2021 ```php use KuCoin\Futures\SDK\Auth; @@ -140,6 +142,7 @@ $api->subscribePublicChannels($query, $channels, function (array $message, WebSo ``` #### ⚡️Coroutine HTTP client for asynchronous IO + > See the [benchmark](examples/BenchmarkCoroutine.php), almost `20x` faster than `curl`. ```bash @@ -197,144 +200,149 @@ go(function () {
KuCoin\Futures\SDK\PrivateApi\Account -| API | Authentication | Description | -| -------- | -------- | -------- | -| KuCoin\Futures\SDK\PrivateApi\Account::getOverview() | YES | https://docs.kucoin.com/futures/#account | -| KuCoin\Futures\SDK\PrivateApi\Account::getTransactionHistory() | YES | https://docs.kucoin.com/futures/#get-transaction-history | -| KuCoin\Futures\SDK\PrivateApi\Account::transferIn() | YES |`deprecated`| -| KuCoin\Futures\SDK\PrivateApi\Account::transferOut() | YES | `deprecated` https://docs.kucoin.com/futures/#transfer-funds-to-kucoin-main-account | -| KuCoin\Futures\SDK\PrivateApi\Account::transferOutV2() | YES | https://docs.kucoin.com/futures/#transfer-funds-to-kucoin-main-account-2 | -| KuCoin\Futures\SDK\PrivateApi\Account::cancelTransferOut() | YES | `deprecated` https://docs.kucoin.com/futures/#cancel-transfer-out-request | -| KuCoin\Futures\SDK\PrivateApi\Account::getTransferList() | YES | https://docs.kucoin.com/futures/#get-transfer-out-request-records | -| KuCoin\Futures\SDK\PrivateApi\Account::getSubApikey() | YES | https://docs.kucoin.com/futures/#get-sub-account-futures-api-list | -| KuCoin\Futures\SDK\PrivateApi\Account::createSubApikey() | YES | https://docs.kucoin.com/futures/#create-futures-apis-for-sub-account | -| KuCoin\Futures\SDK\PrivateApi\Account::modifySubApikey() | YES | https://docs.kucoin.com/futures/#modify-sub-account-futures-apis | -| KuCoin\Futures\SDK\PrivateApi\Account::deleteSubApikey() | YES | https://docs.kucoin.com/futures/#delete-sub-account-futures-apis | -| KuCoin\Futures\SDK\PrivateApi\Account::transferOutV3() | YES | https://docs.kucoin.com/futures/#transfer-to-main-or-trade-account | +| API | Authentication | Description | +|----------------------------------------------------------------|----------------|-------------------------------------------------------------------------------------| +| KuCoin\Futures\SDK\PrivateApi\Account::getOverview() | YES | https://docs.kucoin.com/futures/#account | +| KuCoin\Futures\SDK\PrivateApi\Account::getTransactionHistory() | YES | https://docs.kucoin.com/futures/#get-transaction-history | +| KuCoin\Futures\SDK\PrivateApi\Account::transferIn() | YES | `deprecated` | +| KuCoin\Futures\SDK\PrivateApi\Account::transferOut() | YES | `deprecated` https://docs.kucoin.com/futures/#transfer-funds-to-kucoin-main-account | +| KuCoin\Futures\SDK\PrivateApi\Account::transferOutV2() | YES | https://docs.kucoin.com/futures/#transfer-funds-to-kucoin-main-account-2 | +| KuCoin\Futures\SDK\PrivateApi\Account::cancelTransferOut() | YES | `deprecated` https://docs.kucoin.com/futures/#cancel-transfer-out-request | +| KuCoin\Futures\SDK\PrivateApi\Account::getTransferList() | YES | https://docs.kucoin.com/futures/#get-transfer-out-request-records | +| KuCoin\Futures\SDK\PrivateApi\Account::getSubApikey() | YES | https://docs.kucoin.com/futures/#get-sub-account-futures-api-list | +| KuCoin\Futures\SDK\PrivateApi\Account::createSubApikey() | YES | https://docs.kucoin.com/futures/#create-futures-apis-for-sub-account | +| KuCoin\Futures\SDK\PrivateApi\Account::modifySubApikey() | YES | https://docs.kucoin.com/futures/#modify-sub-account-futures-apis | +| KuCoin\Futures\SDK\PrivateApi\Account::deleteSubApikey() | YES | https://docs.kucoin.com/futures/#delete-sub-account-futures-apis | +| KuCoin\Futures\SDK\PrivateApi\Account::transferOutV3() | YES | https://docs.kucoin.com/futures/#transfer-to-main-or-trade-account | +
KuCoin\Futures\SDK\PrivateApi\Deposit -| API | Authentication | Description | -| -------- | -------- | -------- | -| KuCoin\Futures\SDK\PrivateApi\Deposit::getAddress() | YES | https://docs.kucoin.com/futures/#get-deposit-address | -| KuCoin\Futures\SDK\PrivateApi\Deposit::getDeposits() | YES | https://docs.kucoin.com/futures/#get-deposit-list | +| API | Authentication | Description | +|------------------------------------------------------|----------------|------------------------------------------------------| +| KuCoin\Futures\SDK\PrivateApi\Deposit::getAddress() | YES | https://docs.kucoin.com/futures/#get-deposit-address | +| KuCoin\Futures\SDK\PrivateApi\Deposit::getDeposits() | YES | https://docs.kucoin.com/futures/#get-deposit-list |
KuCoin\Futures\SDK\PrivateApi\Fill -| API | Authentication | Description | -| -------- | -------- | -------- | -| KuCoin\Futures\SDK\PrivateApi\Fill::getFills() | YES | https://docs.kucoin.com/futures/#get-fills | -| KuCoin\Futures\SDK\PrivateApi\Fill::getRecentList() | YES | https://docs.kucoin.com/futures/#recent-fills | +| API | Authentication | Description | +|-----------------------------------------------------|----------------|-----------------------------------------------| +| KuCoin\Futures\SDK\PrivateApi\Fill::getFills() | YES | https://docs.kucoin.com/futures/#get-fills | +| KuCoin\Futures\SDK\PrivateApi\Fill::getRecentList() | YES | https://docs.kucoin.com/futures/#recent-fills | +
KuCoin\Futures\SDK\PrivateApi\Order -| API | Authentication | Description | -| -------- | -------- | -------- | -| KuCoin\Futures\SDK\PrivateApi\Order::create() | YES | https://docs.kucoin.com/futures/#place-an-order | -| KuCoin\Futures\SDK\PrivateApi\Order::cancel() | YES | https://docs.kucoin.com/futures/#cancel-an-order | -| KuCoin\Futures\SDK\PrivateApi\Order::batchCancel() | YES | https://docs.kucoin.com/futures/#limit-order-mass-cancelation | -| KuCoin\Futures\SDK\PrivateApi\Order::stopOrders() | YES | https://docs.kucoin.com/futures/#stop-order-mass-cancelation | -| KuCoin\Futures\SDK\PrivateApi\Order::getList() | YES | https://docs.kucoin.com/futures/#get-order-list | -| KuCoin\Futures\SDK\PrivateApi\Order::getStopOrders() | YES | https://docs.kucoin.com/futures/#get-untriggered-stop-order-list | -| KuCoin\Futures\SDK\PrivateApi\Order::getRecentDoneOrders() | YES | https://docs.kucoin.com/futures/#get-list-of-orders-completed-in-24h | -| KuCoin\Futures\SDK\PrivateApi\Order::getDetail() | YES | https://docs.kucoin.com/futures/#get-details-of-a-single-order | -| KuCoin\Futures\SDK\PrivateApi\Order::getDetailByClientOid() | YES | https://docs.kucoin.com/futures/#get-details-of-a-single-order | -| KuCoin\Futures\SDK\PrivateApi\Order::getOpenOrderStatistics() | YES | https://docs.kucoin.com/futures/#active-order-value-calculation | -| KuCoin\Futures\SDK\PrivateApi\Order::cancelByClientOid() | YES | https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-order-by-clientoid| +| API | Authentication | Description | +|---------------------------------------------------------------|----------------|-----------------------------------------------------------------------------------| +| KuCoin\Futures\SDK\PrivateApi\Order::create() | YES | https://docs.kucoin.com/futures/#place-an-order | +| KuCoin\Futures\SDK\PrivateApi\Order::cancel() | YES | https://docs.kucoin.com/futures/#cancel-an-order | +| KuCoin\Futures\SDK\PrivateApi\Order::batchCancel() | YES | https://docs.kucoin.com/futures/#limit-order-mass-cancelation | +| KuCoin\Futures\SDK\PrivateApi\Order::stopOrders() | YES | https://docs.kucoin.com/futures/#stop-order-mass-cancelation | +| KuCoin\Futures\SDK\PrivateApi\Order::getList() | YES | https://docs.kucoin.com/futures/#get-order-list | +| KuCoin\Futures\SDK\PrivateApi\Order::getStopOrders() | YES | https://docs.kucoin.com/futures/#get-untriggered-stop-order-list | +| KuCoin\Futures\SDK\PrivateApi\Order::getRecentDoneOrders() | YES | https://docs.kucoin.com/futures/#get-list-of-orders-completed-in-24h | +| KuCoin\Futures\SDK\PrivateApi\Order::getDetail() | YES | https://docs.kucoin.com/futures/#get-details-of-a-single-order | +| KuCoin\Futures\SDK\PrivateApi\Order::getDetailByClientOid() | YES | https://docs.kucoin.com/futures/#get-details-of-a-single-order | +| KuCoin\Futures\SDK\PrivateApi\Order::getOpenOrderStatistics() | YES | https://docs.kucoin.com/futures/#active-order-value-calculation | +| KuCoin\Futures\SDK\PrivateApi\Order::cancelByClientOid() | YES | https://www.kucoin.com/docs/rest/futures-trading/orders/cancel-order-by-clientoid | +| KuCoin\Futures\SDK\PrivateApi\Order::createTest() | YES | https://www.kucoin.com/docs/rest/futures-trading/orders/place-order-test |
KuCoin\Futures\SDK\PrivateApi\Position -| API | Authentication | Description | -| -------- | -------- | -------- | -| KuCoin\Futures\SDK\PrivateApi\Position::getList() | YES | https://docs.kucoin.com/futures/#get-position-list | -| KuCoin\Futures\SDK\PrivateApi\Position::getDetail() | YES | https://docs.kucoin.com/futures/#get-position-details | -| KuCoin\Futures\SDK\PrivateApi\Position::changeAutoAppendStatus() | YES | https://docs.kucoin.com/futures/#enable-disable-of-auto-deposit-margin | -| KuCoin\Futures\SDK\PrivateApi\Position::marginAppend() | YES | https://docs.kucoin.com/futures/#add-margin-manually | +| API | Authentication | Description | +|------------------------------------------------------------------|----------------|------------------------------------------------------------------------| +| KuCoin\Futures\SDK\PrivateApi\Position::getList() | YES | https://docs.kucoin.com/futures/#get-position-list | +| KuCoin\Futures\SDK\PrivateApi\Position::getDetail() | YES | https://docs.kucoin.com/futures/#get-position-details | +| KuCoin\Futures\SDK\PrivateApi\Position::changeAutoAppendStatus() | YES | https://docs.kucoin.com/futures/#enable-disable-of-auto-deposit-margin | +| KuCoin\Futures\SDK\PrivateApi\Position::marginAppend() | YES | https://docs.kucoin.com/futures/#add-margin-manually | +
KuCoin\Futures\SDK\PrivateApi\WebSocketFeed -| API | Authentication | Description | -| -------- | -------- | -------- | -| KuCoin\Futures\SDK\PrivateApi\WebSocketFeed::getPublicServer() | NO | https://docs.kucoin.com/futures/#apply-connect-token | -| KuCoin\Futures\SDK\PrivateApi\WebSocketFeed::getPrivateServer() | YES | https://docs.kucoin.com/futures/#apply-connect-token | -| KuCoin\Futures\SDK\PrivateApi\WebSocketFeed::subscribePublicChannel() | NO | https://docs.kucoin.com/futures/#public-channels | -| KuCoin\Futures\SDK\PrivateApi\WebSocketFeed::subscribePublicChannels() | NO | https://docs.kucoin.com/futures/#public-channels | -| KuCoin\Futures\SDK\PrivateApi\WebSocketFeed::subscribePrivateChannel() | YES | https://docs.kucoin.com/futures/#private-channels | -| KuCoin\Futures\SDK\PrivateApi\WebSocketFeed::subscribePrivateChannels() | YES | https://docs.kucoin.com/futures/#private-channels | +| API | Authentication | Description | +|-------------------------------------------------------------------------|----------------|------------------------------------------------------| +| KuCoin\Futures\SDK\PrivateApi\WebSocketFeed::getPublicServer() | NO | https://docs.kucoin.com/futures/#apply-connect-token | +| KuCoin\Futures\SDK\PrivateApi\WebSocketFeed::getPrivateServer() | YES | https://docs.kucoin.com/futures/#apply-connect-token | +| KuCoin\Futures\SDK\PrivateApi\WebSocketFeed::subscribePublicChannel() | NO | https://docs.kucoin.com/futures/#public-channels | +| KuCoin\Futures\SDK\PrivateApi\WebSocketFeed::subscribePublicChannels() | NO | https://docs.kucoin.com/futures/#public-channels | +| KuCoin\Futures\SDK\PrivateApi\WebSocketFeed::subscribePrivateChannel() | YES | https://docs.kucoin.com/futures/#private-channels | +| KuCoin\Futures\SDK\PrivateApi\WebSocketFeed::subscribePrivateChannels() | YES | https://docs.kucoin.com/futures/#private-channels |
KuCoin\Futures\SDK\PrivateApi\Withdrawal -| API | Authentication | Description | -| -------- | -------- | -------- | -| KuCoin\Futures\SDK\PrivateApi\Withdrawal::getQuotas() | YES | https://docs.kucoin.com/futures/#get-withdrawal-limit | -| KuCoin\Futures\SDK\PrivateApi\Withdrawal::getList() | YES | https://docs.kucoin.com/futures/#get-withdrawal-list | -| KuCoin\Futures\SDK\PrivateApi\Withdrawal::apply() | YES | https://docs.kucoin.com/futures/#withdraw-funds | -| KuCoin\Futures\SDK\PrivateApi\Withdrawal::cancel() | YES | https://docs.kucoin.com/futures/#cancel-withdrawal | +| API | Authentication | Description | +|-------------------------------------------------------|----------------|-------------------------------------------------------| +| KuCoin\Futures\SDK\PrivateApi\Withdrawal::getQuotas() | YES | https://docs.kucoin.com/futures/#get-withdrawal-limit | +| KuCoin\Futures\SDK\PrivateApi\Withdrawal::getList() | YES | https://docs.kucoin.com/futures/#get-withdrawal-list | +| KuCoin\Futures\SDK\PrivateApi\Withdrawal::apply() | YES | https://docs.kucoin.com/futures/#withdraw-funds | +| KuCoin\Futures\SDK\PrivateApi\Withdrawal::cancel() | YES | https://docs.kucoin.com/futures/#cancel-withdrawal |
KuCoin\Futures\SDK\PrivateApi\RiskLimitLevel -| API | Authentication | Description | -| -------- | -------- | -------- | -| KuCoin\Futures\SDK\PrivateApi\RiskLimitLevel::getRiskLimitLevel | YES | https://docs.kucoin.com/futures/#obtain-futures-risk-limit-level | -| KuCoin\Futures\SDK\PrivateApi\RiskLimitLevel::changeRiskLimitLevel() | YES | https://docs.kucoin.com/futures/#adjust-risk-limit-level | +| API | Authentication | Description | +|----------------------------------------------------------------------|----------------|------------------------------------------------------------------| +| KuCoin\Futures\SDK\PrivateApi\RiskLimitLevel::getRiskLimitLevel | YES | https://docs.kucoin.com/futures/#obtain-futures-risk-limit-level | +| KuCoin\Futures\SDK\PrivateApi\RiskLimitLevel::changeRiskLimitLevel() | YES | https://docs.kucoin.com/futures/#adjust-risk-limit-level |
KuCoin\Futures\SDK\PublicApi\Symbol -| API | Authentication | Description | -| -------- | -------- |-------------------------------------------------------------------------| -| KuCoin\Futures\SDK\PublicApi\Symbol::getTicker() | NO | https://docs.kucoin.com/futures/#get-ticker | -| KuCoin\Futures\SDK\PublicApi\Symbol::getLevel2Snapshot() | NO | https://docs.kucoin.com/futures/#get-full-order-book-level-2 | -| KuCoin\Futures\SDK\PublicApi\Symbol::getLevel3Snapshot() | NO | https://docs.kucoin.com/futures/#get-full-order-book-level-3 | -| KuCoin\Futures\SDK\PublicApi\Symbol::getV2Level3Snapshot() | NO | https://docs.kucoin.com/futures/#get-full-order-book-level-3-v2 | -| KuCoin\Futures\SDK\PublicApi\Symbol::getLevel2Message() | NO | `deprecated` https://docs.kucoin.com/futures/##level-2-pulling-messages | -| KuCoin\Futures\SDK\PublicApi\Symbol::getLevel3Message() | NO | `deprecated` https://docs.kucoin.com/futures/##level-3-pulling-messages | -| KuCoin\Futures\SDK\PublicApi\Symbol::getTradeHistory() | NO | https://docs.kucoin.com/futures/#get-trade-histories | -| KuCoin\Futures\SDK\PublicApi\Symbol::getKLines() | NO | https://docs.kucoin.com/futures/?lang=en_US#get-k-line-data-of-contract | -| KuCoin\Futures\SDK\PublicApi\Symbol::getLevel2Depth20 | NO | https://docs.kucoin.com/futures/cn/#level-2-2 | -| KuCoin\Futures\SDK\PublicApi\Symbol::getLevel2Depth100 | NO | https://docs.kucoin.com/futures/cn/#level-2-2 | -| KuCoin\Futures\SDK\PublicApi\Symbol::getFundingRates | NO |https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-public-funding-history | +| API | Authentication | Description | +|------------------------------------------------------------|----------------|------------------------------------------------------------------------------------------| +| KuCoin\Futures\SDK\PublicApi\Symbol::getTicker() | NO | https://docs.kucoin.com/futures/#get-ticker | +| KuCoin\Futures\SDK\PublicApi\Symbol::getLevel2Snapshot() | NO | https://docs.kucoin.com/futures/#get-full-order-book-level-2 | +| KuCoin\Futures\SDK\PublicApi\Symbol::getLevel3Snapshot() | NO | https://docs.kucoin.com/futures/#get-full-order-book-level-3 | +| KuCoin\Futures\SDK\PublicApi\Symbol::getV2Level3Snapshot() | NO | https://docs.kucoin.com/futures/#get-full-order-book-level-3-v2 | +| KuCoin\Futures\SDK\PublicApi\Symbol::getLevel2Message() | NO | `deprecated` https://docs.kucoin.com/futures/##level-2-pulling-messages | +| KuCoin\Futures\SDK\PublicApi\Symbol::getLevel3Message() | NO | `deprecated` https://docs.kucoin.com/futures/##level-3-pulling-messages | +| KuCoin\Futures\SDK\PublicApi\Symbol::getTradeHistory() | NO | https://docs.kucoin.com/futures/#get-trade-histories | +| KuCoin\Futures\SDK\PublicApi\Symbol::getKLines() | NO | https://docs.kucoin.com/futures/?lang=en_US#get-k-line-data-of-contract | +| KuCoin\Futures\SDK\PublicApi\Symbol::getLevel2Depth20 | NO | https://docs.kucoin.com/futures/cn/#level-2-2 | +| KuCoin\Futures\SDK\PublicApi\Symbol::getLevel2Depth100 | NO | https://docs.kucoin.com/futures/cn/#level-2-2 | +| KuCoin\Futures\SDK\PublicApi\Symbol::getFundingRates | NO | https://www.kucoin.com/docs/rest/futures-trading/funding-fees/get-public-funding-history |
KuCoin\Futures\SDK\PublicApi\Time -| API | Authentication | Description | -| -------- | -------- | -------- | -| KuCoin\Futures\SDK\PublicApi\Time::timestamp() | NO | https://docs.kucoin.com/futures/#server-time | +| API | Authentication | Description | +|------------------------------------------------|----------------|----------------------------------------------| +| KuCoin\Futures\SDK\PublicApi\Time::timestamp() | NO | https://docs.kucoin.com/futures/#server-time |
KuCoin\Futures\SDK\PublicApi\Status -| API | Authentication | Description | -| -------- | -------- | -------- | -| KuCoin\Futures\SDK\PublicApi\Status::status() | NO | https://docs.kucoin.com/futures/#get-the-service-status | +| API | Authentication | Description | +|-----------------------------------------------|----------------|---------------------------------------------------------| +| KuCoin\Futures\SDK\PublicApi\Status::status() | NO | https://docs.kucoin.com/futures/#get-the-service-status |
## Run tests + > Modify your API key in `phpunit.xml` first. ```shell diff --git a/phpunit.xml b/phpunit.xml index 7c4f50c..f572496 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -26,7 +26,7 @@ - + diff --git a/src/Api.php b/src/Api.php index 2bdd073..b6bf14f 100644 --- a/src/Api.php +++ b/src/Api.php @@ -16,12 +16,12 @@ abstract class Api /** * @var string SDK Version */ - const VERSION = '1.0.23'; + const VERSION = '1.0.24'; /** * @var string SDK update date */ - const UPDATE_DATE = '2024.01.05'; + const UPDATE_DATE = '2024.05.28'; /** * @var string diff --git a/src/PrivateApi/Order.php b/src/PrivateApi/Order.php index 8f50115..23927ef 100644 --- a/src/PrivateApi/Order.php +++ b/src/PrivateApi/Order.php @@ -183,4 +183,19 @@ public function cancelByClientOid($clientOid, $symbol) $response = $this->call(Request::METHOD_DELETE, '/api/v1/orders/client-order/' . $clientOid, ['symbol' => $symbol]); return $response->getApiData(); } + + /** + * Order test endpoint, the request parameters and return parameters of this endpoint are exactly the same as the order endpoint, and can be used to verify whether the signature is correct and other operations. After placing an order, the order will not enter the matching system, and the order cannot be queried. + * + * @param array $order + * @return mixed|null + * @throws BusinessException + * @throws HttpException + * @throws InvalidApiUriException + */ + public function createTest(array $order) + { + $response = $this->call(Request::METHOD_POST, '/api/v1/orders/test', $order); + return $response->getApiData(); + } } diff --git a/tests/OrderTest.php b/tests/OrderTest.php index cea621e..3c0c70b 100644 --- a/tests/OrderTest.php +++ b/tests/OrderTest.php @@ -287,4 +287,30 @@ public function testCancelByClientOid($api) $this->assertInternalType('array', $result); $this->assertArrayHasKey('clientOid', $result); } + + /** + * @dataProvider apiProvider + * @param Order $api + * @return void + * @throws \KuCoin\Futures\SDK\Exceptions\BusinessException + * @throws \KuCoin\Futures\SDK\Exceptions\HttpException + * @throws \KuCoin\Futures\SDK\Exceptions\InvalidApiUriException + */ + public function testCreateTest(Order $api) + { + $order = [ + 'clientOid' => uniqid(), + 'type' => 'limit', + 'side' => 'buy', + 'symbol' => 'DOTUSDM', + 'leverage' => 2, + 'remark' => 'create test order', + + 'price' => '1', + 'size' => '1', + ]; + $data = $api->createTest($order); + $this->assertInternalType('array', $data); + $this->assertArrayHasKey('orderId', $data); + } }