🐛 Fix validate param and txid

This commit is contained in:
Dennis Reimann
2020-05-13 07:44:02 +02:00
parent 7fb83e187a
commit 0dc087dc2b

View File

@@ -37,12 +37,14 @@ const validate = process.argv[2] === '--validate'
// Place order // Place order
try { try {
const details = { pair, type: 'buy', ordertype: 'limit', price, volume, validate } const details = { pair, type: 'buy', ordertype: 'limit', price, volume }
const { result: { descr: { order } }, txid } = await kraken.api('AddOrder', details) if (validate) details.validate = true
const { result: { descr: { order }, txid } } = await kraken.api('AddOrder', details)
console.log('💸 Placed order:', order, '/ TXID:', txid, '\n') console.log('💸 Placed order:', order, '/ TXID:', txid, '\n')
} catch (err) { } catch (err) {
console.error(`🚨 Failure:`, err.message, '\n') console.log(`🚨 Failure:`, err.message, '\n')
} finally { } finally {
if (validate) console.warn('🚨 THIS WAS JUST A VALIDATION RUN, NO ORDER HAS BEEN PLACED!', '\n') if (validate) console.warn('🚨 THIS WAS JUST A VALIDATION RUN, NO ORDER HAS BEEN PLACED!', '\n')
} }