feat: add support for binance.us, cex.io and ftx
This commit is contained in:
parent
2040c388b8
commit
01114d01e4
12 changed files with 194 additions and 3 deletions
|
|
@ -4,10 +4,16 @@ const _ = require('lodash/fp')
|
|||
const kraken = require('../exchange/kraken')
|
||||
const bitstamp = require('../exchange/bitstamp')
|
||||
const itbit = require('../exchange/itbit')
|
||||
const binanceus = require('../exchange/binanceus')
|
||||
const cex = require('../exchange/cex')
|
||||
const ftx = require('../exchange/ftx')
|
||||
const bitpay = require('../ticker/bitpay')
|
||||
const { BTC, BCH, DASH, ETH, LTC, ZEC } = COINS
|
||||
|
||||
const ALL = {
|
||||
cex: cex,
|
||||
ftx: ftx,
|
||||
binanceus: binanceus,
|
||||
kraken: kraken,
|
||||
bitstamp: bitstamp,
|
||||
itbit: itbit,
|
||||
|
|
|
|||
20
lib/plugins/exchange/binanceus.js
Normal file
20
lib/plugins/exchange/binanceus.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
const { COINS } = require('lamassu-coins')
|
||||
const _ = require('lodash/fp')
|
||||
|
||||
const { ORDER_TYPES } = require('./consts')
|
||||
|
||||
const ORDER_TYPE = ORDER_TYPES.MARKET
|
||||
const { BTC, BCH, DASH, ETH, LTC, ZEC, USDT } = COINS
|
||||
const CRYPTO = [BTC, ETH, LTC, DASH, ZEC, BCH, USDT]
|
||||
const FIAT = ['USD']
|
||||
const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey']
|
||||
|
||||
const loadConfig = (account) => {
|
||||
const mapper = {}
|
||||
const mapped = _.mapKeys(key => mapper[key] ? mapper[key] : key)(account)
|
||||
return { ...mapped, timeout: 3000 }
|
||||
}
|
||||
|
||||
// Documentation mentions a mandatory field 'time', not sure how ccxt handles this, probably works if we send this via options
|
||||
|
||||
module.exports = { loadConfig, REQUIRED_CONFIG_FIELDS, CRYPTO, FIAT, ORDER_TYPE }
|
||||
21
lib/plugins/exchange/cex.js
Normal file
21
lib/plugins/exchange/cex.js
Normal 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, BCH, DASH, ETH, LTC, USDT } = COINS
|
||||
const CRYPTO = [BTC, ETH, LTC, DASH, BCH, USDT]
|
||||
const FIAT = ['USD', 'EUR']
|
||||
const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey']
|
||||
|
||||
const loadConfig = (account) => {
|
||||
const mapper = {}
|
||||
const mapped = _.mapKeys(key => mapper[key] ? mapper[key] : key)(account)
|
||||
return { ...mapped, timeout: 3000 }
|
||||
}
|
||||
|
||||
// Documentation mentions a field 'nonce', doesn't specify if it's mandatory
|
||||
// or not but we should pay attention to this when testing
|
||||
|
||||
module.exports = { loadConfig, REQUIRED_CONFIG_FIELDS, CRYPTO, FIAT, ORDER_TYPE }
|
||||
19
lib/plugins/exchange/ftx.js
Normal file
19
lib/plugins/exchange/ftx.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
const { COINS } = require('lamassu-coins')
|
||||
const _ = require('lodash/fp')
|
||||
|
||||
const { ORDER_TYPES } = require('./consts')
|
||||
|
||||
const ORDER_TYPE = ORDER_TYPES.MARKET
|
||||
const { BTC, BCH, ETH, LTC, USDT } = COINS
|
||||
const CRYPTO = [BTC, ETH, LTC, BCH, USDT]
|
||||
// ftx supports EUR as well but only for certain cryptos: ETH, BTC
|
||||
const FIAT = ['USD']
|
||||
const REQUIRED_CONFIG_FIELDS = ['apiKey', 'privateKey']
|
||||
|
||||
const loadConfig = (account) => {
|
||||
const mapper = {}
|
||||
const mapped = _.mapKeys(key => mapper[key] ? mapper[key] : key)(account)
|
||||
return { ...mapped, timeout: 3000 }
|
||||
}
|
||||
|
||||
module.exports = { loadConfig, REQUIRED_CONFIG_FIELDS, CRYPTO, FIAT, ORDER_TYPE }
|
||||
Loading…
Add table
Add a link
Reference in a new issue