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

View file

@ -44,7 +44,7 @@ exports.recordBill = function recordBill (deviceId, rec) {
const values = [ const values = [
rec.uuid, rec.uuid,
deviceId, deviceId,
rec.currency, rec.fiatCode,
rec.cryptoCode, rec.cryptoCode,
rec.toAddress, rec.toAddress,
rec.txId, rec.txId,
@ -83,7 +83,7 @@ exports.addOutgoingTx = function addOutgoingTx (deviceId, tx) {
tx.toAddress, tx.toAddress,
tx.cryptoAtoms.toString(), tx.cryptoAtoms.toString(),
tx.cryptoCode, tx.cryptoCode,
tx.currencyCode, tx.fiatCode,
tx.fiat, tx.fiat,
tx.txHash, tx.txHash,
null, null,
@ -111,7 +111,7 @@ exports.addInitialIncoming = function addInitialIncoming (deviceId, tx) {
tx.toAddress, tx.toAddress,
tx.cryptoAtoms.toString(), tx.cryptoAtoms.toString(),
tx.cryptoCode, tx.cryptoCode,
tx.currencyCode, tx.fiatCode,
tx.fiat, tx.fiat,
tx.txHash, tx.txHash,
tx.phone, tx.phone,
@ -170,7 +170,7 @@ exports.addIncomingPhone = function addIncomingPhone (tx, notified) {
function normalizeTx (tx) { function normalizeTx (tx) {
tx.toAddress = tx.to_address tx.toAddress = tx.to_address
tx.currencyCode = tx.currency_code tx.fiatCode = tx.currency_code
tx.txHash = tx.tx_hash tx.txHash = tx.tx_hash
tx.cryptoCode = tx.crypto_code tx.cryptoCode = tx.crypto_code
tx.cryptoAtoms = new BigNumber(tx.crypto_atoms) tx.cryptoAtoms = new BigNumber(tx.crypto_atoms)

View file

@ -84,7 +84,7 @@ function poll (req, res) {
const langs = config.languages.machineLanguages const langs = config.languages.machineLanguages
const locale = { const locale = {
currency: config.currencies.fiatCurrency, fiatCode: config.currencies.fiatCode,
localeInfo: { localeInfo: {
primaryLocale: langs[0], primaryLocale: langs[0],
primaryLocales: langs primaryLocales: langs