cointop-sh / cointop

A fast and lightweight interactive terminal based UI application for tracking cryptocurrencies 🚀
https://cointop.sh
Apache License 2.0
3.98k stars 311 forks source link

Include missing tidyups #250

Closed lyricnz closed 2 years ago

lyricnz commented 2 years ago

Cherry-picked the commits from https://github.com/cointop-sh/cointop/tree/lyricnz-feature/portfolio-buy

lyricnz commented 2 years ago

Added output for "holdings". Please review

$ ./bin/cointop holdings
        name    symbol   price  holdings        balance  24h%   %holdings         cost_price                  cost                     pnl      pnl_percent
Cardano         ADA       1.57     11000          17270  0.34       75.16
Bitcoin         BTC      44445       0.1         4444.5 -0.03       19.34       USD 34849.83    2532.5999032213194      1911.9000967786808            75.49
Binance Coin    BNB     352.05       3.2        1126.56  0.61        4.90       AUD 600         1041.3864875301558       85.17351246984435             8.18
Algorand        ALGO      1.38       100            138 -0.12        0.60       USD 1.95        141.71001153467813      -3.710011534678137            -2.62

$ ./bin/cointop holdings -h
        name    symbol       price       holdings          balance        24h%  %holdings          cost_price        cost             pnl       pnl_percent
Cardano         ADA     £1.57          11,000.00       £17,270.00     0.34%   75.16%
Bitcoin         BTC     £44,445.00          0.10       £4,444.50      -0.03%  19.34%          USD 34,849.83   £2,532.60      £1,911.90      75.49%
Binance Coin    BNB     £352.05             3.20       £1,126.56      0.61%   4.90%           AUD 600.00      £1,041.39      £85.17         8.18%
Algorand        ALGO    £1.38             100.00       £138.00        -0.12%  0.60%           USD 1.95        £141.71        £-3.71         -2.62%

Holdings for above are

holdings = [["Algorand", "100", "1.95", "USD"], ["Binance Coin", "3.2", "600", "AUD"], ["Bitcoin", "0.1", "34849.83", "USD"], ["Cardano", "11000", "0", ""]]

and currency = "GBP"

miguelmota commented 2 years ago

Nice addition. Merged