KucoinLending: Margin Lending Operations
KucoinLending: Margin Lending Operations
Details
Provides methods for lending assets on the KuCoin margin lending market, managing purchase (lend) orders, and redeeming lent assets. Inherits from KucoinBase.
Purpose and Scope
Loan Market Data: Query available lending currencies and historical interest rates.
Purchase (Lend): Lend assets to the margin pool to earn interest.
Modify: Update interest rate on existing lending orders.
Redeem: Withdraw lent assets from the lending pool.
Order Queries: Retrieve purchase and redemption order history.
Endpoints Covered
| Method | Endpoint | HTTP |
| get_loan_market | GET /api/v3/project/list | GET |
| get_loan_market_rate | GET /api/v3/project/marketInterestRate | GET |
| purchase | POST /api/v3/purchase | POST |
| modify_purchase | POST /api/v3/lend/purchase/update | POST |
| get_purchase_orders | GET /api/v3/purchase/orders | GET |
| redeem | POST /api/v3/redeem | POST |
| get_redeem_orders | GET /api/v3/redeem/orders | GET |
Super class
kucoin::KucoinBase -> KucoinLending
Methods
Inherited methods
Method get_loan_market()
Get Loan Market Information
Retrieves information about available lending currencies, including minimum/maximum purchase sizes and current market interest rates.
JSON Response
{
"code": "200000",
"data": [
{
"currency": "USDT",
"purchaseEnable": true,
"redeemEnable": true,
"increment": "0.01",
"minPurchaseSize": "10",
"maxPurchaseSize": "1000000",
"interestIncrement": "0.0001",
"minInterestRate": "0.004",
"marketInterestRate": "0.05",
"maxInterestRate": "0.1",
"autoPurchaseEnable": true
}
]
}Usage
KucoinLending$get_loan_market(query = list())Arguments
queryNamed list; optional filter. Supported keys:
currency(character): Filter by currency (e.g.,"USDT").
Method get_loan_market_rate()
Get Loan Market Interest Rate History
Retrieves the market interest rate history for a currency over the past 7 days.
curl
curl --location --request GET \
'https://api.kucoin.com/api/v3/project/marketInterestRate?currency=USDT' \
--header 'KC-API-KEY: your-api-key' \
--header 'KC-API-SIGN: your-signature' \
--header 'KC-API-TIMESTAMP: 1729176273859' \
--header 'KC-API-PASSPHRASE: your-passphrase' \
--header 'KC-API-KEY-VERSION: 2'Method purchase()
Purchase (Lend) Assets
Lends a specified amount of currency to the margin lending pool at a given interest rate to earn passive income.
curl
curl --location --request POST 'https://api.kucoin.com/api/v3/purchase' \
--header 'Content-Type: application/json' \
--header 'KC-API-KEY: your-api-key' \
--header 'KC-API-SIGN: your-signature' \
--header 'KC-API-TIMESTAMP: 1729176273859' \
--header 'KC-API-PASSPHRASE: your-passphrase' \
--header 'KC-API-KEY-VERSION: 2' \
--data-raw '{"currency":"USDT","size":"1000","interestRate":"0.05"}'Arguments
currencyCharacter; the currency to lend (e.g.,
"USDT").sizeNumeric; the amount to lend.
interestRateNumeric; the interest rate (e.g.,
0.05for 5%).
Method modify_purchase()
Modify Purchase Interest Rate
Updates the interest rate on an existing lending order. Rate changes take effect at the start of the next hour.
curl
curl --location --request POST 'https://api.kucoin.com/api/v3/lend/purchase/update' \
--header 'Content-Type: application/json' \
--header 'KC-API-KEY: your-api-key' \
--header 'KC-API-SIGN: your-signature' \
--header 'KC-API-TIMESTAMP: 1729176273859' \
--header 'KC-API-PASSPHRASE: your-passphrase' \
--header 'KC-API-KEY-VERSION: 2' \
--data-raw '{"currency":"USDT","purchaseOrderNo":"abc123","interestRate":"0.06"}'Arguments
currencyCharacter; the currency of the lending order.
purchaseOrderNoCharacter; the order number to modify.
interestRateNumeric; the new interest rate.
Method get_purchase_orders()
Get Purchase Orders
Retrieves lending purchase order history with optional filters.
curl
curl --location --request GET \
'https://api.kucoin.com/api/v3/purchase/orders?currency=USDT&status=DONE¤tPage=1&pageSize=50' \
--header 'KC-API-KEY: your-api-key' \
--header 'KC-API-SIGN: your-signature' \
--header 'KC-API-TIMESTAMP: 1729176273859' \
--header 'KC-API-PASSPHRASE: your-passphrase' \
--header 'KC-API-KEY-VERSION: 2'Usage
KucoinLending$get_purchase_orders(query = list())Arguments
queryNamed list; filters. Supported keys:
status(character): Required. Order status (e.g.,"DONE","PENDING").currency(character): Currency filter (e.g.,"USDT").purchaseOrderNo(character): Specific order number.currentPage(integer): Page number.pageSize(integer): Items per page.
Method redeem()
Redeem Lent Assets
Redeems (withdraws) lent assets from the lending pool. The redemption is processed against a specific purchase order.
curl
curl --location --request POST 'https://api.kucoin.com/api/v3/redeem' \
--header 'Content-Type: application/json' \
--header 'KC-API-KEY: your-api-key' \
--header 'KC-API-SIGN: your-signature' \
--header 'KC-API-TIMESTAMP: 1729176273859' \
--header 'KC-API-PASSPHRASE: your-passphrase' \
--header 'KC-API-KEY-VERSION: 2' \
--data-raw '{"currency":"USDT","size":"500","purchaseOrderNo":"abc123"}'Arguments
currencyCharacter; the currency to redeem (e.g.,
"USDT").sizeNumeric; the amount to redeem.
purchaseOrderNoCharacter; the purchase order to redeem from.
Method get_redeem_orders()
Get Redeem Orders
Retrieves redemption order history with optional filters.
curl
curl --location --request GET \
'https://api.kucoin.com/api/v3/redeem/orders?currency=USDT&status=DONE¤tPage=1&pageSize=50' \
--header 'KC-API-KEY: your-api-key' \
--header 'KC-API-SIGN: your-signature' \
--header 'KC-API-TIMESTAMP: 1729176273859' \
--header 'KC-API-PASSPHRASE: your-passphrase' \
--header 'KC-API-KEY-VERSION: 2'Usage
KucoinLending$get_redeem_orders(query = list())Arguments
queryNamed list; filters. Supported keys:
status(character): Required. Order status (e.g.,"DONE","PENDING").currency(character): Currency filter (e.g.,"USDT").redeemOrderNo(character): Specific redemption order number.currentPage(integer): Page number.pageSize(integer): Items per page.
Examples
if (FALSE) { # \dontrun{
lending <- KucoinLending$new()
# Check available lending currencies
market <- lending$get_loan_market()
print(market)
# Lend USDT at a specified interest rate
order <- lending$purchase(currency = "USDT", size = 1000, interestRate = 0.05)
print(order)
# Redeem lent USDT
result <- lending$redeem(currency = "USDT", size = 1000,
purchaseOrderNo = order$order_no)
} # }
## ------------------------------------------------
## Method `KucoinLending$get_loan_market`
## ------------------------------------------------
if (FALSE) { # \dontrun{
lending <- KucoinLending$new()
market <- lending$get_loan_market(query = list(currency = "USDT"))
print(market)
} # }
## ------------------------------------------------
## Method `KucoinLending$get_loan_market_rate`
## ------------------------------------------------
if (FALSE) { # \dontrun{
lending <- KucoinLending$new()
rates <- lending$get_loan_market_rate(currency = "USDT")
print(rates)
} # }
## ------------------------------------------------
## Method `KucoinLending$purchase`
## ------------------------------------------------
if (FALSE) { # \dontrun{
lending <- KucoinLending$new()
order <- lending$purchase(currency = "USDT", size = 1000, interestRate = 0.05)
print(order$order_no)
} # }
## ------------------------------------------------
## Method `KucoinLending$modify_purchase`
## ------------------------------------------------
if (FALSE) { # \dontrun{
lending <- KucoinLending$new()
lending$modify_purchase(
currency = "USDT",
purchaseOrderNo = "abc123",
interestRate = 0.06
)
} # }
## ------------------------------------------------
## Method `KucoinLending$get_purchase_orders`
## ------------------------------------------------
if (FALSE) { # \dontrun{
lending <- KucoinLending$new()
orders <- lending$get_purchase_orders(query = list(currency = "USDT", status = "DONE"))
print(orders)
} # }
## ------------------------------------------------
## Method `KucoinLending$redeem`
## ------------------------------------------------
if (FALSE) { # \dontrun{
lending <- KucoinLending$new()
result <- lending$redeem(
currency = "USDT", size = 500, purchaseOrderNo = "abc123"
)
print(result$order_no)
} # }
## ------------------------------------------------
## Method `KucoinLending$get_redeem_orders`
## ------------------------------------------------
if (FALSE) { # \dontrun{
lending <- KucoinLending$new()
orders <- lending$get_redeem_orders(query = list(currency = "USDT", status = "DONE"))
print(orders)
} # }