From 0dc087dc2b6fcd0dc4a766f9baf20fd27daa5934 Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Wed, 13 May 2020 07:44:02 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20validate=20param=20and=20t?= =?UTF-8?q?xid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 7e8e825..37cda43 100644 --- a/index.js +++ b/index.js @@ -37,12 +37,14 @@ const validate = process.argv[2] === '--validate' // Place order try { - const details = { pair, type: 'buy', ordertype: 'limit', price, volume, validate } - const { result: { descr: { order } }, txid } = await kraken.api('AddOrder', details) + const details = { pair, type: 'buy', ordertype: 'limit', price, volume } + if (validate) details.validate = true + + const { result: { descr: { order }, txid } } = await kraken.api('AddOrder', details) console.log('💸 Placed order:', order, '/ TXID:', txid, '\n') } catch (err) { - console.error(`🚨 Failure:`, err.message, '\n') + console.log(`🚨 Failure:`, err.message, '\n') } finally { if (validate) console.warn('🚨 THIS WAS JUST A VALIDATION RUN, NO ORDER HAS BEEN PLACED!', '\n') }