new RestClient([key][, secret][, livenet][, options])
key
{String} Bybit API Key
secret
{String} Bybit private key
livenet
{Boolean} If false (default), use testnet.
options
{Object} Optional settings for custom behaviour.
recv_window
{Number} Optional, default 5000. Increase if recv errors are seen.
sync_interval_ms
{Number} Optional, default 3600000. Interval at which syncTime is performed.
If you only use the public endpoints you can ommit key and secret.
async placeActiveOrder(params)
See bybit documentation
async getActiveOrder(params)
See bybit documentation
async cancelActiveOrder(params)
See bybit documentation
async cancelAllActiveOrders(params)
See bybit documentation
async replaceActiveOrder(params)
See bybit documentation
async queryActiveOrder(params)
See bybit documentation
async placeConditionalOrder(params)
See bybit documentation
async getConditioanlOrder(params)
See bybit documentation
async cancelConditionalOrder(params)
See bybit documentation
async cancelAllConditionalOrders(params)
See bybit documentation
async queryConditionalOrder(params)
See bybit documentation
See bybit documentation
async changeUserLeverage(params)
See bybit documentation
async getPosition(params)
See bybit documentation
Deprecated v1 method
See bybit documentation
async changePositionMargin(params)
See bybit documentation
async setTradingStop(params)
See bybit documentation
async getWalletFundRecords(params)
See bybit documentation
async getWithdrawRecords(params)
See bybit documentation
async getWalletBalance(params)
See bybit documentation
async setRiskLimit(params)
See bybit documentation
See bybit documentation
async getLastFundingRate(params)
See bybit documentation
async getMyLastFundingFee(params)
See bybit documentation
async getPredictedFunding(params)
See bybit documentation
async getTradeRecords(params)
See bybit documentation
async getOrderBook(params)
See bybit documentation
See bybit documentation
async getLatestInformation()
See bybit documentation
async getPublicTradingRecords(params)
See bybit documentation
See bybit documentation
async getApiAnnouncements()
See bybit documentation
Returns symbol information (such as tick size & min notional):
Meeting price restrictions
See bybit documentation
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.
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 ( err ) ;
} ) ;