How to use the binance.BinanceWS function in binance

To help you get started, we’ve selected a few binance examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tiagosiebler / TriangularArbitrage / index.js View on Github external
logger.info('--- Loading Exchange API');

// make exchange module dynamic later
if (process.env.activeExchange == 'binance'){
  logger.info('--- \tActive Exchange:' + process.env.activeExchange);
  // activePairs = process.env.binancePairs;
  
  const api = require('binance');
  exchangeAPI = new api.BinanceRest({
    key: process.env.binance_key,
    secret: process.env.binance_secret,
    timeout: parseInt(process.env.restTimeout), // Optional, defaults to 15000, is the request time out in milliseconds
    recvWindow: parseInt(process.env.restRecvWindow), // Optional, defaults to 5000, increase if you're getting timestamp errors
    disableBeautification: process.env.restBeautify != 'true'
  });
  exchangeAPI.WS = new api.BinanceWS();
}

var botOptions = {
    UI: {
      title: 'Top Potential Arbitrage Triplets, via: ' + process.env.binanceColumns
    },
    arbitrage: {
      paths: process.env.binanceColumns.split(','),
      start: process.env.binanceStartingPoint
    },
    storage: {
      logHistory: false
    },
    trading: {
      paperOnly: true,
      // only candidates with over x% gain potential are queued for trading
github victorbutler / binance-profit-calculator / lib / api / binance.js View on Github external
constructor (config) {
    super()
    if (!config.publicKey || !config.secretKey) {
      this.emit('error', new BinanceError(BinanceError.KeysNotPresent, 'Public or secret key not supplied to the Binance module'))
    }
    this.publicKey = config.publicKey
    this.secretKey = config.secretKey
    this.reconnectOnDisconnected = config.reconnectOnDisconnected || false
    this.retriesMax = config.retriesMax || 5
    this.retryAttempts = 0

    this.udWebSocket = null
    this.retriesInterval = null
    this.setupRest()
    this.binanceWS = new binanceAPI.BinanceWS(true)
  }
  setupRest () {

binance

Node.js & JavaScript SDK for Binance REST APIs & WebSockets, with TypeScript & end-to-end tests.

MIT
Latest version published 1 month ago

Package Health Score

81 / 100
Full package analysis

Popular binance functions