This commit is contained in:
Josh Harvey 2016-11-27 03:18:06 +02:00
parent b16d11045c
commit 966440e074
3 changed files with 13 additions and 9 deletions

View file

@ -106,16 +106,20 @@ exports.trade = function trade (deviceId, rawTrade) {
// TODO: move this to DB, too
// add bill to trader queue (if trader is enabled)
const cryptoCode = rawTrade.cryptoCode
const fiatCode = rawTrade.fiatCode
const cryptoAtoms = rawTrade.cryptoAtoms
return db.recordBill(deviceId, rawTrade)
.then(() => exchange.active(cryptoCode))
.then(active => {
if (!active) return
logger.debug('[%s] Pushing trade: %d', cryptoCode, rawTrade.cryptoAtoms)
tradesQueues[cryptoCode].push({
currency: rawTrade.currency,
cryptoAtoms: rawTrade.cryptoAtoms,
const market = [fiatCode, cryptoCode].join('')
logger.debug('[%s] Pushing trade: %d', market, cryptoAtoms)
tradesQueues[market].push({
fiatCode,
cryptoAtoms,
cryptoCode,
timestamp: Date.now()
})