chore: use monorepo organization
This commit is contained in:
parent
deaf7d6ecc
commit
a687827f7e
1099 changed files with 8184 additions and 11535 deletions
29
packages/server/lib/plugins/ticker/bitpay.js
Normal file
29
packages/server/lib/plugins/ticker/bitpay.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
const axios = require('axios')
|
||||
const { COINS } = require('@lamassu/coins')
|
||||
|
||||
const BN = require('../../bn')
|
||||
const { BTC, BCH, LN } = COINS
|
||||
|
||||
const CRYPTO = [BTC, BCH, LN]
|
||||
const FIAT = 'ALL_CURRENCIES'
|
||||
|
||||
function ticker (fiatCode, cryptoCode) {
|
||||
return axios.get('https://bitpay.com/rates/' + cryptoCode + '/' + fiatCode)
|
||||
.then(r => {
|
||||
const data = r.data.data
|
||||
const price = new BN(data.rate.toString())
|
||||
return {
|
||||
rates: {
|
||||
ask: price,
|
||||
bid: price
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ticker,
|
||||
name: 'BitPay',
|
||||
CRYPTO,
|
||||
FIAT
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue