A verrrry simple rust CLI for getting & totalling various crypto prices. Use it to calculate the price of your portfolio (which is not so easy if you're keeping your crypto off exchanges!)
First clone the dir, enter the dir & build the tool:
β cargo b --release
Then get yourself a coinmarketcap API key via their website here.
Once built, enter ./target/release
to find the binary.
Encrypt your coinmarketcap API key using gpg:
β echo <YOUR-API-KEY-HERE> | gpg -c --output coinmarketcap-api-key.gpg
(The -c
here meaning symmetric encryption. Use -e
if assymmetric encryption is desired!)
And finally, use the tool to get the price of some ethereum & bitcoin (or whatever you want...) via:
β ./getprice of ETH 1.337 BTC 0.623 <PATH_TO_API_KEY>/coinmarketcap-api-key.gpg
{
"grand_total": 7242.52,
"prices": [
{
"amount": 1.337,
"asset": "ETH",
"currency": "USD",
"price": 366.5,
"total": 490.01
},
{
"amount": 0.623,
"asset": "BTC",
"currency": "USD",
"price": 10838.7,
"total": 6752.51
}
]
}
For more info, call the binary via:
β ./getprice --help
β Crypto Portfolio Value Getter β
Copyright Greg Kapka 2020
Questions: greg@kapka.co.uk
β Info β
A simple CLI for getting & summing the price of various crypto assets.
β Usage β
Usage: getprice --help
getprice version
getprice of (<symbol> <amount>)... <keyFilePath>
Commands:
version β Show version info.
of β Gets the price of a given token.
<symbol> β The symbol of a given token, eg ETH.
<amount> β The amount of that given token to calculate the price of.
<keyFilePath> β The path to your GPP-encrypted CoinMarketCap API key file.
Options:
--help β Show this message.
NOTE: The tests require a coinmarketcap API key set as the environment-variable API_KEY
!
To run the tests simply run:
β cargo test
- Add more assets