diff --git a/README.md b/README.md index e374cf2..c55da5e 100644 --- a/README.md +++ b/README.md @@ -348,6 +348,7 @@ go(function () { | KuCoin\SDK\PrivateApi\Order::getMarginHfDetail() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-hf-trade/get-hf-order-details-by-orderid | | KuCoin\SDK\PrivateApi\Order::getMarginHfDetailByClientOid() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-hf-trade/get-hf-order-details-by-clientoid | | KuCoin\SDK\PrivateApi\Order::getMarginHfFills() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-hf-trade/get-hf-transaction-records | +| KuCoin\SDK\PrivateApi\Order::getMarginHfActiveSymbols() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-hf-trade/get-active-hf-order-symbols | @@ -463,50 +464,53 @@ go(function () {
KuCoin\SDK\PublicApi\Symbol -| API | Authentication | Description | -|-----------------------------------------------------------|----------------|-------------------------------------------------------------------| -| KuCoin\SDK\PublicApi\Symbol::getList() | NO | `DEPRECATED` https://docs.kucoin.com/#get-symbols-list-deprecated | -| 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::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 | -| KuCoin\SDK\PublicApi\Symbol::getMarkets() | NO | https://docs.kucoin.com/#get-market-list | -| KuCoin\SDK\PublicApi\Symbol::getListV2() | NO | https://docs.kucoin.com/#get-symbols-list | +| API | Authentication | Description | +|-----------------------------------------------------------|----------------|-----------------------------------------------------------------------------| +| KuCoin\SDK\PublicApi\Symbol::getList() | NO | `DEPRECATED` https://docs.kucoin.com/#get-symbols-list-deprecated | +| 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::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 | +| KuCoin\SDK\PublicApi\Symbol::getMarkets() | NO | https://docs.kucoin.com/#get-market-list | +| KuCoin\SDK\PublicApi\Symbol::getListV2() | NO | https://docs.kucoin.com/#get-symbols-list | +| KuCoin\SDK\PublicApi\Symbol::getV2SymbolDetail() | NO | https://www.kucoin.com/docs/rest/spot-trading/market-data/get-symbol-detail |
KuCoin\SDK\PrivateApi\Margin -| API | Authentication | Description | -|------------------------------------------------|----------------|---------------------------------------------------------------------------------------------------------------| -| KuCoin\SDK\PrivateApi\Margin::getMarkPrice() | YES | https://docs.kucoin.com/#margin-info | -| KuCoin\SDK\PrivateApi\Margin::getConfig() | YES | https://docs.kucoin.com/#get-margin-configuration-info | -| KuCoin\SDK\PrivateApi\Margin::getAccount() | YES | https://docs.kucoin.com/#get-margin-account | -| KuCoin\SDK\PrivateApi\Margin::borrow() | YES | `DEPRECATED` https://docs.kucoin.com/#post-borrow-order | -| KuCoin\SDK\PrivateApi\Margin::getBorrow() | YES | `DEPRECATED` https://docs.kucoin.com/#get-borrow-order | -| KuCoin\SDK\PrivateApi\Margin::getOutstanding() | YES | `DEPRECATED` https://docs.kucoin.com/#get-repay-record | -| KuCoin\SDK\PrivateApi\Margin::getRepayRecord() | YES | `DEPRECATED` https://docs.kucoin.com/#get-repayment-record | -| KuCoin\SDK\PrivateApi\Margin::repayAll() | YES | `DEPRECATED` https://docs.kucoin.com/#one-click-repayment | -| KuCoin\SDK\PrivateApi\Margin::repaySingle() | YES | `DEPRECATED` https://docs.kucoin.com/#repay-a-single-order | -| KuCoin\SDK\PrivateApi\Margin::lend() | YES | `DEPRECATED` https://docs.kucoin.com/#post-lend-order | -| KuCoin\SDK\PrivateApi\Margin::cancelLend() | YES | `DEPRECATED` https://docs.kucoin.com/#cancel-lend-order | -| KuCoin\SDK\PrivateApi\Margin::setAutoLend() | YES | `DEPRECATED` https://docs.kucoin.com/#set-auto-lend | -| KuCoin\SDK\PrivateApi\Margin::getLendActive() | YES | `DEPRECATED` https://docs.kucoin.com/#get-active-order | -| KuCoin\SDK\PrivateApi\Margin::getLendDone() | YES | `DEPRECATED` https://docs.kucoin.com/#get-lent-history | -| KuCoin\SDK\PrivateApi\Margin::getUnsettled() | YES | `DEPRECATED` https://docs.kucoin.com/#get-active-lend-order-list | -| KuCoin\SDK\PrivateApi\Margin::getSettled() | YES | `DEPRECATED` https://docs.kucoin.com/#get-settled-lend-order-history | -| KuCoin\SDK\PrivateApi\Margin::getLendAssets() | YES | `DEPRECATED` https://docs.kucoin.com/#get-account-lend-record | -| KuCoin\SDK\PrivateApi\Margin::getMarket() | YES | `DEPRECATED` https://docs.kucoin.com/#lending-market-data | -| KuCoin\SDK\PrivateApi\Margin::getTradeLast() | YES | `DEPRECATED` https://docs.kucoin.com/#margin-trade-data | -| KuCoin\SDK\PrivateApi\Margin::getEtfInfo() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-leveraged-token-info | -| KuCoin\SDK\PrivateApi\Margin::borrowV3() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/margin-borrowing | -| KuCoin\SDK\PrivateApi\Margin::repayV3() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/repayment | -| KuCoin\SDK\PrivateApi\Margin::getBorrowV3() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/get-margin-borrowing-history | -| KuCoin\SDK\PrivateApi\Margin::getRepayV3() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/get-repayment-history | -| KuCoin\SDK\PrivateApi\Margin::getInterestV3() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/get-cross-isolated-margin-interest-records | +| API | Authentication | Description | +|------------------------------------------------------------|----------------|-----------------------------------------------------------------------------------------------------------------| +| KuCoin\SDK\PrivateApi\Margin::getMarkPrice() | YES | https://docs.kucoin.com/#margin-info | +| KuCoin\SDK\PrivateApi\Margin::getConfig() | YES | https://docs.kucoin.com/#get-margin-configuration-info | +| KuCoin\SDK\PrivateApi\Margin::getAccount() | YES | https://docs.kucoin.com/#get-margin-account | +| KuCoin\SDK\PrivateApi\Margin::borrow() | YES | `DEPRECATED` https://docs.kucoin.com/#post-borrow-order | +| KuCoin\SDK\PrivateApi\Margin::getBorrow() | YES | `DEPRECATED` https://docs.kucoin.com/#get-borrow-order | +| KuCoin\SDK\PrivateApi\Margin::getOutstanding() | YES | `DEPRECATED` https://docs.kucoin.com/#get-repay-record | +| KuCoin\SDK\PrivateApi\Margin::getRepayRecord() | YES | `DEPRECATED` https://docs.kucoin.com/#get-repayment-record | +| KuCoin\SDK\PrivateApi\Margin::repayAll() | YES | `DEPRECATED` https://docs.kucoin.com/#one-click-repayment | +| KuCoin\SDK\PrivateApi\Margin::repaySingle() | YES | `DEPRECATED` https://docs.kucoin.com/#repay-a-single-order | +| KuCoin\SDK\PrivateApi\Margin::lend() | YES | `DEPRECATED` https://docs.kucoin.com/#post-lend-order | +| KuCoin\SDK\PrivateApi\Margin::cancelLend() | YES | `DEPRECATED` https://docs.kucoin.com/#cancel-lend-order | +| KuCoin\SDK\PrivateApi\Margin::setAutoLend() | YES | `DEPRECATED` https://docs.kucoin.com/#set-auto-lend | +| KuCoin\SDK\PrivateApi\Margin::getLendActive() | YES | `DEPRECATED` https://docs.kucoin.com/#get-active-order | +| KuCoin\SDK\PrivateApi\Margin::getLendDone() | YES | `DEPRECATED` https://docs.kucoin.com/#get-lent-history | +| KuCoin\SDK\PrivateApi\Margin::getUnsettled() | YES | `DEPRECATED` https://docs.kucoin.com/#get-active-lend-order-list | +| KuCoin\SDK\PrivateApi\Margin::getSettled() | YES | `DEPRECATED` https://docs.kucoin.com/#get-settled-lend-order-history | +| KuCoin\SDK\PrivateApi\Margin::getLendAssets() | YES | `DEPRECATED` https://docs.kucoin.com/#get-account-lend-record | +| KuCoin\SDK\PrivateApi\Margin::getMarket() | YES | `DEPRECATED` https://docs.kucoin.com/#lending-market-data | +| KuCoin\SDK\PrivateApi\Margin::getTradeLast() | YES | `DEPRECATED` https://docs.kucoin.com/#margin-trade-data | +| KuCoin\SDK\PrivateApi\Margin::getEtfInfo() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-leveraged-token-info | +| KuCoin\SDK\PrivateApi\Margin::borrowV3() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/margin-borrowing | +| KuCoin\SDK\PrivateApi\Margin::repayV3() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/repayment | +| KuCoin\SDK\PrivateApi\Margin::getBorrowV3() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/get-margin-borrowing-history | +| KuCoin\SDK\PrivateApi\Margin::getRepayV3() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/get-repayment-history | +| KuCoin\SDK\PrivateApi\Margin::getInterestV3() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/get-cross-isolated-margin-interest-records | +| KuCoin\SDK\PrivateApi\Margin::getSymbolV3() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/get-cross-margin-trading-pairs-configuration | +| KuCoin\SDK\PrivateApi\Margin::modifyLeverageMultiplierV3() | YES | https://www.kucoin.com/docs/rest/margin-trading/margin-trading-v3-/modify-leverage-multiplier |
@@ -541,12 +545,21 @@ go(function () { +
+KuCoin\SDK\PrivateApi\Affiliate + +| API | Authentication | Description | +|----------------------------------------|----------------|----------------------------------------------------------------------------------| +| KuCoin\SDK\PublicApi\Time::timestamp() | NO | https://www.kucoin.com/docs/rest/affiliate/get-affiliate-user-rebate-information | + +
+
KuCoin\SDK\PublicApi\Time -| API | Authentication | Description | -|----------------------------------------|----------------|--------------------------------------| -| KuCoin\SDK\PublicApi\Time::timestamp() | NO | https://docs.kucoin.com/#server-time | +| API | Authentication | Description | +|----------------------------------------|----------------|----------------------------------------------------------------------------------| +| KuCoin\SDK\PublicApi\Time::timestamp() | NO | https://www.kucoin.com/docs/rest/spot-trading/market-data/get-server-time |
@@ -559,6 +572,15 @@ go(function () { +
+KuCoin\SDK\PublicApi\Margin + +| API | Authentication | Description | +|----------------------------------------------------|----------------|------------------------------------------------------------------------------------------------------| +| KuCoin\SDK\PublicApi\Margin::getSymbolsMarkPrice() | NO | https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-all-margin-trading-pairs-mark-prices | + +
+ ## Run tests > Modify your API key in `phpunit.xml` first. diff --git a/src/Api.php b/src/Api.php index f912855..7bcdcf6 100644 --- a/src/Api.php +++ b/src/Api.php @@ -16,12 +16,12 @@ abstract class Api /** * @var string SDK Version */ - const VERSION = '1.1.32'; + const VERSION = '1.1.33'; /** * @var string SDK update date */ - const UPDATE_DATE = '2024.07.04'; + const UPDATE_DATE = '2024.11.12'; /** * @var string diff --git a/src/Enums/AccountType.php b/src/Enums/AccountType.php index 2efa066..66d6d67 100644 --- a/src/Enums/AccountType.php +++ b/src/Enums/AccountType.php @@ -7,4 +7,8 @@ class AccountType const MAIN = 'MAIN'; const TRADE = 'TRADE'; + + const MARGIN_TRADE = 'MARGIN_TRADE'; + + const MARGIN_ISOLATED_TRADE = 'MARGIN_ISOLATED_TRADE'; } \ No newline at end of file diff --git a/src/PrivateApi/Affiliate.php b/src/PrivateApi/Affiliate.php new file mode 100644 index 0000000..b30cc8b --- /dev/null +++ b/src/PrivateApi/Affiliate.php @@ -0,0 +1,35 @@ +call(Request::METHOD_GET, '/api/v2/affiliate/inviter/statistics', $parameters)->getApiData(); + } +} \ No newline at end of file diff --git a/src/PrivateApi/Margin.php b/src/PrivateApi/Margin.php index 2ed19f6..b66bb60 100644 --- a/src/PrivateApi/Margin.php +++ b/src/PrivateApi/Margin.php @@ -441,4 +441,39 @@ public function getInterestV3(array $params, array $pagination = []) $response = $this->call(Request::METHOD_GET, '/api/v3/margin/interest', $params + $pagination); return $response->getApiData(); } + + /** + * This endpoint allows querying the configuration of cross margin trading pairs. + * + * @param $symbol + * @return mixed|null + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function getSymbolV3($symbol = '') + { + $response = $this->call(Request::METHOD_GET, '/api/v3/margin/symbols', ['symbol' => $symbol]); + return $response->getApiData(); + } + + /** + * This endpoint allows modifying the leverage multiplier for cross margin or isolated margin. + * + * @param $leverage + * @param $symbol + * @param $isIsolated + * @return mixed|null + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function modifyLeverageMultiplierV3($leverage, $symbol = '', $isIsolated = false) + { + $response = $this->call(Request::METHOD_POST, + '/api/v3/position/update-user-leverage', + compact('leverage', 'symbol', 'isIsolated') + ); + return $response->getApiData(); + } } \ No newline at end of file diff --git a/src/PrivateApi/Order.php b/src/PrivateApi/Order.php index b2e02e6..131bdd3 100644 --- a/src/PrivateApi/Order.php +++ b/src/PrivateApi/Order.php @@ -648,4 +648,19 @@ public function createMarginTestOrder(array $order) $response = $this->call(Request::METHOD_POST, '/api/v3/hf/margin/order/test', $order); return $response->getApiData(); } + + /** + * This endpoint allows users to query all trading pairs with active orders. + * + * @param $tradeType + * @return mixed|null + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function getMarginHfActiveSymbols($tradeType) + { + $response = $this->call(Request::METHOD_GET, '/api/v3/hf/margin/order/active/symbols', ['tradeType' => $tradeType]); + return $response->getApiData(); + } } diff --git a/src/PrivateApi/VipLend.php b/src/PrivateApi/VipLend.php new file mode 100644 index 0000000..7119802 --- /dev/null +++ b/src/PrivateApi/VipLend.php @@ -0,0 +1,45 @@ +call(Request::METHOD_GET, '/api/v1/otc-loan/loan'); + return $response->getApiData(); + } + + /** + * This endpoint is only for querying accounts that are currently involved in off-exchange funding and loans. + * + * @return mixed|null + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function getAccounts() + { + $response = $this->call(Request::METHOD_GET, '/api/v1/otc-loan/accounts'); + return $response->getApiData(); + } +} \ No newline at end of file diff --git a/src/PublicApi/Margin.php b/src/PublicApi/Margin.php new file mode 100644 index 0000000..b94c3cb --- /dev/null +++ b/src/PublicApi/Margin.php @@ -0,0 +1,27 @@ +call(Request::METHOD_GET, '/api/v3/mark-price/all-symbols')->getApiData(); + } +} \ No newline at end of file diff --git a/src/PublicApi/Symbol.php b/src/PublicApi/Symbol.php index a80c969..60a9143 100644 --- a/src/PublicApi/Symbol.php +++ b/src/PublicApi/Symbol.php @@ -189,4 +189,18 @@ public function getListV2($market = null) $response = $this->call(Request::METHOD_GET, '/api/v2/symbols', compact('market')); return $response->getApiData(); } + + /** + * Request via this endpoint to get detail currency pairs for trading. If you want to get the market information of the trading symbol, please use Get All Tickers. + * + * @param $symbol + * @return mixed|null + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function getV2SymbolDetail($symbol) + { + return $this->call(Request::METHOD_GET, '/api/v2/symbols/' . $symbol)->getApiData(); + } } diff --git a/tests/PrivateApi/AffiliateTest.php b/tests/PrivateApi/AffiliateTest.php new file mode 100644 index 0000000..3780940 --- /dev/null +++ b/tests/PrivateApi/AffiliateTest.php @@ -0,0 +1,27 @@ +getInviterStatistics(date('Ymd', strtotime('-10 day'))); + $this->assertInternalType('array', $statistics); + } +} diff --git a/tests/PrivateApi/MarginTest.php b/tests/PrivateApi/MarginTest.php index 922c8bf..8e63893 100644 --- a/tests/PrivateApi/MarginTest.php +++ b/tests/PrivateApi/MarginTest.php @@ -555,4 +555,65 @@ public function testGetInterestV3(Margin $api) $this->assertArrayHasKey('createdTime', $item); } } + + /** + * @dataProvider apiProvider + * + * @param Margin $api + * @return void + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function testGetSymbolV3(Margin $api) + { + $symbols = $api->getSymbolV3(); + $this->assertInternalType('array', $symbols); + $this->assertArrayHasKey('items', $symbols); + $assertCallable = function ($item) { + $this->assertArrayHasKey('symbol', $item); + $this->assertArrayHasKey('name', $item); + $this->assertArrayHasKey('enableTrading', $item); + $this->assertArrayHasKey('market', $item); + $this->assertArrayHasKey('baseCurrency', $item); + $this->assertArrayHasKey('quoteCurrency', $item); + $this->assertArrayHasKey('baseIncrement', $item); + $this->assertArrayHasKey('baseMinSize', $item); + $this->assertArrayHasKey('quoteIncrement', $item); + $this->assertArrayHasKey('quoteMinSize', $item); + $this->assertArrayHasKey('baseMaxSize', $item); + $this->assertArrayHasKey('quoteMaxSize', $item); + $this->assertArrayHasKey('priceIncrement', $item); + $this->assertArrayHasKey('feeCurrency', $item); + $this->assertArrayHasKey('priceLimitRate', $item); + $this->assertArrayHasKey('minFunds', $item); + }; + foreach ($symbols['items'] as $item) { + $assertCallable($item); + } + + $symbol = $symbols['items'][0]['symbol']; + $singleSymbol = $api->getSymbolV3($symbol); + foreach ($singleSymbol['items'] as $item) { + $assertCallable($item); + } + } + + /** + * @dataProvider apiProvider + * + * @param Margin $api + * @return void + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function testModifyLeverageMultiplierV3(Margin $api) + { + $symbol = $api->getSymbolV3()['items'][0]['symbol']; + $result = $api->modifyLeverageMultiplierV3(2, $symbol, true); + $this->assertNull($result); + $api->modifyLeverageMultiplierV3(3); + $this->assertNull($result); + } } diff --git a/tests/PrivateApi/OrderTest.php b/tests/PrivateApi/OrderTest.php index c603f61..4b525a8 100644 --- a/tests/PrivateApi/OrderTest.php +++ b/tests/PrivateApi/OrderTest.php @@ -2,6 +2,7 @@ namespace KuCoin\SDK\Tests\PrivateApi; +use KuCoin\SDK\Enums\AccountType; use KuCoin\SDK\PrivateApi\Order; use KuCoin\SDK\PublicApi\Symbol; @@ -1347,4 +1348,23 @@ public function testMarginHfCreate(Order $api) $this->assertInternalType('array', $data); $this->assertArrayHasKey('orderId', $data); } + + /** + * @dataProvider apiProvider + * + * @param Order $api + * @return void + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function testGetMarginHfActiveSymbols(Order $api) + { + $activeIsolatedSymbols = $api->getMarginHfActiveSymbols(AccountType::MARGIN_ISOLATED_TRADE); + $this->assertArrayHasKey('symbolSize', $activeIsolatedSymbols); + $this->assertArrayHasKey('symbols', $activeIsolatedSymbols); + $activeSymbols = $api->getMarginHfActiveSymbols(AccountType::MARGIN_TRADE); + $this->assertArrayHasKey('symbolSize', $activeSymbols); + $this->assertArrayHasKey('symbols', $activeSymbols); + } } diff --git a/tests/PrivateApi/VipLendTest.php b/tests/PrivateApi/VipLendTest.php new file mode 100644 index 0000000..c51791b --- /dev/null +++ b/tests/PrivateApi/VipLendTest.php @@ -0,0 +1,53 @@ +getLoan(); + $this->assertInternalType('array', $result); + $this->assertArrayHasKey('orders', $result); + $this->assertArrayHasKey('ltv', $result); + $this->assertArrayHasKey('totalMarginAmount', $result); + $this->assertArrayHasKey('transferMarginAmount', $result); + $this->assertArrayHasKey('margins', $result); + } + + /** + * @dataProvider apiProvider + * + * @param VipLend $api + * @return void + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function testGetAccounts(VipLend $api) + { + $result = $api->getAccounts(); + $this->assertInternalType('array', $result); + foreach ($result as $item) { + $this->assertArrayHasKey('uid', $item); + $this->assertArrayHasKey('marginCcy', $item); + $this->assertArrayHasKey('marginQty', $item); + $this->assertArrayHasKey('marginFactor', $item); + $this->assertArrayHasKey('accountType', $item); + $this->assertArrayHasKey('isParent', $item); + } + } +} diff --git a/tests/PublicApi/MarginTest.php b/tests/PublicApi/MarginTest.php new file mode 100644 index 0000000..c4ecb8d --- /dev/null +++ b/tests/PublicApi/MarginTest.php @@ -0,0 +1,30 @@ +getSymbolsMarkPrice(); + $this->assertInternalType('array', $data); + foreach ($data as $item) { + $this->assertArrayHasKey('symbol', $item); + $this->assertArrayHasKey('timePoint', $item); + $this->assertArrayHasKey('value', $item); + } + } +} \ No newline at end of file diff --git a/tests/PublicApi/SymbolTest.php b/tests/PublicApi/SymbolTest.php index b13eb72..5fc5bc1 100644 --- a/tests/PublicApi/SymbolTest.php +++ b/tests/PublicApi/SymbolTest.php @@ -265,4 +265,37 @@ public function testGetListV2(Symbol $api) $this->assertArrayHasKey('minFunds', $item); } } + + /** + * @dataProvider apiProvider + * + * @param Symbol $api + * @return void + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function testGetV2SymbolDetail(Symbol $api) + { + $symbol = 'BTC-USDT'; + $data = $api->getV2SymbolDetail($symbol); + $this->assertInternalType('array', $data); + $this->assertArrayHasKey('symbol', $data); + $this->assertArrayHasKey('name', $data); + $this->assertArrayHasKey('baseCurrency', $data); + $this->assertArrayHasKey('quoteCurrency', $data); + $this->assertArrayHasKey('market', $data); + $this->assertArrayHasKey('baseMinSize', $data); + $this->assertArrayHasKey('quoteMinSize', $data); + $this->assertArrayHasKey('baseMaxSize', $data); + $this->assertArrayHasKey('quoteMaxSize', $data); + $this->assertArrayHasKey('baseIncrement', $data); + $this->assertArrayHasKey('quoteIncrement', $data); + $this->assertArrayHasKey('priceIncrement', $data); + $this->assertArrayHasKey('feeCurrency', $data); + $this->assertArrayHasKey('enableTrading', $data); + $this->assertArrayHasKey('isMarginEnabled', $data); + $this->assertArrayHasKey('priceLimitRate', $data); + $this->assertArrayHasKey('minFunds', $data); + } }