Giter Site home page Giter Site logo

madnight / bitcoin-chart-cli Goto Github PK

View Code? Open in Web Editor NEW
300.0 14.0 37.0 898 KB

Bitcoin chart for the terminal as command line util

License: MIT License

JavaScript 94.19% Shell 5.81%
bitcoin cli charts terminal nodejs cryptocurrency cryptocurrencies cryptocurrency-graph bitcoin-price ethereum-price

bitcoin-chart-cli's Introduction

bitcoin-chart-cli

npm License: MIT License: MIT Issue Count Known Vulnerabilities

Bitcoin chart for the terminal as command line util.
For a list of supported cryptocurrencies see coins.
You might also be interested in a similar project of
mine wallstreet, which provides information about
stocks instead of cryptocurrencies.

Requirements

  • node 8.0 or higher
  • npm or yarn

Usage

# install
npm install bitcoin-chart-cli -g

# (alternative) install with yarn
yarn global add bitcoin-chart-cli

# (alternative) run without install
npx bitcoin-chart-cli

# run default
bitcoin-chart-cli

# run with options
bitcoin-chart-cli --coin ETH -d 360 -w 80 -h 20

# run with your own api key for higher requests limits
export CRYPTOCOMPARE_API_KEY=your_api_key
bitcoin-chart-cli --coin XRP -ti RSI SMA BB EMA MACD

Options

bitcoin-chart-cli --help


  Usage: index [options]


  Options:

  -V, --version                         output the version number
  -d, --days <n>                        number of days the chart will go back
  --hours <n>                           number of hours the chart will go back
  --mins <n>                            number of minutes the chart will go back
  -w, --width <n>                       max terminal chart width
  -h, --height <n>                      max terminal chart height
  --max <n>                             max y-axis value
  --min <n>                             min y-axis value
  --min-range <n>                       min range between min and max y-axis value
  -c, --coin <string>                   specify the coin e.g. ETH (default: "BTC")
  --currency <string>                   specify the trading pair currency (default: "USD")
  -l, --list                            list all available coins
  -t, --toplist <n>                     list of top n coins
  --disable-legend                      disable legend text
  -ti, --technical-indicator <type...>  add a technical indicator: RSI SMA BB EMA MACD
  -h, --help                            display help for command

Examples

bitcoin-chart-cli

Create terminal splits (tmux) with watch for live charts the unix way
watch -n 60 bitcoin-chart-cli --mins 30 --width 60

In combination with conky
conky.text = [[ ${execi 120 bitcoin-chart-cli --coin ETH -w 140 -h 15} ]];
bitcoin-chart-cli --toplist 15
Rank  Name                        Price     MktCap     Volume   Change/24h
--------------------------------------------------------------------------
1.    Bitcoin                 $57844.00    1081.8B      25.7B        4.05%
2.    Ethereum                 $3521.65     407.7B      15.0B        2.47%
3.    Binance Coin              $630.03      96.7B       2.2B        1.04%
4.    Dogecoin                    $0.65      84.2B      11.5B       14.61%
5.    XRP                         $1.60      72.6B       4.2B        0.90%
6.    Tether                      $1.00      54.8B      80.8B       -0.00%
7.    Cardano                     $1.66      53.0B       3.0B        8.59%
8.    Polkadot                   $40.99      40.6B       1.3B        1.20%
9.    Bitcoin Cash             $1341.36      25.1B       2.9B       -4.85%
10.   Litecoin                  $344.02      23.0B       4.0B        5.05%
11.   Uniswap                    $40.36      21.1B     390.2M        0.70%
12.   Chainlink                  $49.73      20.8B       1.2B        8.07%
13.   VeChain                     $0.23      15.0B       1.5B       14.39%
14.   Stellar                     $0.64      14.7B     932.3M        1.50%
15.   USD Coin                    $1.00      14.4B     736.5M       -0.05%

image

Charts with technical indicators
bitcoin-chart-cli --coin XRP -ti RSI SMA BB EMA MACD

bitcoin-chart-cli's People

Contributors

chadsr avatar dependabot[bot] avatar madnight avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitcoin-chart-cli's Issues

Unknown Error

I have installed bitcoin-chart-cli and created a symlink between /usr/bin/nodejs and usr/bin/node. When I run the command bitcoin-chart-cli I receive the following error.

/usr/local/lib/node_modules/bitcoin-chart-cli/index.js:3
const { get, defaultTo, map, flow, sortBy, remove, always,
^

SyntaxError: Unexpected token ,
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3

Use only one API call per run.

By having tmux view of multiple updating charts you can easily exceed your daily call limits. I noticed that every time bitcoin-chart-cli runs it makes two API call, to get the history and the current value. This is not very favorable for free users.

I then wondered would it be possible to extract the current value straight from the history call so you'd only need to make a single API call? I'm not very familiar with the API but I'd sort of assume that the latest value in the history would be the current value.

Empty chart when using bitcoin-chart-cli with watch

bitcoin-chart-cli works without any problems (tried all args, resizing terminal etc.), but after using
watch bitcoin-chart-cli... I see just numbers, header, info but no chart, the whole screen is empty

Using OS X, iterm2, node = 9.4.0

"width" option not working correctly

Hello, first of all, great app here!
I installed on my Mac (macOS 10.12.6) and I noticed some strange behavior trying to set the 'width' option.
For -w 70 and -w 80, it seems like the chart is displayed at the same width, and only the text underneath the chart changes its width. Image attached.

image

Vulnerability

The badge show that there is one vulnerability, prototype pollution.

url error

bitcoin-chart-cli -V
./.nvm/versions/node/v6.11.4/lib/node_modules/bitcoin-chart-cli/index.js:52
const fetchCoinList = async url =>
^^^

SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)

Example: tmux script

#!/bin/sh
tmux new-session -d -s BTC_mon 'watch -n 30 bitcoin-chart-cli --currency CAD --mins 30 --width 60'
tmux split-window -h 'watch -n 60 bitcoin-chart-cli --currency CAD --hours 24 --width 60'
tmux split-window -v -t 0 'watch -n 60 bitcoin-chart-cli --currency CAD --days 7 --width 60'
tmux split-window -v -t 2 'watch -n 60 bitcoin-chart-cli --currency CAD --days 30 --width 60'
tmux -2 attach-session -t BTC_mon

Just wanted to post a good tmux example for the graph.
Not really an error just thought it would help people.
Also love the program ๐Ÿ‘

[Feature Request] Minimum (and maximum) unit range

I find it a bit disturbing how much the chart may change on update due to the min and max values of the requested timeframe changing and the chart range depending on them.

So I'd like to be able to set something like have the minimum range be 50 units of the selected currency and the chart range wouldn't go smaller than that even if all the values from the requested timeframe are spread on a range less than 50 units.

I was thinking of requesting also max range option but that could be a bit too hard to implement in a way that satisfies all. Maybe take the average of the values within the selecter timeframe and center the chart on it if the current value is within that range? Otherwise use the current value as the min or max of the range depending on whether it was under or over the range determined from the average. Anyway the max value is less important to me but might as well lay it here as well.

Erhh..Help requisite!

Installs node, Installs chart-cli but then:

/usr/local/lib/node_modules/bitcoin-chart-cli/index.js:21
const printCoins = async () =>
                         ^

SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:383:7)
    at startup (bootstrap_node.js:149:9)

Help @madnight ?

Support for api key?

I would like to use an api key from cryptopian just so I'm not limited to "free"

SyntaxError: Unexpected identifier

I get this message after installing as explained in the README, happens also with options or other currencies.

[...]/yarn/global/node_modules/bitcoin-chart-cli/index.js:39
const current = async url => (await axios.get(url)).data
                      ^^^
SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:390:7)
    at startup (bootstrap_node.js:150:9)

Would you mind if I backlink to this repository?

Hello, Fabian!

I noticed your bitcoin-chart-cli repository, and I am very happy to know you're using my asciichart package in it, that's awesome! ) Would you mind if I link to your repository from my other projects on GitHub? Also, checkout my ccxt library for cryptocurrency trading, if you haven't yet )

Thanks!

PS. Don't know if it's appropriate here, but I tried to send the above message to your contact email, and got the following response, you may want to do something about it )

screen shot 2017-08-03 at 16 42 10

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.