title: What I need for the callback parameter for returnCharData function?
body: <p>N need some help here using this API.</p>
  
  <p>I'm trying to get data from Poloniex API for NodeJS (npm Install)</p>
  
  <p>I'm confuse with which parameter i have to pass here in the callback parameter, I'm new in nodeJS, so maybe im getting wrong what i need as a callback.</p>
  
  <p>This method is used for the API to fetch data from the poloneix web, to calculate basic things, currently i need the information of the Pair BTC/USD, here is the property of the poloneix instance:</p>
  
  <p><strong><code>returnChartData(currencyA, currencyB, period, start, end, callback);</code></strong></p>
  
  <p>It is Declared as this in the <code>poloneix.js</code> file:</p>
  
  <pre><code>returnChartData: function(currencyA, currencyB, period, start, end, callback) {
              var parameters = {
                  currencyPair: joinCurrencies(currencyA, currencyB),
          period: period,
          start: start,
          end: end
              };
  </code></pre>
  
  <p>What do I need to use in as a callback parameter for this Function?</p>
  
  <pre><code>var response = poloniex.returnChartData('BTC','LTC',300,1510570525,1510638955,**(¿here?)**)
          fs.appendFile('BTC_pair.json', response, function(err) {
              if(err) {
                  console.log('there was an error: ', err);
              return;
          }
          console.log('BTC Pair Saved');
      });
  </code></pre>
  
  <p>I know it is Wrong, but i tried to use simple Fucntions, for example as a Timer to explore what i need to pass as a callback, and im getting this error while running executing my node file:</p>
  
  <pre><code>D:\Projects\NodeJS\ZenBot\ZenBot_v2\poloniex.js\lib\poloniex.js:79
                      callback(err, body);
                      ^
  
  TypeError: callback is not a function
      at Request._callback (D:\Projects\NodeJS\ZenBot\ZenBot_v2\poloniex.js\lib\poloniex.js:79:7)
      at Request.self.callback (D:\Projects\NodeJS\ZenBot\ZenBot_v2\poloniex.js\node_modules\request\request.js:122:22)
      at emitTwo (events.js:106:13)
      at Request.emit (events.js:194:7)
      at Request.&lt;anonymous&gt; (D:\Projects\NodeJS\ZenBot\ZenBot_v2\poloniex.js\node_modules\request\request.js:888:14)
      at emitOne (events.js:101:20)
      at Request.emit (events.js:191:7)
      at IncomingMessage.&lt;anonymous&gt; (D:\Projects\NodeJS\ZenBot\ZenBot_v2\poloniex.js\node_modules\request\request.js:839:
  12)
      at emitNone (events.js:91:20)
      at IncomingMessage.emit (events.js:188:7)
  </code></pre>
  
  <p>And in the <code>poloniex.js</code> File here in the constructor is where the error is comming:</p>
  
  <pre><code>_request: function(options, callback) {
              if (!('headers' in options)) {
                  options.headers = {};
              }
  
              options.json = true;
              options.headers['User-Agent'] = Poloniex.USER_AGENT;
              options.strictSSL = Poloniex.STRICT_SSL;
  
              request(options, function(err, response, body) {
              // Empty response
              if (!err &amp;&amp; (typeof body === 'undefined' || body === null)){
              err = 'Empty response';
              }
  
              callback(err, body);    &lt;----- THIS LINE
          });
  </code></pre>
  
  <p>Do I need to declare any function? or something? </p>