feat(): added missing API examples

This commit is contained in:
Jerko J
2024-09-06 10:14:02 +02:00
parent 027057105c
commit bc318f0823
7 changed files with 85 additions and 3 deletions

View File

@@ -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);
});

View File

@@ -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);
})

View File

@@ -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);
});

View File

@@ -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);
});

View File

@@ -7,7 +7,7 @@ const client = new RestClientV5({
});
client
.deleteSubApiKey()
.getAffiliateUserInfo({ uid: '1513500' })
.then((response) => {
console.log(response);
})

View File

@@ -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 {