From bc318f0823274ef2ce49b4a43f0e10faa05a4903 Mon Sep 17 00:00:00 2001 From: Jerko J <83344666+JJ-Cro@users.noreply.github.com> Date: Fri, 6 Sep 2024 10:14:02 +0200 Subject: [PATCH] feat(): added missing API examples --- ...tion-log.js => get-transaction-log-UTA.js} | 0 .../V5/Account/get-transaction-log-classic.js | 19 ++++++++++++ .../V5/Asset/get-single-coin-balance.js | 7 ++++- .../apidoc/V5/Market/get-instruments-info.js | 28 +++++++++++++++++- examples/apidoc/V5/Market/get-tickers.js | 29 +++++++++++++++++++ .../apidoc/V5/User/get-affiliate-user-info.js | 2 +- src/types/request/v5-asset.ts | 3 ++ 7 files changed, 85 insertions(+), 3 deletions(-) rename examples/apidoc/V5/Account/{get-transaction-log.js => get-transaction-log-UTA.js} (100%) create mode 100644 examples/apidoc/V5/Account/get-transaction-log-classic.js diff --git a/examples/apidoc/V5/Account/get-transaction-log.js b/examples/apidoc/V5/Account/get-transaction-log-UTA.js similarity index 100% rename from examples/apidoc/V5/Account/get-transaction-log.js rename to examples/apidoc/V5/Account/get-transaction-log-UTA.js diff --git a/examples/apidoc/V5/Account/get-transaction-log-classic.js b/examples/apidoc/V5/Account/get-transaction-log-classic.js new file mode 100644 index 0000000..737ca28 --- /dev/null +++ b/examples/apidoc/V5/Account/get-transaction-log-classic.js @@ -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); + }); diff --git a/examples/apidoc/V5/Asset/get-single-coin-balance.js b/examples/apidoc/V5/Asset/get-single-coin-balance.js index 455595d..23f01b0 100644 --- a/examples/apidoc/V5/Asset/get-single-coin-balance.js +++ b/examples/apidoc/V5/Asset/get-single-coin-balance.js @@ -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); }) diff --git a/examples/apidoc/V5/Market/get-instruments-info.js b/examples/apidoc/V5/Market/get-instruments-info.js index e42efc2..87162c5 100644 --- a/examples/apidoc/V5/Market/get-instruments-info.js +++ b/examples/apidoc/V5/Market/get-instruments-info.js @@ -3,7 +3,7 @@ const { RestClientV5 } = require('bybit-api'); const client = new RestClientV5({ testnet: true, }); - +// linear client .getInstrumentsInfo({ category: 'linear', @@ -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); + }); diff --git a/examples/apidoc/V5/Market/get-tickers.js b/examples/apidoc/V5/Market/get-tickers.js index 342a578..1885df1 100644 --- a/examples/apidoc/V5/Market/get-tickers.js +++ b/examples/apidoc/V5/Market/get-tickers.js @@ -4,6 +4,7 @@ const client = new RestClientV5({ testnet: true, }); +// inverse client .getTickers({ category: 'inverse', @@ -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); + }); diff --git a/examples/apidoc/V5/User/get-affiliate-user-info.js b/examples/apidoc/V5/User/get-affiliate-user-info.js index 4dba26d..5de8fd3 100644 --- a/examples/apidoc/V5/User/get-affiliate-user-info.js +++ b/examples/apidoc/V5/User/get-affiliate-user-info.js @@ -7,7 +7,7 @@ const client = new RestClientV5({ }); client - .deleteSubApiKey() + .getAffiliateUserInfo({ uid: '1513500' }) .then((response) => { console.log(response); }) diff --git a/src/types/request/v5-asset.ts b/src/types/request/v5-asset.ts index 25fb92f..3de59cd 100644 --- a/src/types/request/v5-asset.ts +++ b/src/types/request/v5-asset.ts @@ -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 {