npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

portfolio-tracker-cli

v1.0.0

Published

CLI utility to track your cryptocurrency portfolio in realtime using CryptoCompare streamer API. Saves ticker prices & balances to text files.

Downloads

13

Readme

portfolio-tracker-cli

CLI utility to track your cryptocurrency portfolio in real-time using CryptoCompare streamer (websocket) API. Saves ticker prices & balances to text files.

My goal when creating this software was to track balances of a few crypto experiments and get crypto tickers in i3-wm status bar.

Note: you have to register for a free cryptocompare.com API key to use this: https://www.cryptocompare.com/cryptopian/api-keys

Example usage

Below commands are run from this examples/ directory.


$ npm install -g portfolio-tracker-cli

$ cat portfolio1.json
{
    "BTC": {
        "wallets": [ { "total": 1 } ]
    },
    "ETH": {
        "wallets": [ { "total": 10 } ]
    },
    "DOGE": {
        "wallets": [ { "total": 1000 } ]
    }
}

$ portfolio-tracker-cli -k api-key.json -p portfolio1.json -d portfolio-stats/
  portfolio-tracker-cli (re)loading portfolios +0ms
  portfolio-tracker-cli:ccapi connecting... +0ms
  portfolio-tracker-cli:ccapi connection established +6s

# Portfolio tracker stays connected to cryptocompare api and periodically writes data to file.
# Press ctrl-c or send SIGTERM to close.
# Let's check those periodically updated stats:

$ cat portfolio-stats/portfolio1.stats.json
{
    "currency": "USD",
    "balance": 25466.60129,
    "tickers": [
        "BTC$19378",
        "DOGE$0.004",
        "ETH$608"
    ],
    "summary": [
        {
            "coin": "BTC",
            "coin_balance": 1,
            "currency": "USD",
            "price": 19378,
            "balance": 19378
        },
        {
            "coin": "DOGE",
            "coin_balance": 1000,
            "currency": "USD",
            "price": 0.004,
            "balance": 3.87
        },
        {
            "coin": "ETH",
            "coin_balance": 10,
            "currency": "USD",
            "price": 608,
            "balance": 6085
        }
    ]
}
# Now we use an environment variable instead of the api-key.json file and save
# plain text stats instead of JSON.

$ export CRYPTOCOMPARE_API_KEY=<your-api-key>
$ portfolio-tracker-cli -p portfolio1.json -d portfolio-stats/ --save balancetxt --save tickerstxt --save summarytxt
  portfolio-tracker-cli (re)loading portfolios +0ms
  portfolio-tracker-cli:ccapi connecting... +0ms
  portfolio-tracker-cli:ccapi connection established +6s

$ cat portfolio-stats/portfolio1.balance.txt 
25532

$ cat portfolio-stats/portfolio1.tickers.txt 
BTC$19404
DOGE$0.004
ETH$612

$ cat portfolio-stats/portfolio1.summary.txt 
COIN COIN_BALANCE CURRENCY PRICE BALANCE
BTC  1            USD      19404   19404
DOGE 1000         USD      0.004    4.07
ETH  10           USD        612    6124

# Check help output for more options:
$ portfolio-tracker-cli --help