Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Commit

Permalink
Merge branch 'develop' into origin/product_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cmroche committed Jan 21, 2018
2 parents e416035 + a26506e commit 0df9295
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 28 deletions.
4 changes: 4 additions & 0 deletions exchanges/binance.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ var Trader = function(config) {
recvWindow: 60000, // suggested by binance
disableBeautification: false
});

// Binance has tight timing requirements, this will ask their server for the time and store
// a drift value so we can calculate the most accurate timestamp possible form our system time
this.binance.startTimeSync();
};

var retryCritical = {
Expand Down
43 changes: 21 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@slack/client": "^3.10.0",
"async": "2.1.2",
"binance": "^1.1.0",
"binance": "^1.3.0",
"bitcoin-co-id": "0.0.1",
"bitexthai": "^0.1.0",
"bitfinex-api-node": "^1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion plugins/postgresql/handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ checkClient.connect(function(err){
if(err) {
util.die(err);
}
if(res.rowCount == 0){ //database does not exist
if(res.rows[0].count == 0){ //database does not exist
log.debug("Database "+dbName+" does not exist");
if(mode === 'realtime') { //create database if not found
log.debug("Creating database "+dbName);
Expand Down
4 changes: 2 additions & 2 deletions plugins/postgresql/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ module.exports = {
database: function () {
return useSingleDatabase() ?
config.postgresql.database :
config.watch.exchange.toLowerCase();
config.watch.exchange.toLowerCase().replace(/\-/g,'');
},

// returns table name which can be different if we use
// single or multiple db setup.
table: function (name) {
if (useSingleDatabase()) {
name = watch.exchange + '_' + name;
name = watch.exchange.replace(/\-/g,'') + '_' + name;
}
var fullName = [name, settings.pair.join('_')].join('_');
return useLowerCaseTableNames() ? fullName.toLowerCase() : fullName;
Expand Down
4 changes: 2 additions & 2 deletions plugins/postgresql/writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Store.prototype.writeCandles = function() {
var stmt = `
INSERT INTO ${postgresUtil.table('candles')}
(start, open, high,low, close, vwp, volume, trades)
select $1, $2, $3, $4, $5, $6, $7, $8
select $1, $2, $3, $4, $5, $6, $7, $8
WHERE NOT EXISTS (select id from ${postgresUtil.table('candles')} where start=$1);
`;

Expand All @@ -67,7 +67,7 @@ Store.prototype.writeCandles = function() {

var processCandle = function(candle, done) {
this.cache.push(candle);
if (this.cache.length > 100)
if (this.cache.length > 1)
this.writeCandles();

done();
Expand Down

0 comments on commit 0df9295

Please sign in to comment.