alexanderepstein / Bash-Snippets

A collection of small bash scripts for heavy terminal users
MIT License
9.64k stars 842 forks source link

add support for rate.sx #152

Closed chubin closed 6 years ago

chubin commented 6 years ago

Issue Label:

Description:

rate.sx — it's a new console service for getting cryptocurrencies exchange rates. It delivers various information about the most popular (by market capitalization) cryptocurrencies: exchange rate, change in 1h and 24h, market capitalization, volume etc. It is completely clientless, and needs no special dependencies, can be used with curl/httpie/etc like wttr.in or cheat.sh.

It would be great to integrate it in Bash-Snippets.

alexanderepstein commented 6 years ago

I will definitely add this as a flag to the cryptocurrency tool I love the way the output looks any chance I could add a flag to the end of the url that would specify if I want it in EUR or usd? I if I could it would probably become the default for the cryptocurrency tool and I would make the current functionality only accessible with a flag

chubin commented 6 years ago

@alexanderepstein Hi Alex! Yes, there is the chance: just use

curl eur.rate.sx
curl chf.rate.sx
curl gbp.rate.sx

(or whatever; 10 currencies are supported at the moment).

alexanderepstein commented 6 years ago

Awesome! I am definitely going to have this take over for the cryptocurrency tool and reserve the current functionality for a flag. It may take me 2-3 weeks as I am busy with finals and probably won't want to do work for a few days when I get back home :relaxed: :tada:

alexanderepstein commented 6 years ago

Can you let me know what 10 currencies are supported atm?

chubin commented 6 years ago

Cool!

They are listed here: http://rate.sx/:help

It is likely that the list will grow with time, so you should better check it before releasing the tools (or even check automatically with your tool).

And take a look at another new feature (it is not yet released, but it is cool):

Try: curl http://eur.rate.sx/1usd or http://rate.sx/1btc+1bch+1btg or http://cad.rate.sx/0.1btc-2.555eth (crypto)currency calculator. You can do +,- and convert between any (crypto)currencies

More on it here: https://twitter.com/igor_chubin/status/938161710019633152 (Do you have twitter by the way?)

alexanderepstein commented 6 years ago

Awesome I will be getting to this over the course of the next week, should I expect you will also be accepting an account address to determine the balance on it? I can account for this in my code preemptively if that will be the case. Annd no I actually do not have a twitter! I had one a while ago and got rid of it but I might make a new one at some point and use it for purely open source work and what not

chubin commented 6 years ago

@alexanderepstein yes (balance) and yes (it's a good idea to use Twitter solely to promote/support/discuss your tools; (Imho) it's a funny and strange idea to tweet about your personal life/but it is perfectly ok and even really convenient and efficient to use it as a support channel for your tools).

The idea with the balance is great. We've discussed it already in one of the issues of rate.sx; it will be implemented. So it will be possible to see how much you have on some account; you can count on it.

navanchauhan commented 6 years ago

I’m free right now so I can look into implementing it in the script if that’s ok ?

alexanderepstein commented 6 years ago

@navanchauhan yeah you can definitely look to start implementing parts of this, it will be a lot to change, I want the old functionality of cryptocurrency tool to still exist but it will with some flag like -o or -d to use the old functionality. Otherwise use rates.sx and also set the code up for being able to call rates.sx for different fiat currencies something like cryptocurrency -f eur will call eur.rates.sx It would also make sense to have a -a flag that doesnt do anything at the moment but the rest of the code can handle if it exists (this is where the address of a wallet can be supplied)

alexanderepstein commented 6 years ago

@chubin Yeah i think I will end up making one when I do Ill give you the handle :smile:

I also like the idea with balance, I took a shot at something similar with my cryptowatch project but you did a way better job lol :+1:

alexanderepstein commented 6 years ago

First version in this commit ac76f298db3d6632f316aed0fee30526cd014da7

elsesiy commented 6 years ago

@alexanderepstein @chubin I'm happy to support as well so we can make it the best CLI tool possible for monitoring crypto currencies 🥇

chubin commented 6 years ago

@alexanderepstein @elsesiy @navanchauhan I'm working on several new cool features right now. I bet you will like them.

Apropos monitoring, you could add the "follow" mode to the tool, so it will notify you if the price drops below something or soars above something.

Just a wrapper around this:

watch -gn300 'curl -s eur.rate.sx/1btc-13500eur | grep ^-' > /dev/null ; echo 'To the MOON!' | mail some@email.com

Something like

echo cryptocurrency -F 1btc-13500eur some@email.com | at now

or just

cryptocurrency -F 1btc-13500eur some@email.com

but in the latter case you have to send it to background on your own.

elsesiy commented 6 years ago

@alexanderepstein In the current implementation you broke the old functionality. It's not possible to provide the specified -o argument...

alexanderepstein commented 6 years ago

Ah damn I suck lol I forgot to throw o in getopts I fixed this in the latest commit, will be out with the next update

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue has been automatically closed because it has been inactive for 30 days.

chubin commented 6 years ago

Can we reopen it please?

elsesiy commented 6 years ago

Yes I'm with @chubin here. Also the old functionality is still broken so there's no way to query for a certain amount atm.

@alexanderepstein Shall I fix the issue in the current implementation and keep going with Igor or when do you intend to do it?

alexanderepstein commented 6 years ago

I did fix the current implementation issue just havent released an update in a while feel free to work with igor on this issue but I have been extremely busy lately so its hard to work on this project

elsesiy commented 6 years ago

Okay, let's try to get this going again :) @chubin Can you reach out to me via Twitter or something like that? Thanks!

chubin commented 6 years ago

@elsesiy yes of course

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

elsesiy commented 6 years ago

@chubin What's the status on this?

chubin commented 6 years ago

I hope to release a major update for rate.sx soon, and we can continue with this issue then

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

chubin commented 6 years ago

@elsesiy @alexanderepstein @navanchauhan I've released the major update of rate.sx I mentioned above. Now it's possible not simply do the currency conversion, but also check/visualize conversion rate change/dynamics.

Try:

curl rate.sx/eth
curl rate.sx/btc@1w
curl rate.sx/btc/eth
elsesiy commented 6 years ago

@chubin Is it also possible to retrieve a quota for any given account balance? Let's say user A has 60 BTC and wants to know how much it's worth right now..

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue has been automatically closed because it has been inactive for 30 days.