Files
bybit-api/doc/rest-client.md
Stefan Aebischer ed28d14171 Initial commit
2019-09-14 16:02:11 +02:00

3.3 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 placeConditionalOrder(params)

See bybit documentation

async getConditioanlOrder(params)

See bybit documentation

async cancelConditionalOrder(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 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

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