refactor: add trade id to trade entry object
This commit is contained in:
parent
700244e45b
commit
9b4bae4097
3 changed files with 10 additions and 8 deletions
|
|
@ -517,8 +517,9 @@ function plugins (settings, deviceId) {
|
|||
const execute = tradeEntry.type === 'buy' ? exchange.buy : exchange.sell
|
||||
|
||||
return recordTrade(tradeEntry)
|
||||
.then(newEntry =>
|
||||
execute(settings, tradeEntry, newEntry.id)
|
||||
.then(newEntry => {
|
||||
tradeEntry.tradeId = newEntry.id
|
||||
return execute(settings, tradeEntry)
|
||||
.catch(err => {
|
||||
updateTradeEntry(tradeEntry, newEntry, err)
|
||||
.then(() => {
|
||||
|
|
@ -526,7 +527,7 @@ function plugins (settings, deviceId) {
|
|||
throw err
|
||||
})
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
function updateTradeEntry (tradeEntry, newEntry, err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue