1+ <?php
2+
3+ namespace KuCoin \SDK \PrivateApi ;
4+
5+ use KuCoin \SDK \Http \Request ;
6+ use KuCoin \SDK \KuCoinApi ;
7+
8+ /**
9+ * Class Lend
10+ * @package KuCoin\SDK\PrivateApi
11+ *
12+ * @see https://www.kucoin.com/docs/rest/margin-trading/lending-market-v3-/get-currency-information
13+ */
14+ class Lend extends KuCoinApi
15+ {
16+ /**
17+ * This API endpoint is used to get the information about the currencies available for lending.
18+ *
19+ * @param string $currency
20+ * @return mixed|null
21+ * @throws \KuCoin\SDK\Exceptions\BusinessException
22+ * @throws \KuCoin\SDK\Exceptions\HttpException
23+ * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
24+ */
25+ public function getCurrencies ($ currency = '' )
26+ {
27+ $ params = $ currency ? ['currency ' => $ currency ] : [];
28+ $ response = $ this ->call (Request::METHOD_GET , '/api/v3/project/list ' , $ params );
29+ return $ response ->getApiData ();
30+ }
31+
32+ /**
33+ * This API endpoint is used to get the interest rates of the margin lending market over the past 7 days.
34+ *
35+ * @param $currency
36+ * @return mixed|null
37+ * @throws \KuCoin\SDK\Exceptions\BusinessException
38+ * @throws \KuCoin\SDK\Exceptions\HttpException
39+ * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
40+ */
41+ public function getMarketInterestRate ($ currency )
42+ {
43+ $ params = ['currency ' => $ currency ];
44+ $ response = $ this ->call (Request::METHOD_GET , '/api/v3/project/marketInterestRate ' , $ params );
45+ return $ response ->getApiData ();
46+ }
47+
48+ /**
49+ * Initiate subscriptions of margin lending.
50+ *
51+ * @param array $params
52+ * @return mixed|null
53+ * @throws \KuCoin\SDK\Exceptions\BusinessException
54+ * @throws \KuCoin\SDK\Exceptions\HttpException
55+ * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
56+ */
57+ public function purchase (array $ params )
58+ {
59+ $ response = $ this ->call (Request::METHOD_POST , '/api/v3/purchase ' , $ params );
60+ return $ response ->getApiData ();
61+ }
62+
63+ /**
64+ * Initiate redemptions of margin lending.
65+ *
66+ * @param array $params
67+ * @return mixed|null
68+ * @throws \KuCoin\SDK\Exceptions\BusinessException
69+ * @throws \KuCoin\SDK\Exceptions\HttpException
70+ * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
71+ */
72+ public function redeem (array $ params )
73+ {
74+ $ response = $ this ->call (Request::METHOD_POST , '/api/v3/redeem ' , $ params );
75+ return $ response ->getApiData ();
76+ }
77+
78+ /**
79+ * This API endpoint is used to update the interest rates of subscription orders, which will take effect at the beginning of the next hour.
80+ *
81+ * @param array $params
82+ * @return mixed|null
83+ * @throws \KuCoin\SDK\Exceptions\BusinessException
84+ * @throws \KuCoin\SDK\Exceptions\HttpException
85+ * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
86+ */
87+ public function purchaseUpdate (array $ params )
88+ {
89+ $ response = $ this ->call (Request::METHOD_POST , '/api/v3/lend/purchase/update ' , $ params );
90+ return $ response ->getApiData ();
91+ }
92+
93+ /**
94+ * This API endpoint provides pagination query for the redemption orders.
95+ *
96+ * @param array $params
97+ * @param array $pagination
98+ * @return mixed|null
99+ * @throws \KuCoin\SDK\Exceptions\BusinessException
100+ * @throws \KuCoin\SDK\Exceptions\HttpException
101+ * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
102+ */
103+ public function getRedeemOrders (array $ params , array $ pagination = [])
104+ {
105+ $ response = $ this ->call (Request::METHOD_GET , '/api/v3/redeem/orders ' , $ params + $ pagination );
106+ return $ response ->getApiData ();
107+ }
108+
109+ /**
110+ * This API endpoint provides pagination query for the subscription orders.
111+ *
112+ * @param array $params
113+ * @param array $pagination
114+ * @return mixed|null
115+ * @throws \KuCoin\SDK\Exceptions\BusinessException
116+ * @throws \KuCoin\SDK\Exceptions\HttpException
117+ * @throws \KuCoin\SDK\Exceptions\InvalidApiUriException
118+ */
119+ public function getPurchaseOrders (array $ params , array $ pagination = [])
120+ {
121+ $ response = $ this ->call (Request::METHOD_GET , '/api/v3/purchase/orders ' , $ params + $ pagination );
122+ return $ response ->getApiData ();
123+ }
124+ }
0 commit comments