n0mad01 / node.bittrex.api

No longer maintained
MIT License
183 stars 187 forks source link

getcandles function ignores start timestamp parameter #53

Closed ghost closed 7 years ago

ghost commented 7 years ago

Whenever I try to call getcandles function and pass yesterday's date as a start timestamp parameter I get candle data from the past ~20 days. Currently, I'm testing this with the example provided in the README file:

bittrex.getcandles({
  marketName: USDT-BTC',
  tickInterval: 'fiveMin', // intervals are keywords
  _: ((new Date()).getTime()/1000)-(300*5) // start timestamp
}, function( data, err ) {
  console.log(err)
  console.log( data.result[0] );
  console.log( data.result[data.result.length-1] );
});

I'm printing out the first and the last elements of candle data array and this is what I get: First:

{ O: 0.08127543,
  H: 0.08139787,
  L: 0.08127543,
  C: 0.08127543,
  V: 282.73389107,
  T: '2017-08-02T15:40:00', <<
  BV: 22.99200037 }

Last:

{ O: 0.07864,
  H: 0.079,
  L: 0.07852603,
  C: 0.0789999,
  V: 103.9385341,
  T: '2017-08-22T15:30:00', <<
  BV: 8.19657536 }
dparlevliet commented 7 years ago

You're right - I pulled the URL from the Bittrex website log and it appears that the _= is likely just there for cache busting rather than the start date like I assumed. I cannot find a way to select a date range.

ghost commented 7 years ago

I see. Where could I find a documentation for Bittrex api v2.0? It doesn't seem to be public or at least directly accessible

dparlevliet commented 7 years ago

There isn't any documentation yet, unfortunately

ghost commented 7 years ago

How many possible tickInterval values are there (or at least those that you tested)? I've tried 'oneMin', 'fiveMin' and 'thirtyMin', but when I try to use anything else, like 'fifteenMin' or 'oneHr' it doesn't seem to work.

dparlevliet commented 7 years ago

Yeah, Bittrex does client-side aggregation for fifteenMin so you need to use fiveMin then collate that down to fifteen minute intervals yourself. This is true also for 3D, 1W and 1M - these ones are aggregated using 1D data.

I just looked on the sites and the calls I found are:

ghost commented 7 years ago

Nice, thanks for the explanation!

flamz3d commented 7 years ago

is the 'T' parameter the start or end period for that candle?

dparlevliet commented 7 years ago

@flamz3d The start

TimLaMason commented 7 years ago

Don't know if this would help with what you are building, but there is a good node library called technicalindicators that has several types of candle sticks.

If you use it for chart building, you will need to have Cairo installed as well. Here is the link: https://www.npmjs.com/package/technicalindicators

On Aug 26, 2017 1:49 AM, "David Parlevliet" notifications@github.com wrote:

The start

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/n0mad01/node.bittrex.api/issues/53#issuecomment-325090528, or mute the thread https://github.com/notifications/unsubscribe-auth/AGJjzGRBUyyqRo9ejUYhyJvt7lSp_yPGks5sb7IGgaJpZM4O-1vz .