How to use the node-binance-api.options function in node-binance-api

To help you get started, we’ve selected a few node-binance-api 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 dalinhuang99 / betify / app.js View on Github external
// The connection was closed
    stream.on('close', function() {
      clients.splice(clients.indexOf(stream), 1);
      console.log('Closed connection ');
    });
  });

});



// ===============================================================================
// Binance API / webSocket

const binance = require('node-binance-api');
binance.options({
  APIKEY: '',
  APISECRET: '',
  useServerTime: true, // If you get timestamp errors, synchronize to server time at startup
  test: false // If you want to use sandbox mode where orders are simulated
});


// --------- BTCUSDT ---------
var gameTimeCounter = 0;
var startBtcPrice = 0;
var endBtcPrice = 0;
// For a specific symbol:
binance.websockets.prevDay('BTCUSDT', (error, response) => {
  // var t = new Date( response.eventTime );
  // var formatted = t.format("dd.mm.yyyy hh:MM:ss");
github dalinhuang99 / betify / app / controllers / binanceapicontroller.js View on Github external
module.exports = function(models,clients){

  const binance = require('node-binance-api')().options({
    APIKEY: '',
    APISECRET: '',
    useServerTime: true, // If you get timestamp errors, synchronize to server time at startup
    test: false // If you want to use sandbox mode where orders are simulated
  })

  // --------- BTCUSDT ---------
  const BTCUSDT_20 = 10;

  var Btcusdt = models.btcusdt_table;

  var initTimer = new Date().getTime() + BTCUSDT_20*1000;
  var thisGameId = Math.round(initTimer/1000);
  var nextGameId = thisGameId+BTCUSDT_20;
  var gameStartBtcPrice = 0;
  var gameEndBtcPrice = 0;
github andresilvasantos / bitprophet / bitprophet.js View on Github external
start: function(next) {
			binance.options({
				"APIKEY": vars.options.binance.key,
				"APISECRET": vars.options.binance.secret,
				useServerTime: true,
				reconnect: false
			})

			var oldLog = console.log
			console.log = function() {
				if(vars.options.verbose) oldLog.apply(console, arguments)
			}

			exchUtils.initExchangeInfo(function(error) {
				if(error) {
					console.log("Error initializing exchange info.", error)
					if(next) next("Error initializing exchange info.")
					return
github gmverdon / TradingBot / src / scenes / Home / index.js View on Github external
constructor(props) {
    super(props);

    this.state = {
      currentPrice: 15290,
      boughtPrice: 15290,
      diffPercentage : 0.01,
      messages: []
    }

    binance.options({
      APIKEY:      props.opts.binance.key,
      APISECRET:   props.opts.binance.secret,
      recvWindow:  60000
    })
  }
github gmverdon / TradingBot / src / scenes / TradeHub / index.js View on Github external
componentDidMount = () => {
    binance.options({
      APIKEY: this.props.opts.binance.key,
      APISECRET: this.props.opts.binance.secret,
      reconnect: false,
      test: true,
    });

    this.getCryptoList();
    this.bindSocket(this.state.selectedCrypto.symbol);
  };