convert_btc: Convert Bitcoin units

Description Usage Arguments Details Value Examples

Description

Convert among different units of measure for Bitcoin.

Usage

1
2
3
4
5
6
7
convert_btc(x, from = "BTC", to = "bits")

satoshi(x)

bits(x)

mbtc(x)

Arguments

x

a numeric value.

from

the units of x.

to

new units.

Details

This complete conversion function, convert_btc, converts a value x among the following units: BTC, mBTC, bits and satoshi. These are the recommended ways of specifying the from and to arguments, though BTC and mBTC may be passed as btc and mbtc, respectively. BTC may also be written out as Bitcoin/bitcoin and will also be internally converted to BTC.

Three shorthand functions, mBTC, bits and satoshi, are also available if you forget the conversion. These assume the input is Bitcoin and multiply your value straight to mBTC, bits or satoshi, respectively. See examples.

Value

numeric value.

Examples

1
2
3
4
5
6
7
8
9
convert_btc(1, "BTC", "mBTC")
convert_btc(1, "BTC", "bits")
convert_btc(1, "BTC", "satoshi")
convert_btc(0.001, "mBTC", "bits")
convert_btc(1, "mBTC", "bitcoin")
convert_btc(100, "satoshi", "bits")
satoshi(1e-8)
bits(1e-6)
mbtc(0.001)

leonawicz/rockchain documentation built on May 29, 2019, 3:39 a.m.