Git Product home page Git Product logo

bitcoin-fiat-price's Introduction

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
}

bitcoin-fiat-price's People

Contributors

trudko avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.