JSHint trader
This commit is contained in:
parent
971f3f2f54
commit
8cb9783bde
1 changed files with 12 additions and 5 deletions
|
|
@ -24,7 +24,10 @@ Trader.prototype._findExchange = function (name) {
|
|||
try {
|
||||
exchange = require('lamassu-' + name);
|
||||
} catch (err) {
|
||||
if (!err.message.match(/Cannot find module/)) throw err;
|
||||
if (!err.message.match(/Cannot find module/)) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
exchange = require(path.join(path.dirname(__dirname), 'exchanges', name));
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +88,9 @@ Trader.prototype.fiatBalance = function (transferSatoshis, tradeFiat) {
|
|||
var balance = this.balance;
|
||||
var commission = this.config.exchanges.settings.commission;
|
||||
|
||||
if (!rate || !balance) return 0;
|
||||
if (!rate || !balance) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// The rate is actually our commission times real rate.
|
||||
rate = commission * rate;
|
||||
|
|
@ -116,7 +121,9 @@ Trader.prototype.sendBitcoins = function (deviceFingerprint, tx, cb) {
|
|||
var self = this;
|
||||
|
||||
self.db.summonTransaction(deviceFingerprint, tx, function (err, isNew, txHash) {
|
||||
if (err) return cb(err);
|
||||
if (err) {
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
if (isNew) {
|
||||
return self.transferExchange.sendBitcoins(
|
||||
|
|
@ -178,7 +185,7 @@ Trader.prototype.pollBalance = function (callback) {
|
|||
self.logger.info('Balance update:', balance);
|
||||
self.balance = balance;
|
||||
|
||||
callback && callback(null, balance);
|
||||
return callback && callback(null, balance);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -194,7 +201,7 @@ Trader.prototype.pollRate = function (callback) {
|
|||
|
||||
self.logger.info('Rate update:', rate);
|
||||
self.rates[currency] = {rate: rate, timestamp: new Date()};
|
||||
callback && callback(null, self.rates[currency]);
|
||||
return callback && callback(null, self.rates[currency]);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue