feat: add USDT as a trading market
This commit is contained in:
parent
653c78313e
commit
7f168859d8
2 changed files with 18 additions and 10 deletions
|
|
@ -58,13 +58,16 @@ function calculatePrice (side, amount, orderBook) {
|
|||
function _getMarkets (exchangeName, availableCryptos) {
|
||||
try {
|
||||
const exchange = new ccxt[exchangeName]()
|
||||
const currencyCodes = _.map(it => it.code, currencies)
|
||||
const cryptosToQuoteAgainst = ['USDT']
|
||||
const currencyCodes = _.concat(_.map(it => it.code, currencies), cryptosToQuoteAgainst)
|
||||
|
||||
return exchange.fetchMarkets()
|
||||
.then(_.filter(it => (it.type === 'spot' || it.spot)))
|
||||
.then(res =>
|
||||
_.reduce((acc, value) => {
|
||||
if (_.includes(value.base, availableCryptos) && _.includes(value.quote, currencyCodes)) {
|
||||
if (value.quote === value.base) return acc
|
||||
|
||||
if (_.isNil(acc[value.quote])) {
|
||||
return { ...acc, [value.quote]: [value.base] }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue