Git Product home page Git Product logo

btc-value-cli's Introduction


btc-value-cli


Get the current Bitcoin value in command line

Downloads

Installation

npm install --global btc-value-cli

Usage

$ btc-value --help

  Usage
    $ btc-value

  Options
    --key -k                      Set the API key (Obtain key at: https://coinmarketcap.com/api/)
    --decimal -d                  Print value as decimal
    --save -s [code]              Set the currency that will be used by default
    --currency -c [code]          Print the value in another currency
    --list -l                     Print a list of all supported currencies
    --quantity -q [number]        Print the value of the given quantity
    --autorefresh -a [seconds]    Automatic refresh printing every x seconds
    --percentage -p [h|d|w]       Print the percentage change (h = hour, d = day, w = week)
    --reset -r                    Reset the configuration to the default
    --provider [cmc|coingecko]    Set the currency provider to retrieve Bitcoin values from

  Examples
    $ btc-value
    $ btc-value -k <example-API-key>
    $ btc-value -d
    $ btc-value -s NOK
    $ btc-value -c NOK
    $ btc-value -q 2.2
    $ btc-value -p h
    $ btc-value --provider coingecko

Options

--decimal, -d

Print the value as a decimal number.

--save, -s [code]

Set the currency that will be used by default. It will save the new default currency code and symbol in the config.json file. Next time btc-value is run in command line it will print the value of the new default currency.

--currency, -c [code]

Print the value in another currency. It will print out the value of the currency code. A list of all currency codes can be shown with the use of the -l flag.

--list, -l

Print a list of all supported currencies for the selected currency provider.

--quantity, -q [number]

Print the value of the given quantity. Input quantity can be either decimal or integer. If the input quantity is set to a number, the given quantity is saved locally in the config.json file. The -q flag can be used with and without a number input.

--autorefresh, -a [seconds]

Set a timeout that print the value every seconds seconds. The timeout restarts after every use. If seconds is not set, the default timeout is used (15 seconds). This is stored in the config.json file. The reason a timeout is used instead of a interval, is that it might not finish before the next starts (if bad network connection) and this can use more memory than needed.

--percentage, -p [h|d|w]

Print the percentage change the last hour, day and week. If the flag is set to h then percentage change last hour is printed. It is the same for d and days, and w and week. If the percentage is negative it is printed in bright red otherwise it is printed in green.

--reset, -r

Reset the configuration to the default:

{
    default: 'USD',
    quantity: 1,
    autorefresh: 15,
    apiKey: '',
    provider: 'coingecko'
}

--provider [cmc|coingecko]

Set the currency provider to retrieve Bitcoin values from. By default it uses the data from CoinGecko.

--key, -k

Set the API key. This key is optional and only required if using data from the CoinMarketCap API. To obtain an API key go to the Cryptocurrency Market Capitalizations API.

Related

btc-value-cli's People

Contributors

dependabot[bot] avatar knutkirkhorn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

btc-value-cli's Issues

Reduce outprint of autorefresh and quantity

Problem

When using both autorefresh (-a) and quantity (-q) The outprint is:

  • Value of x BTC:

  • Quantity set to: x

  • <btc value>

Should be

First time in autorefresh: Quantity set to: x

  • Value of x BTC:

  • <btc value>

How to fix this

Do not set the quantity every time if using both (-a) and (-q).

Rename `Double`

Rename Double to Decimal as it is a better fit for the name of the option

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.