feat: relay trade uuid to krakens api

This commit is contained in:
José Oliveira 2021-04-19 21:00:56 +01:00 committed by Josh Harvey
parent bec80ec498
commit 8606d0cc94
6 changed files with 25 additions and 17 deletions

View file

@ -19,23 +19,23 @@ function fetchExchange (settings, cryptoCode) {
})
}
function buy (settings, cryptoAtoms, fiatCode, cryptoCode) {
function buy (settings, cryptoAtoms, fiatCode, cryptoCode, tradeId) {
return fetchExchange(settings, cryptoCode)
.then(r => {
if (r.exchangeName === 'mock-exchange') {
return mockExchange.buy(cryptoAtoms, fiatCode, cryptoCode)
}
return ccxt.trade('buy', r.account, cryptoAtoms, fiatCode, cryptoCode, r.exchangeName)
return ccxt.trade('buy', r.account, cryptoAtoms, fiatCode, cryptoCode, r.exchangeName, tradeId)
})
}
function sell (settings, cryptoAtoms, fiatCode, cryptoCode) {
function sell (settings, cryptoAtoms, fiatCode, cryptoCode, tradeId) {
return fetchExchange(settings, cryptoCode)
.then(r => {
if (r.exchangeName === 'mock-exchange') {
return mockExchange.sell(cryptoAtoms, fiatCode, cryptoCode)
}
return ccxt.trade('sell', r.account, cryptoAtoms, fiatCode, cryptoCode, r.exchangeName)
return ccxt.trade('sell', r.account, cryptoAtoms, fiatCode, cryptoCode, r.exchangeName, tradeId)
})
}