Skip to content

Trudko/bitcoin-fiat-price

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Returns the current value of bitcoin, value of a transaction or an address for a given fiat currency. Price of bitcoin used in calculation is provided by Coindesk API.

Still early version, API might change.

Available Functions

getAddressBalance(addressHash, currencyCode)

Returns balance in fiat currency specified by currencyCode for a given bitcoin address. If currencyCode is empty, it defaults to USD.

getCurrentPrice(currencyCode)

Returns current price of 1 bitcoin in fiat currency specified by currencyCode(default value USD). If currencyCode is empty, it defaults to USD.

getTransactionPrice(trxID, currencyCode)

Returns object with information about transaction, specified by txid - transaction identifier. If currencyCode is empty, it defaults to USD. Properties of object:

iputs: array of all inputs in bitcoin.

outputs: array of all outputs in bitcoin.

fee: original fee in bitcoin

inputsFiat: array of all inputs in fiat currency.

outputsFiat: array of all outputs in fiat currency.

feeFiat: fee in fiat currency without rounding up.

bitcoinPriceFiat: price of bitcoin used in calculations.

Example of result used in test:
{
  inputs: [ 0.76521777 ],
  outputs: [ 0.74520777, 0.02 ],
  fee: 0.00001,
  inputsFiat: [ 210.05 ],
  outputsFiat: [ 204.55, 5.49 ],
  feeFiat: 0.0027449380000000006,
  bitcoinPriceFiat: 274.4938
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published