User
Documentation on interacting with ByBit's User API functions through the PENDAX Javascript SDK.
All parameters of type INTEGER listed in the Bybit API docs need to be passed in as a string.
Create Sub UID
Function name:
createSubUid(options)
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
});
async function createSubUid(exchange, options) {
try {
let result = await exchange.createSubUid(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await createSubUid(myByBitAccount,
{
username: "bill",
memberType: "1"
});
Create Sub UID API Key
Function name:
createSubUidApiKey(options)
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
});
async function createSubUidApiKey(exchange, options) {
try {
let result = await exchange.createSubUidApiKey(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await createSubUidApiKey(myByBitAccount,
{
subuid: "62874117",
readOnly: "0",
permissions: {
Spot: ["SpotTrade"]
}
});
Get Sub UID List
Function name:
getSubUidList(options)
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
});
async function getSubUidList(exchange, options) {
try {
let result = await exchange.getSubUidList(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getSubUidList(myByBitAccount);
Freeze Sub UID
Function name:
freezeSubUid(options)
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
});
async function freezeSubUid(exchange, options) {
try {
let result = await exchange.freezeSubUid(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await freezeSubUid(myByBitAccount,
{
subuid: "62874117",
frozen: "1"
});
Get API Key Information
Function name:
getApiKeyInfo(options)
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
});
async function getApiKeyInfo(exchange, options) {
try {
let result = await exchange.getApiKeyInfo(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await getApiKeyInfo(myByBitAccount);
Modify Master API Key
Function name:
modifyMasterApiKey(options)
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
});
async function modifyMasterApiKey(exchange, options) {
try {
let result = await exchange.modifyMasterApiKey(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await modifyMasterApiKey(myByBitAccount,
{
permissions:{
NFT:[
"NFTQueryProductList"
]
}
});
Modify Sub API Key
This function is under construction and may not behave as expected
Function name:
modifySubApiKey(options)
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitSubAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
});
async function modifySubApiKey(exchange, options) {
try {
let result = await exchange.modifySubApiKey(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await modifySubApiKey(myByBitSubAccount ,
{
permissions:{
NFT:[
"NFTQueryProductList"
]
}
});
Delete Master API Key
Function name:
deleteMasterApiKey(options)
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
});
async function deleteMasterApiKey(exchange, options) {
try {
let result = await exchange.deleteMasterApiKey(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await deleteMasterApiKey(myByBitAccount);
Delete Sub API Key
Function name:
deleteSubApiKey(options)
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myByBitAccount = createExchange({
exchange: "bybit",
authenticate: "true",
key: "myKeys",
secret: "mySecret",
label: "bybit",
testnet: "false"
});
async function deleteSubApiKey(exchange, options) {
try {
let result = await exchange.deleteSubApiKey(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
const result = await deleteSubApiKey(myByBitAccount);