gskapka / crypto-portfolio-value-getter

A veeeeery simple CLI to get crypto prices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ™‡ Crypto Portfolio Value Getter

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!)

 

πŸ‘‰ Usage:

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.

 

πŸ’‚β€β™‚οΈ Tests

NOTE: The tests require a coinmarketcap API key set as the environment-variable API_KEY!

To run the tests simply run:

❍ cargo test

 

βœ’οΈ To Do:

  • Add more assets

About

A veeeeery simple CLI to get crypto prices


Languages

Language:Rust 100.0%