Merge pull request #381 from JJ-Cro/Update151024
feat(): added Crypto Loan endpoints
This commit is contained in:
@@ -42,6 +42,7 @@ Node.js & JavaScript SDK for the Bybit REST APIs and WebSockets:
|
|||||||
|
|
||||||
- Issues? Check the [issues tab](https://github.com/tiagosiebler/bybit-api/issues).
|
- Issues? Check the [issues tab](https://github.com/tiagosiebler/bybit-api/issues).
|
||||||
- Discuss & collaborate with other node devs? Join our [Node.js Algo Traders](https://t.me/nodetraders) engineering community on telegram.
|
- Discuss & collaborate with other node devs? Join our [Node.js Algo Traders](https://t.me/nodetraders) engineering community on telegram.
|
||||||
|
- Follow our announcement channel for real-time updates on [X/Twitter](https://x.com/QuantSDKs)
|
||||||
|
|
||||||
<!-- template_related_projects -->
|
<!-- template_related_projects -->
|
||||||
|
|
||||||
|
|||||||
@@ -182,6 +182,17 @@ This table includes all endpoints from the official Exchange API docs and corres
|
|||||||
| `getSpotMarginBorrowOrderDetail()` | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/orders` |
|
| `getSpotMarginBorrowOrderDetail()` | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/orders` |
|
||||||
| `getSpotMarginRepaymentOrderDetail()` | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/repay-history` |
|
| `getSpotMarginRepaymentOrderDetail()` | :closed_lock_with_key: | GET | `/v5/spot-cross-margin-trade/repay-history` |
|
||||||
| `toggleSpotCrossMarginTrade()` | :closed_lock_with_key: | POST | `/v5/spot-cross-margin-trade/switch` |
|
| `toggleSpotCrossMarginTrade()` | :closed_lock_with_key: | POST | `/v5/spot-cross-margin-trade/switch` |
|
||||||
|
| `getCollateralCoins()` | | GET | `/v5/crypto-loan/collateral-data` |
|
||||||
|
| `getBorrowableCoins()` | | GET | `/v5/crypto-loan/loanable-data` |
|
||||||
|
| `getAccountBorrowCollateralLimit()` | :closed_lock_with_key: | GET | `/v5/crypto-loan/borrowable-collateralisable-number` |
|
||||||
|
| `borrowCryptoLoan()` | :closed_lock_with_key: | POST | `/v5/crypto-loan/borrow` |
|
||||||
|
| `repayCryptoLoan()` | :closed_lock_with_key: | POST | `/v5/crypto-loan/repay` |
|
||||||
|
| `getUnpaidLoanOrders()` | :closed_lock_with_key: | GET | `/v5/crypto-loan/ongoing-orders` |
|
||||||
|
| `getRepaymentHistory()` | :closed_lock_with_key: | GET | `/v5/crypto-loan/repayment-history` |
|
||||||
|
| `getCompletedLoanOrderHistory()` | :closed_lock_with_key: | GET | `/v5/crypto-loan/borrow-history` |
|
||||||
|
| `getMaxAllowedReductionCollateralAmount()` | :closed_lock_with_key: | GET | `/v5/crypto-loan/max-collateral-amount` |
|
||||||
|
| `adjustCollateralAmount()` | :closed_lock_with_key: | POST | `/v5/crypto-loan/adjust-ltv` |
|
||||||
|
| `getLoanLTVAdjustmentHistory()` | :closed_lock_with_key: | GET | `/v5/crypto-loan/adjustment-history` |
|
||||||
| `getInstitutionalLendingProductInfo()` | | GET | `/v5/ins-loan/product-infos` |
|
| `getInstitutionalLendingProductInfo()` | | GET | `/v5/ins-loan/product-infos` |
|
||||||
| `getInstitutionalLendingMarginCoinInfo()` | | GET | `/v5/ins-loan/ensure-tokens` |
|
| `getInstitutionalLendingMarginCoinInfo()` | | GET | `/v5/ins-loan/ensure-tokens` |
|
||||||
| `getInstitutionalLendingMarginCoinInfoWithConversionRate()` | | GET | `/v5/ins-loan/ensure-tokens-convert` |
|
| `getInstitutionalLendingMarginCoinInfoWithConversionRate()` | | GET | `/v5/ins-loan/ensure-tokens-convert` |
|
||||||
@@ -192,4 +203,7 @@ This table includes all endpoints from the official Exchange API docs and corres
|
|||||||
| `bindOrUnbindUID()` | :closed_lock_with_key: | POST | `/v5/ins-loan/association-uid` |
|
| `bindOrUnbindUID()` | :closed_lock_with_key: | POST | `/v5/ins-loan/association-uid` |
|
||||||
| `getExchangeBrokerEarnings()` | :closed_lock_with_key: | GET | `/v5/broker/earnings-info` |
|
| `getExchangeBrokerEarnings()` | :closed_lock_with_key: | GET | `/v5/broker/earnings-info` |
|
||||||
| `getExchangeBrokerAccountInfo()` | :closed_lock_with_key: | GET | `/v5/broker/account-info` |
|
| `getExchangeBrokerAccountInfo()` | :closed_lock_with_key: | GET | `/v5/broker/account-info` |
|
||||||
| `getBrokerSubAccountDeposits()` | :closed_lock_with_key: | GET | `/v5/broker/asset/query-sub-member-deposit-record` |
|
| `getBrokerSubAccountDeposits()` | :closed_lock_with_key: | GET | `/v5/broker/asset/query-sub-member-deposit-record` |
|
||||||
|
| `getBrokerVoucherSpec()` | :closed_lock_with_key: | POST | `/v5/broker/award/info` |
|
||||||
|
| `issueBrokerVoucher()` | :closed_lock_with_key: | POST | `/v5/broker/award/distribute-award` |
|
||||||
|
| `getBrokerIssuedVoucher()` | :closed_lock_with_key: | POST | `/v5/broker/award/distribution-record` |
|
||||||
20
examples/apidoc/V5/Crypto-Loan/adjust-collateral-amount.js
Normal file
20
examples/apidoc/V5/Crypto-Loan/adjust-collateral-amount.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.adjustCollateralAmount({
|
||||||
|
orderId: '1794267532472646144',
|
||||||
|
amount: '0.001',
|
||||||
|
direction: '1',
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
22
examples/apidoc/V5/Crypto-Loan/borrow.js
Normal file
22
examples/apidoc/V5/Crypto-Loan/borrow.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.borrowCryptoLoan({
|
||||||
|
loanCurrency: 'USDT',
|
||||||
|
loanAmount: '550',
|
||||||
|
collateralCurrency: 'BTC',
|
||||||
|
loanTerm: null,
|
||||||
|
collateralAmount: null,
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.getAccountBorrowCollateralLimit({
|
||||||
|
loanCurrency: 'USDT',
|
||||||
|
collateralCurrency: 'BTC',
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
19
examples/apidoc/V5/Crypto-Loan/get-borrowable-coins.js
Normal file
19
examples/apidoc/V5/Crypto-Loan/get-borrowable-coins.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.getBorrowableCoins({
|
||||||
|
currency: 'USDT',
|
||||||
|
vipLevel: 'VIP0',
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
19
examples/apidoc/V5/Crypto-Loan/get-collateral-coins.js
Normal file
19
examples/apidoc/V5/Crypto-Loan/get-collateral-coins.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.getCollateralCoins({
|
||||||
|
currency: 'ETH',
|
||||||
|
vipLevel: 'PRO1',
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.getCompletedLoanOrderHistory({ orderId: '1794267532472646144' })
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.getLoanLTVAdjustmentHistory({ adjustId: '1794271131730737664' })
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.getMaxAllowedReductionCollateralAmount({ orderId: '1794267532472646144' })
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.getRepaymentHistory({ repayId: '1794271131730737664' })
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
16
examples/apidoc/V5/Crypto-Loan/get-unpaid-loan-orders.js
Normal file
16
examples/apidoc/V5/Crypto-Loan/get-unpaid-loan-orders.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.getUnpaidLoanOrders({ orderId: '1793683005081680384' })
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
19
examples/apidoc/V5/Crypto-Loan/repay.js
Normal file
19
examples/apidoc/V5/Crypto-Loan/repay.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
const { RestClientV5 } = require('bybit-api');
|
||||||
|
|
||||||
|
const client = new RestClientV5({
|
||||||
|
testnet: true,
|
||||||
|
key: 'apikey',
|
||||||
|
secret: 'apisecret',
|
||||||
|
});
|
||||||
|
|
||||||
|
client
|
||||||
|
.repayCryptoLoan({
|
||||||
|
orderId: '1794267532472646144',
|
||||||
|
amount: '100',
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.19",
|
"version": "3.10.20",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.19",
|
"version": "3.10.20",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.6.6",
|
"axios": "^1.6.6",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bybit-api",
|
"name": "bybit-api",
|
||||||
"version": "3.10.19",
|
"version": "3.10.20",
|
||||||
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
|
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import {
|
import {
|
||||||
APIResponseV3,
|
APIResponseV3,
|
||||||
APIResponseV3WithTime,
|
APIResponseV3WithTime,
|
||||||
|
AccountBorrowCollateralLimitV5,
|
||||||
AccountCoinBalanceV5,
|
AccountCoinBalanceV5,
|
||||||
AccountInfoV5,
|
AccountInfoV5,
|
||||||
AccountMarginModeV5,
|
AccountMarginModeV5,
|
||||||
@@ -22,6 +23,7 @@ import {
|
|||||||
BatchCreateOrderResultV5,
|
BatchCreateOrderResultV5,
|
||||||
BatchOrderParamsV5,
|
BatchOrderParamsV5,
|
||||||
BatchOrdersResponseV5,
|
BatchOrdersResponseV5,
|
||||||
|
BorrowCryptoLoanParamsV5,
|
||||||
BorrowHistoryRecordV5,
|
BorrowHistoryRecordV5,
|
||||||
BrokerIssuedVoucherV5,
|
BrokerIssuedVoucherV5,
|
||||||
BrokerVoucherSpecV5,
|
BrokerVoucherSpecV5,
|
||||||
@@ -36,6 +38,7 @@ import {
|
|||||||
CoinGreeksV5,
|
CoinGreeksV5,
|
||||||
CoinInfoV5,
|
CoinInfoV5,
|
||||||
CollateralInfoV5,
|
CollateralInfoV5,
|
||||||
|
CompletedLoanOrderV5,
|
||||||
ConfirmNewRiskLimitParamsV5,
|
ConfirmNewRiskLimitParamsV5,
|
||||||
ConvertCoinSpecV5,
|
ConvertCoinSpecV5,
|
||||||
ConvertCoinsParamsV5,
|
ConvertCoinsParamsV5,
|
||||||
@@ -72,6 +75,7 @@ import {
|
|||||||
GetClassicTransactionLogsParamsV5,
|
GetClassicTransactionLogsParamsV5,
|
||||||
GetClosedPnLParamsV5,
|
GetClosedPnLParamsV5,
|
||||||
GetCoinExchangeRecordParamsV5,
|
GetCoinExchangeRecordParamsV5,
|
||||||
|
GetCompletedLoanOrderHistoryParamsV5,
|
||||||
GetConvertHistoryParamsV5,
|
GetConvertHistoryParamsV5,
|
||||||
GetDeliveryPriceParamsV5,
|
GetDeliveryPriceParamsV5,
|
||||||
GetDeliveryRecordParamsV5,
|
GetDeliveryRecordParamsV5,
|
||||||
@@ -87,6 +91,7 @@ import {
|
|||||||
GetInternalDepositRecordParamsV5,
|
GetInternalDepositRecordParamsV5,
|
||||||
GetInternalTransferParamsV5,
|
GetInternalTransferParamsV5,
|
||||||
GetKlineParamsV5,
|
GetKlineParamsV5,
|
||||||
|
GetLoanLTVAdjustmentHistoryParamsV5,
|
||||||
GetLongShortRatioParamsV5,
|
GetLongShortRatioParamsV5,
|
||||||
GetMarkPriceKlineParamsV5,
|
GetMarkPriceKlineParamsV5,
|
||||||
GetMovePositionHistoryParamsV5,
|
GetMovePositionHistoryParamsV5,
|
||||||
@@ -101,6 +106,7 @@ import {
|
|||||||
GetPreUpgradeUSDCSessionParamsV5,
|
GetPreUpgradeUSDCSessionParamsV5,
|
||||||
GetPremiumIndexPriceKlineParamsV5,
|
GetPremiumIndexPriceKlineParamsV5,
|
||||||
GetPublicTradingHistoryParamsV5,
|
GetPublicTradingHistoryParamsV5,
|
||||||
|
GetRepaymentHistoryParamsV5,
|
||||||
GetRiskLimitParamsV5,
|
GetRiskLimitParamsV5,
|
||||||
GetSettlementRecordParamsV5,
|
GetSettlementRecordParamsV5,
|
||||||
GetSpotLeveragedTokenOrderHistoryParamsV5,
|
GetSpotLeveragedTokenOrderHistoryParamsV5,
|
||||||
@@ -109,6 +115,7 @@ import {
|
|||||||
GetTickersParamsV5,
|
GetTickersParamsV5,
|
||||||
GetTransactionLogParamsV5,
|
GetTransactionLogParamsV5,
|
||||||
GetUniversalTransferRecordsParamsV5,
|
GetUniversalTransferRecordsParamsV5,
|
||||||
|
GetUnpaidLoanOrdersParamsV5,
|
||||||
GetVIPMarginDataParamsV5,
|
GetVIPMarginDataParamsV5,
|
||||||
GetWalletBalanceParamsV5,
|
GetWalletBalanceParamsV5,
|
||||||
GetWithdrawalRecordsParamsV5,
|
GetWithdrawalRecordsParamsV5,
|
||||||
@@ -120,6 +127,7 @@ import {
|
|||||||
IssueVoucherParamsV5,
|
IssueVoucherParamsV5,
|
||||||
LeverageTokenInfoV5,
|
LeverageTokenInfoV5,
|
||||||
LeveragedTokenMarketResultV5,
|
LeveragedTokenMarketResultV5,
|
||||||
|
LoanLTVAdjustmentHistoryV5,
|
||||||
LongShortRatioV5,
|
LongShortRatioV5,
|
||||||
MMPModifyParamsV5,
|
MMPModifyParamsV5,
|
||||||
MMPStateV5,
|
MMPStateV5,
|
||||||
@@ -146,6 +154,7 @@ import {
|
|||||||
RedeemSpotLeveragedTokenResultV5,
|
RedeemSpotLeveragedTokenResultV5,
|
||||||
RepayLiabilityParamsV5,
|
RepayLiabilityParamsV5,
|
||||||
RepayLiabilityResultV5,
|
RepayLiabilityResultV5,
|
||||||
|
RepaymentHistoryV5,
|
||||||
RequestConvertQuoteParamsV5,
|
RequestConvertQuoteParamsV5,
|
||||||
RiskLimitV5,
|
RiskLimitV5,
|
||||||
SetAutoAddMarginParamsV5,
|
SetAutoAddMarginParamsV5,
|
||||||
@@ -171,10 +180,13 @@ import {
|
|||||||
UnifiedAccountUpgradeResultV5,
|
UnifiedAccountUpgradeResultV5,
|
||||||
UniversalTransferParamsV5,
|
UniversalTransferParamsV5,
|
||||||
UniversalTransferRecordV5,
|
UniversalTransferRecordV5,
|
||||||
|
UnpaidLoanOrderV5,
|
||||||
UpdateApiKeyParamsV5,
|
UpdateApiKeyParamsV5,
|
||||||
UpdateApiKeyResultV5,
|
UpdateApiKeyResultV5,
|
||||||
VIPMarginDataV5,
|
VIPMarginDataV5,
|
||||||
VaspEntityV5,
|
VaspEntityV5,
|
||||||
|
VipBorrowableCoinsV5,
|
||||||
|
VipCollateralCoinsV5,
|
||||||
WalletBalanceV5,
|
WalletBalanceV5,
|
||||||
WithdrawParamsV5,
|
WithdrawParamsV5,
|
||||||
WithdrawalRecordV5,
|
WithdrawalRecordV5,
|
||||||
@@ -2022,6 +2034,206 @@ export class RestClientV5 extends BaseRestClient {
|
|||||||
return this.postPrivate('/v5/spot-cross-margin-trade/switch', params);
|
return this.postPrivate('/v5/spot-cross-margin-trade/switch', params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
****** Crypto Loan
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Collateral Coins
|
||||||
|
*
|
||||||
|
* INFO: Do not need authentication
|
||||||
|
*/
|
||||||
|
getCollateralCoins(params?: {
|
||||||
|
vipLevel?: string;
|
||||||
|
currency?: string;
|
||||||
|
}): Promise<
|
||||||
|
APIResponseV3WithTime<{
|
||||||
|
vipCoinList: VipCollateralCoinsV5[];
|
||||||
|
}>
|
||||||
|
> {
|
||||||
|
return this.get('/v5/crypto-loan/collateral-data', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Borrowable Coins
|
||||||
|
*
|
||||||
|
* INFO: Do not need authentication
|
||||||
|
*/
|
||||||
|
getBorrowableCoins(params?: {
|
||||||
|
vipLevel?: string;
|
||||||
|
currency?: string;
|
||||||
|
}): Promise<
|
||||||
|
APIResponseV3WithTime<{
|
||||||
|
vipCoinList: VipBorrowableCoinsV5[];
|
||||||
|
}>
|
||||||
|
> {
|
||||||
|
return this.get('/v5/crypto-loan/loanable-data', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Account Borrow/Collateral Limit
|
||||||
|
* Query the account borrowable/collateral limit
|
||||||
|
*
|
||||||
|
* Permission: "Spot trade"
|
||||||
|
*/
|
||||||
|
getAccountBorrowCollateralLimit(params: {
|
||||||
|
loanCurrency: string;
|
||||||
|
collateralCurrency: string;
|
||||||
|
}): Promise<APIResponseV3WithTime<AccountBorrowCollateralLimitV5>> {
|
||||||
|
return this.getPrivate(
|
||||||
|
'/v5/crypto-loan/borrowable-collateralisable-number',
|
||||||
|
params,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Borrow Crypto Loan
|
||||||
|
*
|
||||||
|
* Permission: "Spot trade"
|
||||||
|
*
|
||||||
|
* INFO:
|
||||||
|
* The loan funds are released to the Funding account
|
||||||
|
* The collateral funds are deducted from the Funding account, so make sure you have enough collateral amount in the funding wallet
|
||||||
|
*/
|
||||||
|
borrowCryptoLoan(params: BorrowCryptoLoanParamsV5): Promise<
|
||||||
|
APIResponseV3WithTime<{
|
||||||
|
orderId: string;
|
||||||
|
}>
|
||||||
|
> {
|
||||||
|
return this.postPrivate('/v5/crypto-loan/borrow', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repay Crypto Loan
|
||||||
|
*
|
||||||
|
* You can repay partial loan. If there is interest occurred, interest will be repaid in priority
|
||||||
|
*
|
||||||
|
* Permission: "Spot trade"
|
||||||
|
*
|
||||||
|
* INFO:
|
||||||
|
* The repaid amount will be deducted from Funding account
|
||||||
|
* The collateral amount will not be auto returned when you don't fully repay the debt, but you can also adjust collateral amount
|
||||||
|
*/
|
||||||
|
repayCryptoLoan(params: { orderId: string; amount: string }): Promise<
|
||||||
|
APIResponseV3WithTime<{
|
||||||
|
repayId: string;
|
||||||
|
}>
|
||||||
|
> {
|
||||||
|
return this.postPrivate('/v5/crypto-loan/repay', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Unpaid Loan Orders
|
||||||
|
* Query the ongoing loan orders, which are not fully repaid
|
||||||
|
*
|
||||||
|
* Permission: "Spot trade"
|
||||||
|
*/
|
||||||
|
getUnpaidLoanOrders(params?: GetUnpaidLoanOrdersParamsV5): Promise<
|
||||||
|
APIResponseV3WithTime<{
|
||||||
|
list: UnpaidLoanOrderV5[];
|
||||||
|
nextPageCursor: string;
|
||||||
|
}>
|
||||||
|
> {
|
||||||
|
return this.getPrivate('/v5/crypto-loan/ongoing-orders', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Repayment Transaction History
|
||||||
|
* Query repaid transaction history
|
||||||
|
*
|
||||||
|
* Permission: "Spot trade"
|
||||||
|
*
|
||||||
|
* INFO:
|
||||||
|
* Support querying last 6 months completed loan orders
|
||||||
|
* Only successful repayments can be queried
|
||||||
|
*/
|
||||||
|
getRepaymentHistory(params?: GetRepaymentHistoryParamsV5): Promise<
|
||||||
|
APIResponseV3WithTime<{
|
||||||
|
list: RepaymentHistoryV5[];
|
||||||
|
nextPageCursor: string;
|
||||||
|
}>
|
||||||
|
> {
|
||||||
|
return this.getPrivate('/v5/crypto-loan/repayment-history', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Completed Loan Order History
|
||||||
|
* Query the completed loan orders
|
||||||
|
*
|
||||||
|
* Permission: "Spot trade"
|
||||||
|
*
|
||||||
|
* INFO:
|
||||||
|
* Support querying last 6 months completed loan orders
|
||||||
|
*/
|
||||||
|
getCompletedLoanOrderHistory(
|
||||||
|
params?: GetCompletedLoanOrderHistoryParamsV5,
|
||||||
|
): Promise<
|
||||||
|
APIResponseV3WithTime<{
|
||||||
|
list: CompletedLoanOrderV5[];
|
||||||
|
nextPageCursor: string;
|
||||||
|
}>
|
||||||
|
> {
|
||||||
|
return this.getPrivate('/v5/crypto-loan/borrow-history', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Max. Allowed Reduction Collateral Amount
|
||||||
|
* Query the maximum allowed reduction collateral amount
|
||||||
|
*
|
||||||
|
* Permission: "Spot trade"
|
||||||
|
*/
|
||||||
|
getMaxAllowedReductionCollateralAmount(params: { orderId: string }): Promise<
|
||||||
|
APIResponseV3WithTime<{
|
||||||
|
maxCollateralAmount: string;
|
||||||
|
}>
|
||||||
|
> {
|
||||||
|
return this.getPrivate('/v5/crypto-loan/max-collateral-amount', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjust Collateral Amount
|
||||||
|
* You can increase or reduce collateral amount. When you reduce, please follow the max. allowed reduction amount.
|
||||||
|
*
|
||||||
|
* Permission: "Spot trade"
|
||||||
|
*
|
||||||
|
* INFO:
|
||||||
|
* The adjusted collateral amount will be returned to or deducted from Funding account
|
||||||
|
*/
|
||||||
|
adjustCollateralAmount(params: {
|
||||||
|
orderId: string;
|
||||||
|
amount: string;
|
||||||
|
direction: '0' | '1';
|
||||||
|
}): Promise<
|
||||||
|
APIResponseV3WithTime<{
|
||||||
|
adjustId: string;
|
||||||
|
}>
|
||||||
|
> {
|
||||||
|
return this.postPrivate('/v5/crypto-loan/adjust-ltv', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Loan LTV Adjustment History
|
||||||
|
* Query the transaction history of collateral amount adjustment
|
||||||
|
*
|
||||||
|
* Permission: "Spot trade"
|
||||||
|
*
|
||||||
|
* INFO:
|
||||||
|
* Support querying last 6 months adjustment transactions
|
||||||
|
* Only the ltv adjustment transactions launched by the user can be queried
|
||||||
|
*/
|
||||||
|
getLoanLTVAdjustmentHistory(
|
||||||
|
params?: GetLoanLTVAdjustmentHistoryParamsV5,
|
||||||
|
): Promise<
|
||||||
|
APIResponseV3WithTime<{
|
||||||
|
list: LoanLTVAdjustmentHistoryV5[];
|
||||||
|
nextPageCursor: string;
|
||||||
|
}>
|
||||||
|
> {
|
||||||
|
return this.getPrivate('/v5/crypto-loan/adjustment-history', params);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
****** Institutional Lending
|
****** Institutional Lending
|
||||||
|
|||||||
@@ -17,3 +17,4 @@ export * from './v5-trade';
|
|||||||
export * from './v5-user';
|
export * from './v5-user';
|
||||||
export * from './v5-spot-leverage-token';
|
export * from './v5-spot-leverage-token';
|
||||||
export * from './v5-broker';
|
export * from './v5-broker';
|
||||||
|
export * from './v5-crypto-loan';
|
||||||
|
|||||||
41
src/types/request/v5-crypto-loan.ts
Normal file
41
src/types/request/v5-crypto-loan.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
export interface BorrowCryptoLoanParamsV5 {
|
||||||
|
loanCurrency: string;
|
||||||
|
loanAmount?: string;
|
||||||
|
loanTerm?: string;
|
||||||
|
collateralCurrency: string;
|
||||||
|
collateralAmount?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetUnpaidLoanOrdersParamsV5 {
|
||||||
|
orderId?: string;
|
||||||
|
loanCurrency?: string;
|
||||||
|
collateralCurrency?: string;
|
||||||
|
loanTermType?: string;
|
||||||
|
loanTerm?: string;
|
||||||
|
limit?: string;
|
||||||
|
cursor?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetRepaymentHistoryParamsV5 {
|
||||||
|
orderId?: string;
|
||||||
|
repayId?: string;
|
||||||
|
loanCurrency?: string;
|
||||||
|
limit?: string;
|
||||||
|
cursor?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetCompletedLoanOrderHistoryParamsV5 {
|
||||||
|
orderId?: string;
|
||||||
|
loanCurrency?: string;
|
||||||
|
collateralCurrency?: string;
|
||||||
|
limit?: string;
|
||||||
|
cursor?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetLoanLTVAdjustmentHistoryParamsV5 {
|
||||||
|
orderId?: string;
|
||||||
|
adjustId?: string;
|
||||||
|
collateralCurrency?: string;
|
||||||
|
limit?: string;
|
||||||
|
cursor?: string;
|
||||||
|
}
|
||||||
@@ -13,3 +13,4 @@ export * from './v5-user';
|
|||||||
export * from './v5-spot-leverage-token';
|
export * from './v5-spot-leverage-token';
|
||||||
export * from './v5-broker';
|
export * from './v5-broker';
|
||||||
export * from './v5-preupgrade';
|
export * from './v5-preupgrade';
|
||||||
|
export * from './v5-crypto-loan';
|
||||||
|
|||||||
92
src/types/response/v5-crypto-loan.ts
Normal file
92
src/types/response/v5-crypto-loan.ts
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
export interface CollateralCoinV5 {
|
||||||
|
collateralAccuracy: number;
|
||||||
|
currency: string;
|
||||||
|
initialLTV: string;
|
||||||
|
liquidationLTV: string;
|
||||||
|
marginCallLTV: string;
|
||||||
|
maxLimit: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface VipCollateralCoinsV5 {
|
||||||
|
list: CollateralCoinV5[];
|
||||||
|
vipLevel: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BorrowableCoinV5 {
|
||||||
|
borrowingAccuracy: number;
|
||||||
|
currency: string;
|
||||||
|
flexibleHourlyInterestRate: string;
|
||||||
|
hourlyInterestRate7D: string;
|
||||||
|
hourlyInterestRate14D: string;
|
||||||
|
hourlyInterestRate30D: string;
|
||||||
|
hourlyInterestRate90D: string;
|
||||||
|
hourlyInterestRate180D: string;
|
||||||
|
maxBorrowingAmount: string;
|
||||||
|
minBorrowingAmount: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface VipBorrowableCoinsV5 {
|
||||||
|
list: BorrowableCoinV5[];
|
||||||
|
vipLevel: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AccountBorrowCollateralLimitV5 {
|
||||||
|
collateralCurrency: string;
|
||||||
|
loanCurrency: string;
|
||||||
|
maxCollateralAmount: string;
|
||||||
|
maxLoanAmount: string;
|
||||||
|
minCollateralAmount: string;
|
||||||
|
minLoanAmount: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UnpaidLoanOrderV5 {
|
||||||
|
collateralAmount: string;
|
||||||
|
collateralCurrency: string;
|
||||||
|
currentLTV: string;
|
||||||
|
expirationTime: string;
|
||||||
|
hourlyInterestRate: string;
|
||||||
|
loanCurrency: string;
|
||||||
|
loanTerm: string;
|
||||||
|
orderId: string;
|
||||||
|
residualInterest: string;
|
||||||
|
residualPenaltyInterest: string;
|
||||||
|
totalDebt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RepaymentHistoryV5 {
|
||||||
|
collateralCurrency: string;
|
||||||
|
collateralReturn: string;
|
||||||
|
loanCurrency: string;
|
||||||
|
loanTerm: string;
|
||||||
|
orderId: string;
|
||||||
|
repayAmount: string;
|
||||||
|
repayId: string;
|
||||||
|
repayStatus: number;
|
||||||
|
repayTime: string;
|
||||||
|
repayType: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CompletedLoanOrderV5 {
|
||||||
|
borrowTime: string;
|
||||||
|
collateralCurrency: string;
|
||||||
|
expirationTime: string;
|
||||||
|
hourlyInterestRate: string;
|
||||||
|
initialCollateralAmount: string;
|
||||||
|
initialLoanAmount: string;
|
||||||
|
loanCurrency: string;
|
||||||
|
loanTerm: string;
|
||||||
|
orderId: string;
|
||||||
|
repaidInterest: string;
|
||||||
|
repaidPenaltyInterest: string;
|
||||||
|
status: number;
|
||||||
|
}
|
||||||
|
export interface LoanLTVAdjustmentHistoryV5 {
|
||||||
|
collateralCurrency: string;
|
||||||
|
orderId: string;
|
||||||
|
adjustId: string;
|
||||||
|
adjustTime: string;
|
||||||
|
preLTV: string;
|
||||||
|
afterLTV: string;
|
||||||
|
direction: number;
|
||||||
|
amount: string;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user