lamassu-server/lib/plugins/exchange/itbit.js
2021-07-08 17:08:38 +01:00

25 lines
890 B
JavaScript

const _ = require('lodash/fp')
const { ORDER_TYPES } = require('./consts')
const { COINS } = require('lamassu-coins')
const ORDER_TYPE = ORDER_TYPES.LIMIT
const { BTC, ETH, USDT } = COINS
const CRYPTO = [BTC, ETH, USDT]
const FIAT = ['USD']
const AMOUNT_PRECISION = 4
const REQUIRED_CONFIG_FIELDS = ['clientKey', 'clientSecret', 'userId', 'walletId']
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 loadTradeId = (options, id) => _.assign({}, options)
module.exports = { loadTradeId, loadOptions, loadConfig, REQUIRED_CONFIG_FIELDS, CRYPTO, FIAT, ORDER_TYPE, AMOUNT_PRECISION }