lib/poloniex.js
function (options, callback) {
      if (!('headers' in options)) {
        options.headers = {};
      }

      options.json = true;
      options.headers['User-Agent'] = Poloniex.USER_AGENT;
      options.strictSSL = Poloniex.STRICT_SSL;
      options.timeout = Poloniex.TIMEOUT;

      return new Promise(function (resolve, reject) {
        request(options, function (err, response, body) {
          // Empty response
          if (!err && (typeof body === 'undefined' || body === null)) {
            err = new Error('Empty response from remote server');
          }

          if (err) {
            reject(err);
          }

          else {
            resolve(body);
          }

          if (typeof callback === 'function') {
            callback(err, body);
          }
        });
      });
    }
function (options, callback) {
      if (!('headers' in options)) {
        options.headers = {};
      }

      options.json = true;
      options.headers['User-Agent'] = Poloniex.USER_AGENT;
      options.strictSSL = Poloniex.STRICT_SSL;
      options.timeout = Poloniex.TIMEOUT;

      return new Promise(function (resolve, reject) {
        request(options, function (err, response, body) {
          // Empty response
          if (!err && (typeof body === 'undefined' || body === null)) {
            err = new Error('Empty response from remote server');
          }

          if (err) {
            reject(err);
          }

          else {
            resolve(body);
          }

          if (typeof callback === 'function') {
            callback(err, body);
          }
        });
      });
    }
Make an API request