fix exchanges, kraken

This commit is contained in:
Josh Harvey 2017-06-25 19:46:16 +03:00
parent 35fb620b38
commit f70211d774
5 changed files with 72 additions and 54 deletions

View file

@ -31,7 +31,7 @@ function atomic (machineTx, pi) {
.then(r => {
pp('DEBUG701.5')(r)
return insertNewBills(billRows, machineTx)
.then(_.constant(_.set('bills', machineTx.bills, r)))
.then(newBills => _.set('newBills', newBills, r))
.then(pp('DEBUG702'))
})
})
@ -167,6 +167,7 @@ function insertNewBills (billRows, machineTx) {
const sql = pgp.helpers.insert(dbBills, columns, 'bills')
return db.none(sql)
.then(() => bills)
}
function upsert (dbTx, preProcessedTx) {
@ -225,7 +226,7 @@ function isClearToSend (oldTx, newTx) {
function postProcess (r, pi) {
console.log('DEBUG701: %j', r)
registerTrades(pi, r.bills)
registerTrades(pi, r.newBills)
if (isClearToSend(r.dbTx, r.tx)) {
return pi.sendCoins(r.tx)