Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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 () {