lamassu-server/lib/plugins/exchange/itbit.js
2021-05-25 10:53:54 +01:00

24 lines
891 B
JavaScript

const _ = require('lodash/fp')
const { ORDER_TYPES } = require('./consts')
const { COINS } = require('../../new-admin/config/coins') // para cada exchange
const ORDER_TYPE = ORDER_TYPES.LIMIT
const { BTC, ETH, LTC, BCH } = COINS
const CRYPTO = [BTC, ETH, LTC, BCH]
const FIAT = ['USD']
const AMOUNT_PRECISION = 4
const loadConfig = (account) => {
const mapper = {
'clientKey': 'apiKey',
'clientSecret': 'secret',
'userId': 'uid'
}
const mapped = _.mapKeys(key => mapper[key] ? mapper[key] : key)(_.omit(['walletId'], account))
return { ...mapped, timeout: 3000 }
}
const loadOptions = ({ walletId }) => ({ walletId })
const isConfigValid = ({ clientKey, clientSecret, userId, walletId }) => clientKey && clientSecret && userId && walletId
module.exports = { loadOptions, loadConfig, isConfigValid, CRYPTO, FIAT, ORDER_TYPE, AMOUNT_PRECISION }