diff --git a/examples/apidoc/V5/Account/README.md b/examples/apidoc/V5/Account/README.md new file mode 100644 index 0000000..eafb9d9 --- /dev/null +++ b/examples/apidoc/V5/Account/README.md @@ -0,0 +1,3 @@ +# V5 - REST - Account + +https://bybit-exchange.github.io/docs/v5/account/wallet-balance diff --git a/examples/apidoc/V5/Account/get-account-info.js b/examples/apidoc/V5/Account/get-account-info.js new file mode 100644 index 0000000..c527d2d --- /dev/null +++ b/examples/apidoc/V5/Account/get-account-info.js @@ -0,0 +1,16 @@ +const { RestClientV5 } = require('bybit-api'); + +const client = new RestClientV5({ + testnet: true, + key: 'apikey', + secret: 'apisecret', +}); + +client + .getAccountInfo() + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/V5/Account/get-coin-greeks.js b/examples/apidoc/V5/Account/get-coin-greeks.js new file mode 100644 index 0000000..65a54b8 --- /dev/null +++ b/examples/apidoc/V5/Account/get-coin-greeks.js @@ -0,0 +1,16 @@ +const { RestClientV5 } = require('bybit-api'); + +const client = new RestClientV5({ + testnet: true, + key: 'apikey', + secret: 'apisecret', +}); + +client + .getCoinGreeks('BTC') + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/V5/Account/get-collateral-info.js b/examples/apidoc/V5/Account/get-collateral-info.js new file mode 100644 index 0000000..f33f91b --- /dev/null +++ b/examples/apidoc/V5/Account/get-collateral-info.js @@ -0,0 +1,16 @@ +const { RestClientV5 } = require('bybit-api'); + +const client = new RestClientV5({ + testnet: true, + key: 'apikey', + secret: 'apisecret', +}); + +client + .getCollateralInfo('BTC') + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/V5/Account/get-fee-rate.js b/examples/apidoc/V5/Account/get-fee-rate.js new file mode 100644 index 0000000..bb7da83 --- /dev/null +++ b/examples/apidoc/V5/Account/get-fee-rate.js @@ -0,0 +1,19 @@ +const { RestClientV5 } = require('bybit-api'); + +const client = new RestClientV5({ + testnet: true, + key: 'apikey', + secret: 'apisecret', +}); + +client + .getFeeRate({ + category: 'linear', + symbol: 'ETHUSDT', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/V5/Account/get-mmp-state.js b/examples/apidoc/V5/Account/get-mmp-state.js new file mode 100644 index 0000000..bda73c2 --- /dev/null +++ b/examples/apidoc/V5/Account/get-mmp-state.js @@ -0,0 +1,16 @@ +const { RestClientV5 } = require('bybit-api'); + +const client = new RestClientV5({ + testnet: true, + key: 'apikey', + secret: 'apisecret', +}); + +client + .getMMPState('ETH') + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/V5/Account/get-transaction-log.js b/examples/apidoc/V5/Account/get-transaction-log.js new file mode 100644 index 0000000..cbb573c --- /dev/null +++ b/examples/apidoc/V5/Account/get-transaction-log.js @@ -0,0 +1,20 @@ +const { RestClientV5 } = require('bybit-api'); + +const client = new RestClientV5({ + testnet: true, + key: 'apikey', + secret: 'apisecret', +}); + +client + .getTransactionLog({ + accountType: 'UNIFIED', + category: 'linear', + currency: 'USDT', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/V5/Account/get-wallet-balance.js b/examples/apidoc/V5/Account/get-wallet-balance.js new file mode 100644 index 0000000..1fdff0f --- /dev/null +++ b/examples/apidoc/V5/Account/get-wallet-balance.js @@ -0,0 +1,19 @@ +const { RestClientV5 } = require('bybit-api'); + +const client = new RestClientV5({ + testnet: true, + key: 'apikey', + secret: 'apisecret', +}); + +client + .getWalletBalance({ + accountType: 'UNIFIED', + coin: 'BTC', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/V5/Account/reset-mmp.js b/examples/apidoc/V5/Account/reset-mmp.js new file mode 100644 index 0000000..ea39472 --- /dev/null +++ b/examples/apidoc/V5/Account/reset-mmp.js @@ -0,0 +1,16 @@ +const { RestClientV5 } = require('bybit-api'); + +const client = new RestClientV5({ + testnet: true, + key: 'apikey', + secret: 'apisecret', +}); + +client + .resetMMP('ETH') + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/V5/Account/set-margin-mode.js b/examples/apidoc/V5/Account/set-margin-mode.js new file mode 100644 index 0000000..02f4f60 --- /dev/null +++ b/examples/apidoc/V5/Account/set-margin-mode.js @@ -0,0 +1,16 @@ +const { RestClientV5 } = require('bybit-api'); + +const client = new RestClientV5({ + testnet: true, + key: 'apikey', + secret: 'apisecret', +}); + +client + .setMarginMode('PORTFOLIO_MARGIN') + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/V5/Account/set-mmp.js b/examples/apidoc/V5/Account/set-mmp.js new file mode 100644 index 0000000..0bc26d2 --- /dev/null +++ b/examples/apidoc/V5/Account/set-mmp.js @@ -0,0 +1,22 @@ +const { RestClientV5 } = require('bybit-api'); + +const client = new RestClientV5({ + testnet: true, + key: 'apikey', + secret: 'apisecret', +}); + +client + .setMMP({ + baseCoin: 'ETH', + window: '5000', + frozenPeriod: '100000', + qtyLimit: '50', + deltaLimit: '20', + }) + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/examples/apidoc/V5/Account/upgrade-to-unified-account.js b/examples/apidoc/V5/Account/upgrade-to-unified-account.js new file mode 100644 index 0000000..8c0f780 --- /dev/null +++ b/examples/apidoc/V5/Account/upgrade-to-unified-account.js @@ -0,0 +1,16 @@ +const { RestClientV5 } = require('bybit-api'); + +const client = new RestClientV5({ + testnet: true, + key: 'apikey', + secret: 'apisecret', +}); + +client + .upgradeToUnifiedAccount() + .then((response) => { + console.log(response); + }) + .catch((error) => { + console.error(error); + }); diff --git a/src/rest-client-v5.ts b/src/rest-client-v5.ts index 1080c60..5a87e2a 100644 --- a/src/rest-client-v5.ts +++ b/src/rest-client-v5.ts @@ -57,6 +57,7 @@ import { GetDeliveryRecordParamsV5, GetDepositRecordParamsV5, GetExecutionListParamsV5, + GetFeeRateParamsV5, GetFundingRateHistoryParamsV5, GetHistoricalVolatilityParamsV5, GetIndexPriceKlineParamsV5, @@ -767,16 +768,13 @@ export class RestClientV5 extends BaseRestClient { } /** - * Get the trading fee rate of derivatives. - * Covers: USDT perpetual / Inverse perpetual / Inverse futures + * Get the trading fee rate. + * Covers: Spot / USDT perpetual / Inverse perpetual / Inverse futures / Options */ getFeeRate( - symbol?: string, - ): Promise> { - return this.getPrivate( - '/v5/account/fee-rate', - symbol ? { symbol } : undefined, - ); + params: GetFeeRateParamsV5, + ): Promise>> { + return this.getPrivate('/v5/account/fee-rate', params); } /** diff --git a/src/types/request/v5-account.ts b/src/types/request/v5-account.ts index 5213ce4..50b53ae 100644 --- a/src/types/request/v5-account.ts +++ b/src/types/request/v5-account.ts @@ -13,6 +13,12 @@ export interface GetBorrowHistoryParamsV5 { cursor?: string; } +export interface GetFeeRateParamsV5 { + category: CategoryV5; + symbol?: string; + baseCoin?: string; +} + export interface GetTransactionLogParamsV5 { accountType?: AccountTypeV5; category?: CategoryV5; diff --git a/src/types/response/v5-account.ts b/src/types/response/v5-account.ts index 1b11132..7fd3232 100644 --- a/src/types/response/v5-account.ts +++ b/src/types/response/v5-account.ts @@ -78,6 +78,7 @@ export interface CoinGreeksV5 { export interface FeeRateV5 { symbol: string; + baseCoin: string; takerFeeRate: string; makerFeeRate: string; }