Bitcoin Forum
September 24, 2024, 09:36:20 AM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Linux command line tool for Bitcoin / crypto quotes (bash)  (Read 209 times)
fatrattombala (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 6


View Profile
July 06, 2020, 04:43:41 PM
Merited by MrFreeDragon (3), d5000 (1), ABCbits (1), cr4zyd3v (1)
 #1

Hi all,

I wrote a small linux command line tool as a bash scripting learning project; it uses the CoinGecko-API and is capable of displaying all their supported crypto-currencies, as well as cross-currencies (>50 at the moment, including some cryptos and commodities gold and silver).

It can be found here:

https://github.com/fatrattombala/bash-btc-quote

An older, simpler and therefore faster version (also accessible on github) uses the Kraken-API and shows only BTC and ETH.

https://raw.githubusercontent.com/fatrattombala/bash-btc-quote/master/BTCquote.png

Enjoy!
fatrattombala (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 6


View Profile
July 07, 2020, 10:30:22 PM
 #2

Thanks for the reply, I'm glad you liked it. I'll give the widget idea a shot. And you are right, no error handling yet. There is a "ping" function in the API where the script could test if it's available or not.
Protrader1220
Newbie
*
Offline Offline

Activity: 41
Merit: 0


View Profile
July 08, 2020, 09:21:09 PM
 #3

It's easy, just what you need to do is for bitcoin or other currency which is fork of bitcoin or based on bitcoin.

Just download easybitcoin.php script.  Change the port and run the commands.
Protrader1220
Newbie
*
Offline Offline

Activity: 41
Merit: 0


View Profile
July 08, 2020, 09:41:39 PM
 #4

Nice work, it would be cool if you show the output on widget which shows terminal output.

But looks like there's no handling in case CoinGecko forbid the request (usually due to VPN/Tor usage) or currently down. Simple error message should do the job, since currently it shows this error message

Code:
parse error: Invalid numeric literal at line 1, column 10

Check I have updated the topic for it.
fatrattombala (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 6


View Profile
July 11, 2020, 09:26:22 AM
 #5

I updated the script - now it checks if the CoinGecko API is available, before doing anything else; if not, there is a message and the script terminates (no ugly parse error message anymore).

I figured out that with the "xmessage"-function the prices could be displayed in a pop-up-window; but all the colours would be gone, and the idea behind the script is that the desired information is accessible from and displaying to the command line interface  Roll Eyes.
naufragus
Newbie
*
Offline Offline

Activity: 29
Merit: 50


View Profile
August 24, 2020, 01:12:53 AM
Last edit: August 24, 2020, 01:32:07 AM by naufragus
 #6

Hi all,

I wrote a small linux command line tool as a bash scripting learning project; it uses the CoinGecko-API and is capable of displaying all their supported crypto-currencies, as well as cross-currencies (>50 at the moment, including some cryptos and commodities gold and silver).

Enjoy!


Hey mate, nice script! I was very interested when i saw the topic here..
That is a very nice script of yours indeed. I love the colours!

I wrote some scripts for similar purposes and you may be interested.
https://github.com/mountaineerbr/markets
Specially, i wrote the cgk.sh which uses CoinGecko API, too.
Syntax is something like:

Code:
$ cgk.sh 5+5 BTC CNY
804340.0000000000000000

It has many options and i hope it is robust, however if the user is not
connected to the internet or the error is from CoinGecko side, i dont care
to troubleshoot for the user too much..
MrFreeDragon
Sr. Member
****
Offline Offline

Activity: 443
Merit: 350


View Profile
August 24, 2020, 06:22:19 PM
 #7

Thank you! Nice work!  Smiley

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!