6.1 KiB
6.1 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 cancelAllActiveOrders(params)
async replaceActiveOrder(params)
async queryActiveOrder(params)
async placeConditionalOrder(params)
async getConditioanlOrder(params)
async cancelConditionalOrder(params)
async cancelAllConditionalOrders(params)
async queryConditionalOrder(params)
async getUserLeverage()
async changeUserLeverage(params)
async getPosition()
async changePositionMargin(params)
async setTradingStop(params)
async getWalletFundRecords(params)
async getWithdrawRecords(params)
async setRiskLimit(params)
async getRiskLimitList()
async getLastFundingRate(params)
async getMyLastFundingFee(params)
async getPredictedFunding(params)
async getTradeRecords(params)
Public enpoints
async getOrderBook(params)
async getLatestInformation()
async getPublicTradingRecords(params)
async getServerTime()
async getApiAnnouncements()
async getSymbols()
Returns symbol information (such as tick size & min notional): Meeting price restrictions
async getTimeOffset()
Returns the time offset in ms to the server time retrieved by async getServerTime.
If positive the time on the server is ahead of the clients time, if negative the time on the server is behind the clients time.
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);
});