feat(): add samples for account endpoints. Breaking change: getFeeRate takes an object
This commit is contained in:
3
examples/apidoc/V5/Account/README.md
Normal file
3
examples/apidoc/V5/Account/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# V5 - REST - Account
|
||||
|
||||
https://bybit-exchange.github.io/docs/v5/account/wallet-balance
|
||||
16
examples/apidoc/V5/Account/get-account-info.js
Normal file
16
examples/apidoc/V5/Account/get-account-info.js
Normal file
@@ -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);
|
||||
});
|
||||
16
examples/apidoc/V5/Account/get-coin-greeks.js
Normal file
16
examples/apidoc/V5/Account/get-coin-greeks.js
Normal file
@@ -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);
|
||||
});
|
||||
16
examples/apidoc/V5/Account/get-collateral-info.js
Normal file
16
examples/apidoc/V5/Account/get-collateral-info.js
Normal file
@@ -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);
|
||||
});
|
||||
19
examples/apidoc/V5/Account/get-fee-rate.js
Normal file
19
examples/apidoc/V5/Account/get-fee-rate.js
Normal file
@@ -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);
|
||||
});
|
||||
16
examples/apidoc/V5/Account/get-mmp-state.js
Normal file
16
examples/apidoc/V5/Account/get-mmp-state.js
Normal file
@@ -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);
|
||||
});
|
||||
20
examples/apidoc/V5/Account/get-transaction-log.js
Normal file
20
examples/apidoc/V5/Account/get-transaction-log.js
Normal file
@@ -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);
|
||||
});
|
||||
19
examples/apidoc/V5/Account/get-wallet-balance.js
Normal file
19
examples/apidoc/V5/Account/get-wallet-balance.js
Normal file
@@ -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);
|
||||
});
|
||||
16
examples/apidoc/V5/Account/reset-mmp.js
Normal file
16
examples/apidoc/V5/Account/reset-mmp.js
Normal file
@@ -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);
|
||||
});
|
||||
16
examples/apidoc/V5/Account/set-margin-mode.js
Normal file
16
examples/apidoc/V5/Account/set-margin-mode.js
Normal file
@@ -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);
|
||||
});
|
||||
22
examples/apidoc/V5/Account/set-mmp.js
Normal file
22
examples/apidoc/V5/Account/set-mmp.js
Normal file
@@ -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);
|
||||
});
|
||||
16
examples/apidoc/V5/Account/upgrade-to-unified-account.js
Normal file
16
examples/apidoc/V5/Account/upgrade-to-unified-account.js
Normal file
@@ -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);
|
||||
});
|
||||
Reference in New Issue
Block a user