Skip to content

Commit

Permalink
feat(): added Crypto Loan endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ-Cro committed Oct 15, 2024
1 parent e019fb4 commit 7b7258b
Show file tree
Hide file tree
Showing 18 changed files with 566 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
- 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 -->

Expand Down
16 changes: 15 additions & 1 deletion docs/endpointFunctionList.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
| `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` |
| `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` |
| `getInstitutionalLendingMarginCoinInfo()` | | GET | `/v5/ins-loan/ensure-tokens` |
| `getInstitutionalLendingMarginCoinInfoWithConversionRate()` | | GET | `/v5/ins-loan/ensure-tokens-convert` |
Expand All @@ -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` |
| `getExchangeBrokerEarnings()` | :closed_lock_with_key: | GET | `/v5/broker/earnings-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 changes: 20 additions & 0 deletions examples/apidoc/V5/Crypto-Loan/adjust-collateral-amount.js
Original file line number Diff line number Diff line change
@@ -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 changes: 22 additions & 0 deletions examples/apidoc/V5/Crypto-Loan/borrow.js
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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 changes: 19 additions & 0 deletions examples/apidoc/V5/Crypto-Loan/get-borrowable-coins.js
Original file line number Diff line number Diff line change
@@ -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 changes: 19 additions & 0 deletions examples/apidoc/V5/Crypto-Loan/get-collateral-coins.js
Original file line number Diff line number Diff line change
@@ -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);
});
16 changes: 16 additions & 0 deletions examples/apidoc/V5/Crypto-Loan/get-completed-loan-order-history.js
Original file line number Diff line number Diff line change
@@ -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);
});
16 changes: 16 additions & 0 deletions examples/apidoc/V5/Crypto-Loan/get-loan-LTV-adjustment-history.js
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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);
});
Original file line number Diff line number Diff line change
@@ -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 changes: 16 additions & 0 deletions examples/apidoc/V5/Crypto-Loan/get-unpaid-loan-orders.js
Original file line number Diff line number Diff line change
@@ -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 changes: 19 additions & 0 deletions examples/apidoc/V5/Crypto-Loan/repay.js
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"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.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
Loading

0 comments on commit 7b7258b

Please sign in to comment.