feat: relay trade uuid to krakens api
This commit is contained in:
parent
bec80ec498
commit
8606d0cc94
6 changed files with 25 additions and 17 deletions
|
|
@ -516,12 +516,16 @@ function plugins (settings, deviceId) {
|
|||
const tradeEntry = expand(_tradeEntry)
|
||||
const execute = tradeEntry.type === 'buy' ? exchange.buy : exchange.sell
|
||||
|
||||
return execute(settings, tradeEntry.cryptoAtoms, tradeEntry.fiatCode, tradeEntry.cryptoCode)
|
||||
.then(() => recordTrade(tradeEntry))
|
||||
.catch(err => {
|
||||
return recordTrade(tradeEntry, err)
|
||||
.then(() => {
|
||||
throw err
|
||||
return recordTrade(tradeEntry)
|
||||
.then(newEntry => {
|
||||
return execute(settings, tradeEntry.cryptoAtoms, tradeEntry.fiatCode, tradeEntry.cryptoCode, newEntry.id)
|
||||
.catch(err => {
|
||||
const data = mergeTradeEntryAndError(tradeEntry, err)
|
||||
const sql = pgp.helpers.update(data, ['error'], 'trades') + ` WHERE id = ${newEntry.id}`
|
||||
return db.none(sql)
|
||||
.then(() => {
|
||||
throw err
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
@ -577,7 +581,6 @@ function plugins (settings, deviceId) {
|
|||
return t.oneOrNone(sql)
|
||||
.then(newTrade => recordTradeAndTx(newTrade.id, _tradeEntry, t))
|
||||
})
|
||||
}
|
||||
|
||||
function sendMessage (rec) {
|
||||
const notifications = configManager.getGlobalNotifications(settings.config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue