Skip to content

Commit 773f589

Browse files
authored
Merge pull request #121 from Hugo-Doe/master
add endpoint /api/v1/risk/limit/strategy
2 parents a028178 + 6522d9d commit 773f589

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

src/Api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ abstract class Api
1616
/**
1717
* @var string SDK Version
1818
*/
19-
const VERSION = '1.1.24';
19+
const VERSION = '1.1.25';
2020

2121
/**
2222
* @var string SDK update date
2323
*/
24-
const UPDATE_DATE = '2021.12.02';
24+
const UPDATE_DATE = '2022.02.21';
2525

2626
/**
2727
* @var string

src/PrivateApi/Margin.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,19 @@ public function getTradeLast($currency)
301301
$response = $this->call(Request::METHOD_GET, '/api/v1/margin/trade/last', compact('currency'));
302302
return $response->getApiData();
303303
}
304+
305+
/**
306+
* This endpoint can query the cross/isolated margin risk limit.
307+
* This endpoint requires the "General" permission
308+
* @param string $marginModel corss(corss margin), isolated (isolated margin)
309+
* @return mixed
310+
* @throws \KuCoin\SDK\Exceptions\BusinessException
311+
* @throws \KuCoin\SDK\Exceptions\HttpException
312+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
313+
*/
314+
public function getStrategyRiskLimit(string $marginModel)
315+
{
316+
$response = $this->call(Request::METHOD_GET, '/api/v1/risk/limit/strategy', ['marginModel' => $marginModel]);
317+
return $response->getApiData();
318+
}
304319
}

src/PrivateApi/Order.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public function getList(array $params = [], array $pagination = [])
8787

8888
/**
8989
* Get v1 historical orders list
90+
* @deprecated
9091
* @param array $params
9192
* @param array $pagination
9293
* @return array

tests/PrivateApi/MarginTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,4 +371,22 @@ public function testGetTradeLast(Margin $api)
371371
$this->assertArrayHasKey('dailyIntRate', $data[0]);
372372
}
373373
}
374+
375+
/**
376+
* @dataProvider apiProvider
377+
* @param Margin $api
378+
* @throws \KuCoin\SDK\Exceptions\BusinessException
379+
* @throws \KuCoin\SDK\Exceptions\HttpException
380+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
381+
*/
382+
public function testGetStrategyRiskLimit(Margin $api)
383+
{
384+
$data = $api->getStrategyRiskLimit('cross');
385+
if (!empty($data)) {
386+
$this->assertArrayHasKey('currency', $data[0]);
387+
$this->assertArrayHasKey('borrowMaxAmount', $data[0]);
388+
$this->assertArrayHasKey('buyMaxAmount', $data[0]);
389+
$this->assertArrayHasKey('precision', $data[0]);
390+
}
391+
}
374392
}

0 commit comments

Comments
 (0)