code: function sendQuery(api, command, params) {
      // Create query with given parameters, if applicable
      let query = params || {};
  
      // Add command to query
      if (!query.command) {
          query["command"] = command;
      }
  
      // Parse public API URL
      let queryUrl = url.parse(POLONIEX_PUBLIC_URL);
  
      // Add query to URL
      queryUrl.query = query;
  
      // Build options for request
      let opts = {
          "url": url.format(queryUrl),
          "method": "GET",
          "headers": {
              "User-Agent": REQUEST_USER_AGENT
          }
      };
  
      // Return a promise for the response data
      return new Promise((resolve, reject) => {
          // Send request to Poloniex
          request(opts, (error, response, body) => {
              // If request was successful
              if (!error && response && response.statusCode == 200) {
                  // Parsed response body
                  let bodyParsed;
  
                  // Try to parse response body as JSON
                  try {
                      bodyParsed = JSON.parse(body);
                  } catch (e) {
                      reject({msg: "Unable to parse response body: " + e, _body: body});
                      return;
                  }
  
                  // Enforce type of returned data (see issue #16)
                  if (bodyParsed === null || typeof bodyParsed !== "object") {
                      reject({msg: "Response body parsed, but to null or wrong type", _bodyParsed: bodyParsed});
                      return;
                  }
  
                  // Check if Poloniex returned an error
                  if (typeof bodyParsed.error !== "undefined") {
                      // Reject promise with Poloniex's error message
                      reject({msg: "Poloniex: " + bodyParsed.error});
                  } else {
                      // Resolve with parsed response data
                      resolve(bodyParsed);
                  }
              } else {
                  // Reject promise with error info
                  reject({msg: "API request failed", _requestError: error, _requestResponse: response});
              }
          });
      });
  }
docs: /*
  
  function sendQuery(api, command, params)