From 4809c551226af5b36ed54a9898e957a408a6fdf5 Mon Sep 17 00:00:00 2001 From: hugo Date: Mon, 21 Feb 2022 11:33:48 +0800 Subject: [PATCH 1/3] getStrategyRiskLimit --- src/PrivateApi/Margin.php | 17 +++++++++++++++++ tests/PrivateApi/MarginTest.php | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/PrivateApi/Margin.php b/src/PrivateApi/Margin.php index 821edb4..8eefb2a 100644 --- a/src/PrivateApi/Margin.php +++ b/src/PrivateApi/Margin.php @@ -3,8 +3,10 @@ namespace KuCoin\SDK\PrivateApi; +use http\Encoding\Stream; use KuCoin\SDK\Http\Request; use KuCoin\SDK\KuCoinApi; +use phpDocumentor\Reflection\Types\String_; /** @@ -301,4 +303,19 @@ public function getTradeLast($currency) $response = $this->call(Request::METHOD_GET, '/api/v1/margin/trade/last', compact('currency')); return $response->getApiData(); } + + /** + * This endpoint can query the cross/isolated margin risk limit. + * This endpoint requires the "General" permission + * @param string $marginModel corss(corss margin), isolated (isolated margin) + * @return mixed + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function getStrategyRiskLimit(string $marginModel) + { + $response = $this->call(Request::METHOD_GET, '/api/v1/risk/limit/strategy', ['marginModel' => $marginModel]); + return $response->getApiData(); + } } \ No newline at end of file diff --git a/tests/PrivateApi/MarginTest.php b/tests/PrivateApi/MarginTest.php index b7930bb..fdae168 100644 --- a/tests/PrivateApi/MarginTest.php +++ b/tests/PrivateApi/MarginTest.php @@ -371,4 +371,22 @@ public function testGetTradeLast(Margin $api) $this->assertArrayHasKey('dailyIntRate', $data[0]); } } + + /** + * @dataProvider apiProvider + * @param Margin $api + * @throws \KuCoin\SDK\Exceptions\BusinessException + * @throws \KuCoin\SDK\Exceptions\HttpException + * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException + */ + public function testGetStrategyRiskLimit(Margin $api) + { + $data = $api->getStrategyRiskLimit('cross'); + if (!empty($data)) { + $this->assertArrayHasKey('currency', $data[0]); + $this->assertArrayHasKey('borrowMaxAmount', $data[0]); + $this->assertArrayHasKey('buyMaxAmount', $data[0]); + $this->assertArrayHasKey('precision', $data[0]); + } + } } From 48f3ab108551422e85c1849b0d7ef6f72be43eb8 Mon Sep 17 00:00:00 2001 From: hugo Date: Mon, 21 Feb 2022 11:48:11 +0800 Subject: [PATCH 2/3] add testGetStrategyRiskLimit --- src/PrivateApi/Margin.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/PrivateApi/Margin.php b/src/PrivateApi/Margin.php index 8eefb2a..bb4a896 100644 --- a/src/PrivateApi/Margin.php +++ b/src/PrivateApi/Margin.php @@ -3,10 +3,8 @@ namespace KuCoin\SDK\PrivateApi; -use http\Encoding\Stream; use KuCoin\SDK\Http\Request; use KuCoin\SDK\KuCoinApi; -use phpDocumentor\Reflection\Types\String_; /** From 6522d9de6a7f5218dbec827ecb2b4cd4fc4261b3 Mon Sep 17 00:00:00 2001 From: hugo Date: Mon, 21 Feb 2022 19:46:00 +0800 Subject: [PATCH 3/3] VERSION 1.1.25 --- src/Api.php | 4 ++-- src/PrivateApi/Order.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Api.php b/src/Api.php index 6cb1b21..8e573b5 100644 --- a/src/Api.php +++ b/src/Api.php @@ -16,12 +16,12 @@ abstract class Api /** * @var string SDK Version */ - const VERSION = '1.1.24'; + const VERSION = '1.1.25'; /** * @var string SDK update date */ - const UPDATE_DATE = '2021.12.02'; + const UPDATE_DATE = '2022.02.21'; /** * @var string diff --git a/src/PrivateApi/Order.php b/src/PrivateApi/Order.php index c7954a6..00e0c4c 100644 --- a/src/PrivateApi/Order.php +++ b/src/PrivateApi/Order.php @@ -87,6 +87,7 @@ public function getList(array $params = [], array $pagination = []) /** * Get v1 historical orders list + * @deprecated * @param array $params * @param array $pagination * @return array