
Show HN: Coinmon – Check Bitcoin Prices in Terminal - bichenkk
https://github.com/bichenkk/coinmon
======
adtac

        $ coinmon() {
        >     curl "https://api.coinmarketcap.com/v1/ticker/?convert=$1" | jq ".[0] .price_$1"
        > }
    
        $ coinmon eur
        "6988.4723188"
    

In case you don't want to install 61 packages [1] :)

I don't know when/where nodejs development went wrong, but there's definitely
something wrong.

[1]
[http://npm.anvaka.com/#/view/2d/coinmon](http://npm.anvaka.com/#/view/2d/coinmon)

~~~
JepZ
You are so right. When I saw the link I thought: "That could be fun, lets take
a look how it displays the data". But when I saw that it uses node.js I
thought "Oh my god, who had this brilliant idea to write it with node"...

Hey guys, please use rust, golang, haskell or whatever you like, but please do
not use nodejs to write CLI tools.

And I am not one of the guys who is against JS in general. In fact, I like
building PWAs and other JS heavy apps/websites a lot. But there are so many
tools do a better job at building cli programs.

~~~
Klathmon
I don't get the hate here, Node works great for CLI tools.

Easy and quick install, supports colors and icons in the terminal, has several
easy and useful table libraries to choose from, and it runs plenty fast enough
for it's use case.

What benefits would rust, golang, haskell, or whatever you like provide over
node in this situation?

~~~
diggan
Also a NodeJS fan in general, but prefer to install/develop cli's with golang
instead of node just because you get a compiled, static binary that works
cross-platform. Faster for users to install, less bloaty and works on all
platforms without any dependencies.

~~~
52-6F-62
I personally usually use Python, Bash, or C, but there is a utility for
packaging NodeJS tools into executables. I think it does some tree-shaking as
well. Disclaimer: I haven't used it, so I'm not sure of the results. But it is
possible.

[https://www.npmjs.com/package/pkg](https://www.npmjs.com/package/pkg)

edit: For the curious -- Just tried on a really simple script that just takes
one argument and writes it with some text to STDOUT and it _still_ came to
35MB. So it must package a bunch of Node with it. I won't be leaving my go-
to's for it anytime soon unless usability and development speed necessitate
it. Going to have to go with the, best to not use NodeJS for general cmd-line
utils outside of the NodeJS environment. The one perk is that it will, by
default, output executables for Linux, macOS, and Windows.

Source:

    
    
        (function() {
        'use strict';
    
          function main(_string) {
            console.log(`${_string} was read from STDIN.`);
          }
    
          main(process.argv[2]);
    
        }());
    

Output file:

    
    
        35088858 Nov 20 11:36 index-linux
        35717043 Nov 20 11:36 index-macos
        23137020 Nov 20 11:36 index-win.exe

~~~
WildGreenLeave
Thats because PKG is including the Node runtime in the binaries, this way
users don't have to install Node itself to run them.

I'm using it myself and besides the fat binaries and the fact that you have to
write Javascript, it is really good. (Working on replacing this daemon with Go
ASAP)

Edit: just read your last line, I'm kinda stating the obvious here.

------
criddell
Last week I listened to an interview with a man that has written some books on
Bitcoin and other crypto currencies and in it he stated that he lives as much
of his life on bitcoin as possible. He asks to be paid in bitcoin, he pays his
employees in bitcoin, and generally uses it wherever possible.

I was thinking about this and to somebody like that, it must seem like the USD
is crashing. If bitcoin is your currency, then deflation is happening
everywhere! Does he look at the housing market and marvel how everything is
now around 80% less expensive than it was at the start of the year?

~~~
equalarrow
Sounds like Andreas Antonopoulos.
[https://antonopoulos.com](https://antonopoulos.com)

------
TekMol
By the way, what is up with Bitcoin? Why did it rise 10x this year?

~~~
nathan_f77
I would really like to read a well-researched answer to this question. I've
heard various theories around instability in Puerto Rico, and people using it
to move money out of China. I have no idea if there's any evidence to support
those theories.

I really want to understand some of the economics behind the value of a
Bitcoin. Some people say that it's actually worthless, but that can't be true.
It lets people move practically unlimited amounts of money anywhere in the
world for a relatively small fee. It also provides immutable data that can be
used to verify records.

I actually spent this weekend adding blockchain verification to my document
generation service [1]. It was actually pretty amazing to look at a Bitcoin
transaction [2], and realize that this data has so much authenticity and
permanence. Not only does it guarantee that my document existed at a certain
point in time, but that hash will probably be preserved in the blockchain for
the rest of human history.

That one bitcoin transaction cost a lot of money (0.000846 BTC, or $6.95 USD),
but it verifies a large number of records by using a merkle tree. [3]

I have no idea how these fees relate to the fiat price, but that must be one
factor. Also the price of electricity around the world. There's a lot of
speculation and "tulip mania" too, but even if you ignore all of that, I think
it's a very interesting thing to research.

[1] [https://formapi.io/](https://formapi.io/)

[2]
[https://live.blockcypher.com/btc/tx/4dc1ef829128355fdbbf3afb...](https://live.blockcypher.com/btc/tx/4dc1ef829128355fdbbf3afbf0de854778e0e027481e9a5ff53a64d9ab39a78c/)

[3] [https://chainpoint.org/](https://chainpoint.org/)

~~~
asciimo
The fee size is relative to the amount of competition to get transactions into
the next block. Because the block size has been capped at 1MB, not every
transaction in the preceding 10 minutes will fit. So miners sort by the fees
attached to the transactions when selecting them. (I think the block size is
supposed to be increased to 2MB shortly, if it hasn't already.)

------
JosephRedfern
Looks cool. Live updating would make it even better.

I've reported a very minor bug that I'm experiencing:
[https://github.com/bichenkk/coinmon/issues/1](https://github.com/bichenkk/coinmon/issues/1)

~~~
estsauver
You could use `watch -n 1 coinmon`.

~~~
JosephRedfern
That's true (with `--color`). An alternative way would be to connect to one of
the various websocket APIs that stream pricing data, might be a bit friendlier
than constant polling... but that'd be quite a lot of work!

------
bichenkk
Just made a tool for you to check bitcoin prices on terminal for fun!

~~~
LansanaCamara
Good stuff! Works nicely.

------
ddxxgg
I was bored, so I decided to make a Nim equivalent using only the standard
library. Turned out to be exactly 55 lines
[https://gist.github.com/anonymous/1e3d7045de67f59c676135fead...](https://gist.github.com/anonymous/1e3d7045de67f59c676135fead3aa66a)

------
lee101
Awesome stuff :D I'm founder of [https://bitbank.nz](https://bitbank.nz)

I would love to see someone build something based on the live crypto forecast
data we have,

I'm happy for you to reverse engineer/use the same api that our frontend uses,
we also have a firebase API so people can subscribe to live updates,

Let me know your email if your from HN and ill give you some free time to use
the platform :)

We also have a referral program where you can make .003btc each paying user.

Thanks!

------
sleavey
Here's my almost pure Python equivalent [1].

[1]
[https://github.com/SeanDS/cryptoquote](https://github.com/SeanDS/cryptoquote)

------
egeozcan
Idea: Show bitcoin prices in terms of my hour's worth!

    
    
        $ coinmon -c X EUR/month
        You have to work Y hours for a bitcoin!
    

I think this aligns just _a little bit more_ with the idealistic view of BTC.
Next step would be getting paid in BTC, and then, getting a fixed amount of
BTC.

~~~
jaymzcampbell
Not sure why you're being downvoted (maybe offtopic I guess?) but this is how
I view pretty much all transactions I do. If I buy a fancy craft beer in a bar
for £5 then that's not £5 to me but "X minutes" depending on where I'm
working. I've also been comparing "time to earn X for Y bitcoin" when I
purchase on gdax to give me a sense of relative grounding.

------
uberswe
I wrote something similar with Go a while back which is configured via a json
file and runs in the terminal [https://github.com/markustenghamn/golang-
cryptotracker](https://github.com/markustenghamn/golang-cryptotracker)

------
gergderkson
This is cool. It would be nice if it live updated.

------
omurphy27
Awesome work! I'll no longer have to keep a browser tab with coinmarketcap
open.

------
Btcpx
Hi can you explain this in plain English please?

------
xkln
> 61 packages

That is truly disgusting. WTF are we doing?

------
vnglst
Nice work, I like it!!

------
onion-soup
why?

~~~
purerandomness
How else would you check Bitcoin prices?

Launch a whole web browser and visit a random site?

~~~
0xJRS
I have these in my zshrc

btc='echo "Btc(usd): $"$(curl -sL
[https://api.coinmarketcap.com/v1/ticker/bitcoin/](https://api.coinmarketcap.com/v1/ticker/bitcoin/)
| jq ".[0].price_usd" | cut -d\" -f2 )'

eth='echo "Eth(usd): $"$(curl -sL
[https://api.coinmarketcap.com/v1/ticker/ethereum/](https://api.coinmarketcap.com/v1/ticker/ethereum/)
| jq ".[0].price_usd" | cut -d\" -f2 )'

