-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from fieyum/master
feat: update version
- Loading branch information
Showing
15 changed files
with
464 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace KuCoin\SDK\PrivateApi; | ||
|
||
use KuCoin\SDK\Http\Request; | ||
use KuCoin\SDK\KuCoinApi; | ||
|
||
/** | ||
* | ||
* Class Affiliate | ||
* @package KuCoin\SDK\PrivateApi | ||
* | ||
* @see https://www.kucoin.com/docs/rest/affiliate/get-affiliate-user-rebate-information | ||
* | ||
*/ | ||
class Affiliate extends KuCoinApi | ||
{ | ||
/** | ||
* | ||
* This endpoint allows getting affiliate user rebate information. | ||
* | ||
* @param $date | ||
* @param $offset | ||
* @param $maxCount | ||
* @return mixed|null | ||
* @throws \KuCoin\SDK\Exceptions\BusinessException | ||
* @throws \KuCoin\SDK\Exceptions\HttpException | ||
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException | ||
*/ | ||
public function getInviterStatistics($date, $offset = 1, $maxCount = 10) | ||
{ | ||
$parameters = compact('date', 'offset', 'maxCount'); | ||
return $this->call(Request::METHOD_GET, '/api/v2/affiliate/inviter/statistics', $parameters)->getApiData(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace KuCoin\SDK\PrivateApi; | ||
|
||
use KuCoin\SDK\Http\Request; | ||
use KuCoin\SDK\KuCoinApi; | ||
|
||
/** | ||
* | ||
* Class VipLend | ||
* @package KuCoin\SDK\PrivateApi | ||
* | ||
* @see https://www.kucoin.com/docs/rest/vip-lending/introduction | ||
* | ||
*/ | ||
class VipLend extends KuCoinApi | ||
{ | ||
/** | ||
* This endpoint is only for querying accounts that are currently involved in loans. | ||
* | ||
* @return mixed|null | ||
* @throws \KuCoin\SDK\Exceptions\BusinessException | ||
* @throws \KuCoin\SDK\Exceptions\HttpException | ||
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException | ||
*/ | ||
public function getLoan() | ||
{ | ||
$response = $this->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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace KuCoin\SDK\PublicApi; | ||
|
||
use KuCoin\SDK\Http\Request; | ||
use KuCoin\SDK\KuCoinApi; | ||
|
||
/** | ||
* Class Margin | ||
* @package KuCoin\SDK\PublicApi | ||
* @see https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-all-margin-trading-pairs-mark-prices | ||
*/ | ||
class Margin extends KuCoinApi | ||
{ | ||
/** | ||
* This endpoint returns the current mark prices for all margin trading pairs. | ||
* | ||
* @return mixed|null | ||
* @throws \KuCoin\SDK\Exceptions\BusinessException | ||
* @throws \KuCoin\SDK\Exceptions\HttpException | ||
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException | ||
*/ | ||
public function getSymbolsMarkPrice() | ||
{ | ||
return $this->call(Request::METHOD_GET, '/api/v3/mark-price/all-symbols')->getApiData(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace KuCoin\SDK\Tests\PrivateApi; | ||
|
||
use KuCoin\SDK\Enums\AccountType; | ||
use KuCoin\SDK\PrivateApi\Affiliate; | ||
use KuCoin\SDK\PrivateApi\Earn; | ||
|
||
class AffiliateTest extends TestCase | ||
{ | ||
protected $apiClass = Affiliate::class; | ||
|
||
/** | ||
* @dataProvider apiProvider | ||
* | ||
* @param Affiliate $api | ||
* @return void | ||
* @throws \KuCoin\SDK\Exceptions\BusinessException | ||
* @throws \KuCoin\SDK\Exceptions\HttpException | ||
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException | ||
*/ | ||
public function testGetInviterStatistics(Affiliate $api) | ||
{ | ||
$statistics = $api->getInviterStatistics(date('Ymd', strtotime('-10 day'))); | ||
$this->assertInternalType('array', $statistics); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace KuCoin\SDK\Tests\PrivateApi; | ||
|
||
use KuCoin\SDK\PrivateApi\VipLend; | ||
|
||
class VipLendTest extends TestCase | ||
{ | ||
protected $apiClass = VipLend::class; | ||
|
||
/** | ||
* @dataProvider apiProvider | ||
* | ||
* @param VipLend $api | ||
* @return void | ||
* @throws \KuCoin\SDK\Exceptions\BusinessException | ||
* @throws \KuCoin\SDK\Exceptions\HttpException | ||
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException | ||
*/ | ||
public function testGetLoan(VipLend $api) | ||
{ | ||
$result = $api->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); | ||
} | ||
} | ||
} |
Oops, something went wrong.