feat: bitfinex implementation

This commit is contained in:
Rafael Taranto 2024-04-02 17:56:37 +01:00
parent 80291637c0
commit 98c48ba853
6 changed files with 68 additions and 4 deletions

View file

@ -4,7 +4,7 @@ const _ = require('lodash/fp')
const { ALL } = require('../../plugins/common/ccxt')
const { BTC, BCH, DASH, ETH, LTC, USDT, ZEC, XMR, LN, TRX, USDT_TRON } = COINS
const { bitpay, coinbase, itbit, bitstamp, kraken, binanceus, cex, binance } = ALL
const { bitpay, coinbase, itbit, bitstamp, kraken, binanceus, cex, binance, bitfinex } = ALL
const TICKER = 'ticker'
const WALLET = 'wallet'
@ -17,6 +17,8 @@ const ZERO_CONF = 'zeroConf'
const WALLET_SCORING = 'wallet_scoring'
const ALL_ACCOUNTS = [
{ code: 'bitfinex', display: 'Bitfinex', class: TICKER, cryptos: bitfinex.CRYPTO },
{ code: 'bitfinex', display: 'Bitfinex', class: EXCHANGE, cryptos: bitfinex.CRYPTO },
{ code: 'binance', display: 'Binance', class: TICKER, cryptos: binance.CRYPTO },
{ code: 'binanceus', display: 'Binance.us', class: TICKER, cryptos: binanceus.CRYPTO },
{ code: 'cex', display: 'CEX.IO', class: TICKER, cryptos: cex.CRYPTO },

View file

@ -27,7 +27,8 @@ const SECRET_FIELDS = [
'telnyx.apiKey',
'vonage.apiSecret',
'galoy.walletId',
'galoy.apiSecret'
'galoy.apiSecret',
'bitfinex.secret'
]
/*

View file

@ -9,6 +9,7 @@ const binanceus = require('../exchange/binanceus')
const cex = require('../exchange/cex')
const bitpay = require('../ticker/bitpay')
const binance = require('../exchange/binance')
const bitfinex = require('../exchange/bitfinex')
const logger = require('../../logger')
const { BTC, BCH, DASH, ETH, LTC, ZEC, USDT, TRX, USDT_TRON, LN } = COINS
@ -24,7 +25,8 @@ const ALL = {
CRYPTO: [BTC, ETH, LTC, DASH, ZEC, BCH, USDT, USDT_TRON, TRX, LN],
FIAT: 'ALL_CURRENCIES'
},
binance: binance
binance: binance,
bitfinex: bitfinex
}
function buildMarket (fiatCode, cryptoCode, serviceName) {

View file

@ -0,0 +1,21 @@
const { COINS } = require('@lamassu/coins')
const _ = require('lodash/fp')
const { ORDER_TYPES } = require('./consts')
const ORDER_TYPE = ORDER_TYPES.MARKET
const { BTC, ETH, LTC, BCH, USDT, LN } = COINS
const CRYPTO = [BTC, ETH, LTC, BCH, USDT, LN]
const FIAT = ['USD', 'EUR']
const AMOUNT_PRECISION = 8
const REQUIRED_CONFIG_FIELDS = ['key', 'secret']
const loadConfig = (account) => {
const mapper = {
'key': 'apiKey',
}
const mapped = _.mapKeys(key => mapper[key] ? mapper[key] : key)(account)
return { ...mapped, timeout: 3000 }
}
module.exports = { loadConfig, REQUIRED_CONFIG_FIELDS, CRYPTO, FIAT, ORDER_TYPE, AMOUNT_PRECISION }