3.3 KiB
3.3 KiB
Rest API
Class: RestClient
new RestClient([key][, secret])
key{String} Bybit API Keysecret{String} Bybit private key
If you only use the public endpoints you can ommit key and secret.
Private enpoints
async placeActiveOrder(params)
async getActiveOrder(params)
async cancelActiveOrder(params)
async placeConditionalOrder(params)
async getConditioanlOrder(params)
async cancelConditionalOrder(params)
async getUserLeverage()
async changeUserLeverage(params)
async getPosition()
async changePositionMargin(params)
async getLastFundingRate(params)
async getMyLastFundingFee(params)
async getPredictedFunding(params)
async getOrderTradeRecords(params)
Public enpoints
async getOrderBook(params)
async getLatestInformation()
Example
const {RestClient} = require('@pxtrn/bybit-api');
const API_KEY = 'xxx';
const PRIVATE_KEY = 'yyy';
const client = new RestClient(API_KEY, PRIVATE_KEY);
client.changeUserLeverage({leverage: 4, symbol: 'ETHUSD'})
.then(result => {
console.log(result);
})
.catch(err => {
console.error(error);
});