Skip to content

Commit

Permalink
[GB] set bfx interval to 4 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
askmike committed Sep 30, 2018
1 parent 8410a25 commit fb8a43a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 0 additions & 1 deletion exchange/orders/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class BaseOrder extends EventEmitter {
this.api = api;

this.checkInterval = api.interval || 1500;

this.status = states.INITIALIZING;

this.completed = false;
Expand Down
2 changes: 2 additions & 0 deletions exchange/wrappers/binance.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Trader.prototype.handleResponse = function(funcName, callback) {
}

if(funcName === 'cancelOrder' && error.message.includes('UNKNOWN_ORDER')) {
console.log(new Date, 'cancelOrder', 'UNKNOWN_ORDER');
// order got filled in full before it could be
// cancelled, meaning it was NOT cancelled.
return callback(false, {filled: true});
Expand All @@ -122,6 +123,7 @@ Trader.prototype.handleResponse = function(funcName, callback) {
}

if(funcName === 'addOrder' && error.message.includes('Account has insufficient balance')) {
console.log(new Date, 'insufficientFunds');
error.type = 'insufficientFunds';
}

Expand Down
7 changes: 6 additions & 1 deletion exchange/wrappers/bitfinex.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var Trader = function(config) {
this.pair = this.asset + this.currency;
this.bitfinex = new Bitfinex.RESTv1({apiKey: this.key, apiSecret: this.secret, transform: true});

this.interval = 2000;
this.interval = 4000;
}

const includes = (str, list) => {
Expand All @@ -49,13 +49,16 @@ const recoverableErrors = [

Trader.prototype.handleResponse = function(funcName, callback) {
return (error, data) => {

if(!error && _.isEmpty(data)) {
error = new Error('Empty response');
}

if(error) {
const message = error.message;

console.log('handleResponse', funcName, message);

// in case we just cancelled our balances might not have
// settled yet, retry.
if(
Expand Down Expand Up @@ -227,6 +230,8 @@ Trader.prototype.getOrder = function(order_id, callback) {
var amount = parseFloat(data.executed_amount);
var date = moment.unix(data.timestamp);

console.log('getOrder', data);

// TEMP: Thu May 31 14:49:34 CEST 2018
// the `past_trades` call is not returning
// any data.
Expand Down
3 changes: 2 additions & 1 deletion exchange/wrappers/poloniex.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const recoverableErrors = [
'Connection timed out. Please try again.',
// getaddrinfo EAI_AGAIN poloniex.com poloniex.com:443
'EAI_AGAIN',
'ENETUNREACH'
'ENETUNREACH',
'socket hang up'
];

// errors that might mean
Expand Down

0 comments on commit fb8a43a

Please sign in to comment.