Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #48 from jaggedsoft/master
Browse files Browse the repository at this point in the history
Merge from development
  • Loading branch information
Jon Eyrick authored Jan 15, 2018
2 parents a16e4cd + 2433bdd commit 3a0c754
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1220,14 +1220,17 @@ binance.prevDay("BNBBTC", function(prevDay, symbol) {
```

#### Get Kline/candlestick data for a symbol
You can use the optional API parameters for getting historical candlesticks, these are useful if you want to import data from earlier back in time.
Optional parameters: limit (max/default 500), startTime, endTime.

```javascript
// Periods: 1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M
// Intervals: 1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M
binance.candlesticks("BNBBTC", "5m", function(ticks, symbol) {
console.log("candlesticks()", ticks);
let last_tick = ticks[ticks.length - 1];
let [time, open, high, low, close, volume, closeTime, assetVolume, trades, buyBaseVolume, buyAssetVolume, ignored] = last_tick;
console.log(symbol+" last close: "+close);
});
}, {limit: 500, endTime: 1514764800000});
```

# WebSockets Implementation
Expand Down
5 changes: 3 additions & 2 deletions node-binance-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,9 @@ Move this to a future release v0.4.0
}
return {open:open, high:high, low:low, close:close, volume:volume};
},
candlesticks: function(symbol, interval = '5m', callback) { //1m,3m,5m,15m,30m,1h,2h,4h,6h,8h,12h,1d,3d,1w,1M
publicRequest(base+'v1/klines', {symbol:symbol, interval:interval}, function(data) {
candlesticks: function(symbol, interval, callback, options = {limit:500}) { // additional options: startTime, endTime
let params = Object.assign({symbol:symbol, interval:interval}, options);
publicRequest(base+'v1/klines', params, function(data) {
return callback.call(this, data, symbol);
});
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-binance-api",
"version": "0.3.8",
"version": "0.3.9",
"description": "Binance API for node https://github.com/jaggedsoft/node-binance-api",
"main": "node-binance-api.js",
"dependencies": {
Expand Down

0 comments on commit 3a0c754

Please sign in to comment.