Trade on USD Kraken if fiat is other than USD/EUR (#93)
* Trade on USD Kraken if fiat is other than USD/EUR * Fix array membership logic * Default to EUR
This commit is contained in:
parent
0c97df42e5
commit
bc66b7b843
1 changed files with 7 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
// Note: Using DeX3/npm-kraken-api to adjust timeout time
|
||||
const Kraken = require('kraken-api')
|
||||
const _ = require('lodash/fp')
|
||||
|
||||
const common = require('../../common/kraken')
|
||||
|
||||
|
|
@ -19,11 +20,14 @@ function trade (account, type, cryptoAtoms, fiatCode, cryptoCode) {
|
|||
const kraken = new Kraken(account.apiKey, account.privateKey, {timeout: 30000})
|
||||
const amount = common.toUnit(cryptoAtoms, cryptoCode)
|
||||
const amountStr = amount.toFixed(6)
|
||||
const pair = PAIRS[cryptoCode][fiatCode]
|
||||
|
||||
const pair = _.includes(fiatCode, ['USD', 'EUR'])
|
||||
? PAIRS[cryptoCode][fiatCode]
|
||||
: PAIRS[cryptoCode]['EUR']
|
||||
|
||||
var orderInfo = {
|
||||
pair: pair,
|
||||
type: type,
|
||||
pair,
|
||||
type,
|
||||
ordertype: 'market',
|
||||
volume: amountStr,
|
||||
expiretm: '+60'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue