Skip to content

Commit

Permalink
Merge pull request #369 from JJ-Cro/examplesUpdate
Browse files Browse the repository at this point in the history
v3.10.16: feat(): added missing API examples, deprecated abandoned functions
  • Loading branch information
tiagosiebler authored Sep 6, 2024
2 parents 0270571 + 982363e commit 1daaa96
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 6 deletions.
19 changes: 19 additions & 0 deletions examples/apidoc/V5/Account/get-transaction-log-classic.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
.getClassicTransactionLogs({
limit: 1,
symbol: 'BTCUSD',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
7 changes: 6 additions & 1 deletion examples/apidoc/V5/Asset/get-single-coin-balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ const client = new RestClientV5({
});

client
.getAllCoinsBalance({ accountType: 'FUND', coin: 'USDC' })
.getCoinBalance({
accountType: 'UNIFIED',
coin: 'USDT',
toAccountType: 'FUND',
withLtvTransferSafeAmount: 1,
})
.then((response) => {
console.log(response);
})
Expand Down
28 changes: 27 additions & 1 deletion examples/apidoc/V5/Market/get-instruments-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { RestClientV5 } = require('bybit-api');
const client = new RestClientV5({
testnet: true,
});

// linear
client
.getInstrumentsInfo({
category: 'linear',
Expand All @@ -15,3 +15,29 @@ client
.catch((error) => {
console.error(error);
});

// option
client
.getInstrumentsInfo({
category: 'option',
symbol: 'ETH-3JAN23-1250-P',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

// spot
client
.getInstrumentsInfo({
category: 'spot',
symbol: 'BTCUSDT',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
29 changes: 29 additions & 0 deletions examples/apidoc/V5/Market/get-tickers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const client = new RestClientV5({
testnet: true,
});

// inverse
client
.getTickers({
category: 'inverse',
Expand All @@ -15,3 +16,31 @@ client
.catch((error) => {
console.error(error);
});

// option

client
.getTickers({
category: 'option',
symbol: 'BTC-30DEC22-18000-C',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});

// spot

client
.getTickers({
category: 'spot',
symbol: 'BTCUSDT',
})
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
2 changes: 1 addition & 1 deletion examples/apidoc/V5/User/get-affiliate-user-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const client = new RestClientV5({
});

client
.deleteSubApiKey()
.getAffiliateUserInfo({ uid: '1513500' })
.then((response) => {
console.log(response);
})
Expand Down
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.15",
"version": "3.10.16",
"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
6 changes: 6 additions & 0 deletions src/rest-client-v5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,10 @@ export class RestClientV5 extends BaseRestClient {
* Use this endpoint to enable a subaccount to take part in a universal transfer.
* It is a one-time switch which, once thrown, enables a subaccount permanently.
* If not set, your subaccount cannot use universal transfers.
*
* @deprecated - You no longer need to configure transferable sub UIDs.
* Now, all sub UIDs are automatically enabled for universal transfer.
*
*/
enableUniversalTransferForSubUIDs(
subMemberIds: string[],
Expand Down Expand Up @@ -2031,6 +2035,7 @@ export class RestClientV5 extends BaseRestClient {

/**
* Get Margin Coin Info
* @deprecated
*/
getInstitutionalLendingMarginCoinInfo(
productId?: string,
Expand Down Expand Up @@ -2072,6 +2077,7 @@ export class RestClientV5 extends BaseRestClient {

/**
* Get LTV
* @deprecated
*/
getInstitutionalLendingLTV(): Promise<
APIResponseV3WithTime<{ ltvInfo: any[] }>
Expand Down
3 changes: 3 additions & 0 deletions src/types/request/v5-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ export interface GetAllCoinsBalanceParamsV5 {

export interface GetAccountCoinBalanceParamsV5 {
memberId?: string;
toMemberId?: string;
accountType: AccountTypeV5;
coin: string;
toAccountType?: AccountTypeV5;
withBonus?: number;
withTransferSafeAmount?: 0 | 1;
withLtvTransferSafeAmount?: 0 | 1;
}

export interface GetInternalTransferParamsV5 {
Expand Down

0 comments on commit 1daaa96

Please sign in to comment.