Files
bybit-api/doc/rest-client.md
Stefan Aebischer d8c7a551a4 Add missing endpoints, switch to v2
Adds missing endpoints:

* queryActiveOrder
* cancelAllConditionalOrders
* queryConditionalOrder
* setTradingStop
* getWalletFundRecords
* getWithdrawRecords
* setRiskLimit
* getRiskLimitList
* getPublicTradingRecords
* getApiAnnouncements

Switches Endpoints to v2:

* getPosition
2020-01-17 21:36:41 -05:00

6.1 KiB

Rest API

Class: RestClient

new RestClient([key][, secret])

  • key {String} Bybit API Key
  • secret {String} Bybit private key

If you only use the public endpoints you can ommit key and secret.

Private enpoints

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

async getUserLeverage()

See bybit documentation

async changeUserLeverage(params)

See bybit documentation

async getPosition()

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 setRiskLimit(params)

See bybit documentation

async getRiskLimitList()

See bybit documentation

async getLastFundingRate(params)

See bybit documentation

async getMyLastFundingFee(params)

See bybit documentation

async getPredictedFunding(params)

See bybit documentation

async getOrderTradeRecords(params)

See bybit documentation

Public enpoints

async getOrderBook(params)

See bybit documentation

async getLatestInformation()

See bybit documentation

async getPublicTradingRecords(params)

See bybit documentation

async getServerTime()

See bybit documentation

async getApiAnnouncements()

See bybit documentation

async getSymbols()

Returns symbol information (such as tick size & min notional): Meeting price restrictions

See bybit documentation

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