diff --git a/README.md b/README.md index ff4ebbb..fb1ade8 100644 --- a/README.md +++ b/README.md @@ -241,6 +241,7 @@ go(function () { | -------- | -------- | -------- | | KuCoin\SDK\PrivateApi\Deposit::createAddress() | YES | https://docs.kucoin.com/#create-deposit-address | | KuCoin\SDK\PrivateApi\Deposit::getAddress() | YES | https://docs.kucoin.com/#get-deposit-address | +| KuCoin\SDK\PrivateApi\Deposit::getAddresses() | YES | https://docs.kucoin.com/#get-deposit-addresses-v2 | | KuCoin\SDK\PrivateApi\Deposit::getDeposits() | YES | https://docs.kucoin.com/#get-deposit-list | | KuCoin\SDK\PrivateApi\Deposit::getV1Deposits() | YES | https://docs.kucoin.com/#get-v1-historical-deposits-list | @@ -273,6 +274,29 @@ go(function () { | KuCoin\SDK\PrivateApi\Order::cancelByClientOid() | YES | https://docs.kucoin.com/#cancel-single-order-by-clientoid | | KuCoin\SDK\PrivateApi\Order::getDetailByClientOid() | YES | https://docs.kucoin.com/#get-single-active-order-by-clientoid| + + +
+KuCoin\SDK\PrivateApi\StopOrder + +| API | Authentication | Description | +| -------- | -------- | -------- | +| KuCoin\SDK\PrivateApi\StopOrder::create() | YES | https://docs.kucoin.com/#place-a-new-order-2 | +| KuCoin\SDK\PrivateApi\StopOrder::cancel() | YES | https://docs.kucoin.com/#cancel-an-order-2 | +| KuCoin\SDK\PrivateApi\StopOrder::cancelBatch() | YES | https://docs.kucoin.com/#cancel-orders | +| KuCoin\SDK\PrivateApi\StopOrder::getList() | YES | https://docs.kucoin.com/#list-stop-orders | +| KuCoin\SDK\PrivateApi\StopOrder::getDetail() | YES | https://docs.kucoin.com/#get-single-order-info | +| KuCoin\SDK\PrivateApi\StopOrder::getDetailByClientOid() | YES | https://docs.kucoin.com/#get-single-order-by-clientoid | +| KuCoin\SDK\PrivateApi\StopOrder::cancelByClientOid()| YES | https://docs.kucoin.com/#cancel-single-order-by-clientoid-2 | + +
+ +
+KuCoin\SDK\PrivateApi\Symbol + +| API | Authentication | Description | +| -------- | -------- | -------- | +| KuCoin\SDK\PrivateApi\Symbol::getAggregatedFullOrderBook() | NO | https://docs.kucoin.com/#get-full-order-book-aggregated |
@@ -323,8 +347,6 @@ go(function () { | KuCoin\SDK\PublicApi\Symbol::getTicker() | NO | https://docs.kucoin.com/#get-ticker | | KuCoin\SDK\PublicApi\Symbol::getAllTickers() | NO | https://docs.kucoin.com/#get-all-tickers | | KuCoin\SDK\PublicApi\Symbol::getAggregatedPartOrderBook() | NO | https://docs.kucoin.com/#get-part-order-book-aggregated | -| KuCoin\SDK\PublicApi\Symbol::getAggregatedFullOrderBook() | NO | https://docs.kucoin.com/#get-full-order-book-aggregated | -| KuCoin\SDK\PublicApi\Symbol::getAtomicFullOrderBook() | NO | https://docs.kucoin.com/#get-full-order-book-atomic | | KuCoin\SDK\PublicApi\Symbol::getTradeHistories() | NO | https://docs.kucoin.com/#get-trade-histories | | KuCoin\SDK\PublicApi\Symbol::getKLines() | NO | https://docs.kucoin.com/#get-klines | | KuCoin\SDK\PublicApi\Symbol::get24HStats() | NO | https://docs.kucoin.com/#get-24hr-stats | diff --git a/src/Api.php b/src/Api.php index 89a1395..50cf4b2 100644 --- a/src/Api.php +++ b/src/Api.php @@ -16,12 +16,12 @@ abstract class Api /** * @var string SDK Version */ - const VERSION = '1.1.21'; + const VERSION = '1.1.22'; /** * @var string SDK update date */ - const UPDATE_DATE = '2021.03.02'; + const UPDATE_DATE = '2021.08.02'; /** * @var string diff --git a/src/PrivateApi/Deposit.php b/src/PrivateApi/Deposit.php index 97eb8d0..b44dd24 100644 --- a/src/PrivateApi/Deposit.php +++ b/src/PrivateApi/Deposit.php @@ -42,6 +42,22 @@ public function getAddress($currency, $chain = null) return $response->getApiData(); } + /** + * Get deposit addresses(V2) + * Get all deposit addresses for the currency you intend to deposit. + * If the returned data is empty, you may need to create a deposit address first. + * @param string $currency + * @return array + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function getAddresses($currency) + { + $response = $this->call(Request::METHOD_GET, '/api/v2/deposit-addresses', compact('currency')); + return $response->getApiData(); + } + /** * Get deposit list * @param array $params diff --git a/src/PrivateApi/Symbol.php b/src/PrivateApi/Symbol.php new file mode 100644 index 0000000..652e475 --- /dev/null +++ b/src/PrivateApi/Symbol.php @@ -0,0 +1,23 @@ +call(Request::METHOD_GET, '/api/v3/market/orderbook/level2', compact('symbol')); + return $response->getApiData(); + } +} \ No newline at end of file diff --git a/src/PublicApi/Symbol.php b/src/PublicApi/Symbol.php index 3d3ac7a..656cb22 100644 --- a/src/PublicApi/Symbol.php +++ b/src/PublicApi/Symbol.php @@ -8,7 +8,7 @@ /** * Class Symbol * @package KuCoin\SDK\PublicApi - * @see https://docs.kucoin.com/#symbols + * @see https://docs.kucoin.com/#market-data */ class Symbol extends KuCoinApi { @@ -64,7 +64,7 @@ public function getAllTickers() */ public function getAggregatedPartOrderBook($symbol, $depth = 20) { - $response = $this->call(Request::METHOD_GET, '/api/v1/market/orderbook/level2_' . intval($depth), compact('symbol')); + $response = $this->call(Request::METHOD_GET, '/api/v1/market/orderbook/level2_' . (int)$depth, compact('symbol')); return $response->getApiData(); } @@ -75,6 +75,7 @@ public function getAggregatedPartOrderBook($symbol, $depth = 20) * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + * @deprecated Use v3 version: \KuCoin\SDK\PrivateApi\Symbol->getAggregatedFullOrderBook($symbol) */ public function getAggregatedFullOrderBook($symbol) { @@ -89,6 +90,7 @@ public function getAggregatedFullOrderBook($symbol) * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + * @deprecated */ public function getAtomicFullOrderBook($symbol) { @@ -103,6 +105,7 @@ public function getAtomicFullOrderBook($symbol) * @throws \KuCoin\SDK\Exceptions\BusinessException * @throws \KuCoin\SDK\Exceptions\HttpException * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + * @deprecated */ public function getV2AtomicFullOrderBook($symbol) { diff --git a/tests/AccountTest.php b/tests/PrivateApi/AccountTest.php similarity index 99% rename from tests/AccountTest.php rename to tests/PrivateApi/AccountTest.php index 5d4b5a0..5035e27 100644 --- a/tests/AccountTest.php +++ b/tests/PrivateApi/AccountTest.php @@ -1,6 +1,6 @@ markTestSkipped(); + return; $address = $api->createAddress('BTC'); $this->assertInternalType('array', $address); $this->assertArrayHasKey('address', $address); @@ -36,10 +37,8 @@ public function testCreateAddress(Deposit $api) */ public function testGetAddress(Deposit $api) { - $this->markTestSkipped(); - return; try { - $address = $api->getAddress('BTC'); + $address = $api->getAddress('USDT'); if ($address !== null) { $this->assertInternalType('array', $address); $this->assertArrayHasKey('address', $address); @@ -54,6 +53,26 @@ public function testGetAddress(Deposit $api) } } + /** + * @dataProvider apiProvider + * @param Deposit $api + * @return array|string + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function testGetAddresses(Deposit $api) + { + $addresses = $api->getAddresses('USDT'); + foreach ($addresses as $address) { + $this->assertInternalType('array', $address); + $this->assertArrayHasKey('address', $address); + $this->assertArrayHasKey('memo', $address); + $this->assertArrayHasKey('chain', $address); + $this->assertArrayHasKey('contractAddress', $address); + } + } + /** * @dataProvider apiProvider * @param Deposit $api diff --git a/tests/FillTest.php b/tests/PrivateApi/FillTest.php similarity index 96% rename from tests/FillTest.php rename to tests/PrivateApi/FillTest.php index 91329b2..7d9af39 100644 --- a/tests/FillTest.php +++ b/tests/PrivateApi/FillTest.php @@ -1,13 +1,12 @@ getAggregatedFullOrderBook('ETH-BTC'); + $this->assertInternalType('array', $data); + $this->assertArrayHasKey('sequence', $data); + $this->assertArrayHasKey('bids', $data); + $this->assertArrayHasKey('asks', $data); + $this->assertArrayHasKey('time', $data); + } +} \ No newline at end of file diff --git a/tests/PrivateApi/TestCase.php b/tests/PrivateApi/TestCase.php new file mode 100644 index 0000000..7bd06f9 --- /dev/null +++ b/tests/PrivateApi/TestCase.php @@ -0,0 +1,8 @@ +