Skip to content

Commit ec44ba6

Browse files
authored
Merge pull request #14 from Artisan-Liu/master
add account asset
2 parents 49f7fd6 + 053d853 commit ec44ba6

File tree

3 files changed

+53
-2
lines changed

3 files changed

+53
-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.0.21';
19+
const VERSION = '1.0.22';
2020

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

2626
/**
2727
* @var string

src/PrivateApi/Account.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,4 +196,18 @@ public function transferOutV3($recAccountType, $amount, $currency)
196196
$response = $this->call(Request::METHOD_POST, '/api/v3/transfer-out', compact('recAccountType', 'amount', 'currency'));
197197
return $response->getApiData();
198198
}
199+
200+
/**
201+
* Get all account asset information.
202+
* @param string $currency
203+
* @return array
204+
* @throws \KuCoin\Futures\SDK\Exceptions\BusinessException
205+
* @throws \KuCoin\Futures\SDK\Exceptions\HttpException
206+
* @throws \KuCoin\Futures\SDK\Exceptions\InvalidApiUriException
207+
*/
208+
public function getAccountOverviewAll($currency)
209+
{
210+
$response = $this->call(Request::METHOD_GET, '/api/v1/account-overview-all', compact('currency'));
211+
return $response->getApiData();
212+
}
199213
}

tests/AccountTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,41 @@ public function testTransferOutV3(Account $api)
280280
$this->assertArrayHasKey('createdAt', $data);
281281
$this->assertArrayHasKey('updatedAt', $data);
282282
}
283+
284+
/**
285+
* @dataProvider apiProvider
286+
* @param Account $api
287+
* @throws BusinessException
288+
* @throws \KuCoin\Futures\SDK\Exceptions\HttpException
289+
* @throws \KuCoin\Futures\SDK\Exceptions\InvalidApiUriException
290+
*/
291+
public function testGetAccountOverviewAll(Account $api)
292+
{
293+
$currency = 'USDT';
294+
$data = $api->getAccountOverviewAll($currency);
295+
$this->assertInternalType('array', $data);
296+
$this->assertInternalType('array', $data['summary']);
297+
$this->assertArrayHasKey('accountEquityTotal', $data['summary']);
298+
$this->assertArrayHasKey('unrealisedPNLTotal', $data['summary']);
299+
$this->assertArrayHasKey('marginBalanceTotal', $data['summary']);
300+
$this->assertArrayHasKey('positionMarginTotal', $data['summary']);
301+
$this->assertArrayHasKey('orderMarginTotal', $data['summary']);
302+
$this->assertArrayHasKey('frozenFundsTotal', $data['summary']);
303+
$this->assertArrayHasKey('availableBalanceTotal', $data['summary']);
304+
$this->assertArrayHasKey('currency', $data['summary']);
305+
$this->assertEquals($currency, $data['summary']['currency']);
306+
$this->assertInternalType('array', $data['accounts']);
307+
foreach ($data['accounts'] as $item) {
308+
$this->assertArrayHasKey('accountName', $item);
309+
$this->assertArrayHasKey('accountEquity', $item);
310+
$this->assertArrayHasKey('unrealisedPNL', $item);
311+
$this->assertArrayHasKey('marginBalance', $item);
312+
$this->assertArrayHasKey('positionMargin', $item);
313+
$this->assertArrayHasKey('orderMargin', $item);
314+
$this->assertArrayHasKey('frozenFunds', $item);
315+
$this->assertArrayHasKey('availableBalance', $item);
316+
$this->assertArrayHasKey('currency', $item);
317+
$this->assertEquals($currency, $item['currency']);
318+
}
319+
}
283320
}

0 commit comments

Comments
 (0)