v12.0.0 - initial commit
This commit is contained in:
commit
e2c49ea43c
1145 changed files with 97211 additions and 0 deletions
30
packages/server/lib/plugins/ticker/bitpay.js
Normal file
30
packages/server/lib/plugins/ticker/bitpay.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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