Skip to content

Commit eedadf7

Browse files
authored
Merge pull request #141 from fieyum/master
feat: update version
2 parents e55cfe9 + d50f01d commit eedadf7

File tree

15 files changed

+464
-43
lines changed

15 files changed

+464
-43
lines changed

README.md

Lines changed: 63 additions & 41 deletions
Large diffs are not rendered by default.

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.32';
19+
const VERSION = '1.1.33';
2020

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

2626
/**
2727
* @var string

src/Enums/AccountType.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ class AccountType
77
const MAIN = 'MAIN';
88

99
const TRADE = 'TRADE';
10+
11+
const MARGIN_TRADE = 'MARGIN_TRADE';
12+
13+
const MARGIN_ISOLATED_TRADE = 'MARGIN_ISOLATED_TRADE';
1014
}

src/PrivateApi/Affiliate.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace KuCoin\SDK\PrivateApi;
4+
5+
use KuCoin\SDK\Http\Request;
6+
use KuCoin\SDK\KuCoinApi;
7+
8+
/**
9+
*
10+
* Class Affiliate
11+
* @package KuCoin\SDK\PrivateApi
12+
*
13+
* @see https://www.kucoin.com/docs/rest/affiliate/get-affiliate-user-rebate-information
14+
*
15+
*/
16+
class Affiliate extends KuCoinApi
17+
{
18+
/**
19+
*
20+
* This endpoint allows getting affiliate user rebate information.
21+
*
22+
* @param $date
23+
* @param $offset
24+
* @param $maxCount
25+
* @return mixed|null
26+
* @throws \KuCoin\SDK\Exceptions\BusinessException
27+
* @throws \KuCoin\SDK\Exceptions\HttpException
28+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
29+
*/
30+
public function getInviterStatistics($date, $offset = 1, $maxCount = 10)
31+
{
32+
$parameters = compact('date', 'offset', 'maxCount');
33+
return $this->call(Request::METHOD_GET, '/api/v2/affiliate/inviter/statistics', $parameters)->getApiData();
34+
}
35+
}

src/PrivateApi/Margin.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,4 +441,39 @@ public function getInterestV3(array $params, array $pagination = [])
441441
$response = $this->call(Request::METHOD_GET, '/api/v3/margin/interest', $params + $pagination);
442442
return $response->getApiData();
443443
}
444+
445+
/**
446+
* This endpoint allows querying the configuration of cross margin trading pairs.
447+
*
448+
* @param $symbol
449+
* @return mixed|null
450+
* @throws \KuCoin\SDK\Exceptions\BusinessException
451+
* @throws \KuCoin\SDK\Exceptions\HttpException
452+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
453+
*/
454+
public function getSymbolV3($symbol = '')
455+
{
456+
$response = $this->call(Request::METHOD_GET, '/api/v3/margin/symbols', ['symbol' => $symbol]);
457+
return $response->getApiData();
458+
}
459+
460+
/**
461+
* This endpoint allows modifying the leverage multiplier for cross margin or isolated margin.
462+
*
463+
* @param $leverage
464+
* @param $symbol
465+
* @param $isIsolated
466+
* @return mixed|null
467+
* @throws \KuCoin\SDK\Exceptions\BusinessException
468+
* @throws \KuCoin\SDK\Exceptions\HttpException
469+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
470+
*/
471+
public function modifyLeverageMultiplierV3($leverage, $symbol = '', $isIsolated = false)
472+
{
473+
$response = $this->call(Request::METHOD_POST,
474+
'/api/v3/position/update-user-leverage',
475+
compact('leverage', 'symbol', 'isIsolated')
476+
);
477+
return $response->getApiData();
478+
}
444479
}

src/PrivateApi/Order.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,4 +648,19 @@ public function createMarginTestOrder(array $order)
648648
$response = $this->call(Request::METHOD_POST, '/api/v3/hf/margin/order/test', $order);
649649
return $response->getApiData();
650650
}
651+
652+
/**
653+
* This endpoint allows users to query all trading pairs with active orders.
654+
*
655+
* @param $tradeType
656+
* @return mixed|null
657+
* @throws \KuCoin\SDK\Exceptions\BusinessException
658+
* @throws \KuCoin\SDK\Exceptions\HttpException
659+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
660+
*/
661+
public function getMarginHfActiveSymbols($tradeType)
662+
{
663+
$response = $this->call(Request::METHOD_GET, '/api/v3/hf/margin/order/active/symbols', ['tradeType' => $tradeType]);
664+
return $response->getApiData();
665+
}
651666
}

src/PrivateApi/VipLend.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace KuCoin\SDK\PrivateApi;
4+
5+
use KuCoin\SDK\Http\Request;
6+
use KuCoin\SDK\KuCoinApi;
7+
8+
/**
9+
*
10+
* Class VipLend
11+
* @package KuCoin\SDK\PrivateApi
12+
*
13+
* @see https://www.kucoin.com/docs/rest/vip-lending/introduction
14+
*
15+
*/
16+
class VipLend extends KuCoinApi
17+
{
18+
/**
19+
* This endpoint is only for querying accounts that are currently involved in loans.
20+
*
21+
* @return mixed|null
22+
* @throws \KuCoin\SDK\Exceptions\BusinessException
23+
* @throws \KuCoin\SDK\Exceptions\HttpException
24+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
25+
*/
26+
public function getLoan()
27+
{
28+
$response = $this->call(Request::METHOD_GET, '/api/v1/otc-loan/loan');
29+
return $response->getApiData();
30+
}
31+
32+
/**
33+
* This endpoint is only for querying accounts that are currently involved in off-exchange funding and loans.
34+
*
35+
* @return mixed|null
36+
* @throws \KuCoin\SDK\Exceptions\BusinessException
37+
* @throws \KuCoin\SDK\Exceptions\HttpException
38+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
39+
*/
40+
public function getAccounts()
41+
{
42+
$response = $this->call(Request::METHOD_GET, '/api/v1/otc-loan/accounts');
43+
return $response->getApiData();
44+
}
45+
}

src/PublicApi/Margin.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace KuCoin\SDK\PublicApi;
4+
5+
use KuCoin\SDK\Http\Request;
6+
use KuCoin\SDK\KuCoinApi;
7+
8+
/**
9+
* Class Margin
10+
* @package KuCoin\SDK\PublicApi
11+
* @see https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-all-margin-trading-pairs-mark-prices
12+
*/
13+
class Margin extends KuCoinApi
14+
{
15+
/**
16+
* This endpoint returns the current mark prices for all margin trading pairs.
17+
*
18+
* @return mixed|null
19+
* @throws \KuCoin\SDK\Exceptions\BusinessException
20+
* @throws \KuCoin\SDK\Exceptions\HttpException
21+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
22+
*/
23+
public function getSymbolsMarkPrice()
24+
{
25+
return $this->call(Request::METHOD_GET, '/api/v3/mark-price/all-symbols')->getApiData();
26+
}
27+
}

src/PublicApi/Symbol.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,18 @@ public function getListV2($market = null)
189189
$response = $this->call(Request::METHOD_GET, '/api/v2/symbols', compact('market'));
190190
return $response->getApiData();
191191
}
192+
193+
/**
194+
* 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.
195+
*
196+
* @param $symbol
197+
* @return mixed|null
198+
* @throws \KuCoin\SDK\Exceptions\BusinessException
199+
* @throws \KuCoin\SDK\Exceptions\HttpException
200+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
201+
*/
202+
public function getV2SymbolDetail($symbol)
203+
{
204+
return $this->call(Request::METHOD_GET, '/api/v2/symbols/' . $symbol)->getApiData();
205+
}
192206
}

tests/PrivateApi/AffiliateTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace KuCoin\SDK\Tests\PrivateApi;
4+
5+
use KuCoin\SDK\Enums\AccountType;
6+
use KuCoin\SDK\PrivateApi\Affiliate;
7+
use KuCoin\SDK\PrivateApi\Earn;
8+
9+
class AffiliateTest extends TestCase
10+
{
11+
protected $apiClass = Affiliate::class;
12+
13+
/**
14+
* @dataProvider apiProvider
15+
*
16+
* @param Affiliate $api
17+
* @return void
18+
* @throws \KuCoin\SDK\Exceptions\BusinessException
19+
* @throws \KuCoin\SDK\Exceptions\HttpException
20+
* @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
21+
*/
22+
public function testGetInviterStatistics(Affiliate $api)
23+
{
24+
$statistics = $api->getInviterStatistics(date('Ymd', strtotime('-10 day')));
25+
$this->assertInternalType('array', $statistics);
26+
}
27+
}

0 commit comments

Comments
 (0)