get-crypto-fiat-values
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Get Crypto FIAT Values

Build Status Coverage Status Average time to resolve an issue Percentage of issues still open

For a crypto currency or several, get its/their FIAT value (in USD).

install

yarn add get-crypto-fiat-values

use

get a single crypto usd value

import { getCryptoUSDValue } from 'get-crypto-fiat-values'

let aPortfolioAllocation: string[] = ['bitcoin', 'ethereum', 'litecoin', 'dogecoin']

aPortfolioAllocation.forEach(async sCurrency => {
    const value = await getCryptoUSDValue(sCurrency)
    console.log(`Got value: ${value}, for ${sCurrency}`)
})

prints:

Got value: 248.464, for litecoin
Got value: 11519.5, for bitcoin
Got value: 944.51, for ethereum
Got value: 0.00707836, for dogecoin

get multiple crypto usd values

import { getMultipleCryptoUSDValue } from 'get-crypto-fiat-values'

const oResult: any = await getMultipleCryptoUSDValue(['ethereum', 'dogecoin', 'litecoin', 'ripple'])

const sETHKey = 'ethereum'
const sDOGEKey = 'dogecoin'
console.log('ethereum value is: ', oResult[sETHKey].usdValue)
console.log('dogecoin value is: ', oResult[sDOGEKey].usdValue)

prints:

ethereum value is:  749.677
dogecoin value is:  0.00421033

Readme

Keywords

none

Package Sidebar

Install

npm i get-crypto-fiat-values

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

116 kB

Total Files

17

Last publish

Collaborators

  • samthomson