cointop


> Coin tracking for hackers [![License](http://img.shields.io/badge/license-Apache-blue.svg)](https://raw.githubusercontent.com/miguelmota/cointop/master/LICENSE.md) [![Build Status](https://travis-ci.org/miguelmota/cointop.svg?branch=master)](https://travis-ci.org/miguelmota/cointop) [![Go Report Card](https://goreportcard.com/badge/github.com/miguelmota/cointop?)](https://goreportcard.com/report/github.com/miguelmota/cointop) [![GoDoc](https://godoc.org/github.com/miguelmota/cointop?status.svg)](https://godoc.org/github.com/miguelmota/cointop) [![Mentioned in Awesome Terminals](https://awesome.re/mentioned-badge.svg)](https://github.com/k4m4/terminals-are-sexy) [`cointop`](https://github.com/miguelmota/cointop) is a fast and lightweight interactive terminal based UI application for tracking and monitoring cryptocurrency coin stats in real-time. The interface is inspired by [`htop`](https://en.wikipedia.org/wiki/Htop) and shortcut keys are inspired by [`vim`](https://en.wikipedia.org/wiki/Vim_(text_editor)). cointop screenshot help menu currency convert menu In action screencast ## Table of Contents - [Features](#features) - [Installing](#install) - [Updating](#updating) - [Usage](#usage) - [Shortcuts](#shortcuts) - [Config](#config) - [FAQ](#faq) - [Development](#development) - [License](#license) ## Features - Quick sort shortcuts - Custom key bindings config - Vim inspired shortcut keys - Fast pagination - Charts for coins and global market graphs - Quick chart date range change - Fuzzy searching for finding coins - Currency conversion - Save and view favorite coins - Color support - Help menu - Offline cache - Works on macOS, Linux, and Windows - It's very lightweight; can be left running for weeks ## Installing Make sure to have [go](https://golang.org/) (1.9+) installed, then do: ```bash go get -u github.com/miguelmota/cointop ``` ### Homebrew (macOS) cointop is available via [Homebrew](https://brew.sh/) for macOS: ```bash brew tap cointop/cointop https://github.com/miguelmota/cointop brew install cointop ``` ### Flatpak (Linux) cointop is available as a [Flatpak](https://flatpak.org/) package. First, add the flathub repository (if not done so already) ```bash sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo ``` Install cointop flatpak ```bash sudo flatpak install cointop com.github.miguelmota.Cointop ``` Run cointop flatpak ```bash flatpak run com.github.miguelmota.Cointop ``` ### Snap (Ubuntu) cointop is available as a [snap](https://snapcraft.io/cointop) for Linux users. ```bash sudo snap install cointop --stable ``` Running snap: ```bash sudo snap run cointop ``` Note: snaps don't work in Windows WSL. See this [issue thread](https://forum.snapcraft.io/t/windows-subsystem-for-linux/216). ### Windows WSL (Windows) Recommended to install using Go (instructions above). You'll need additional font support for Windows WSL. Please see the [wiki](https://github.com/miguelmota/cointop/wiki/Windows-Command-Prompt-and-WSL-Font-Support) for instructions. ### Binaries You can find pre-built binaries on the [releases](https://github.com/miguelmota/cointop/releases) page. ## Updating To update make sure to use the `-u` flag if installed via Go. ```bash go get -u github.com/miguelmota/cointop ``` ### Homebrew (macOS) ```bash brew uninstall cointop && brew install cointop ``` ### Flatpak (Linux) ```bash flatpak --user uninstall com.github.miguelmota.Cointop flatpak --user install cointop com.github.miguelmota.Cointop ``` ### Snap (Ubuntu) Use the `refresh` command to update snap. ```bash sudo snap refresh cointop --stable ``` ## Usage Just run the `cointop` command to get started: ```bash $ cointop ``` ## Shortcuts List of default shortcut keys: Key|Action ----|------| |Move up |Move down |Go to next page |Go to previous page Page Up|Jump page up Page Down|Jump page down Home|Go to first line of page End|Go to last line of page Enter|Toggle chart for highlighted coin Esc|Quit view Space|Toggle coin as favorite Ctrl+c|Quit application Ctrl+d|Jump page down (vim inspired) Ctrl+f|Search Ctrl+n|Go to next page Ctrl+p|Go to previous page Ctrl+r|Force refresh data Ctrl+s|Save config Ctrl+u|Jump page up (vim inspired) Alt+|Sort current column in ascending order Alt+|Sort current column in descending order Alt+|Sort column to the left Alt+|Sort column to the right F1|Show help| F5|Force refresh data| 0|Go to first page (vim inspired) 1|Sort table by *[1] hour change* 2|Sort table by *[2]4 hour change* 7|Sort table by *[7] day change* a|Sort table by *[a]vailable supply* c|Show currency convert menu f|Toggle coin as favorite F|Toggle show favorites g|Go to first line of page (vim inspired) G|Go to last line of page (vim inspired) h|Go to previous page (vim inspired) H|Go to top of table window (vim inspired) j|Move down (vim inspired) k|Move up (vim inspired) l|Go to next page (vim inspired) L|Go to last line of visible table window (vim inspired) m|Sort table by *[m]arket cap* M|Go to middle of visible table window (vim inspired) n|Sort table by *[n]ame* o|[o]pen link to highlighted coin on [CoinMarketCap](https://coinmarketcap.com/) p|Sort table by *[p]rice* r|Sort table by *[r]ank* s|Sort table by *[s]ymbol* t|Sort table by *[t]otal supply* u|Sort table by *last [u]pdated* v|Sort table by *24 hour [v]olume* q|Quit view $|Go to last page (vim inspired) ?|Show help| /|Search (vim inspired)| ]|Next chart date range| [|Previous chart date range| }|Last chart date range| {|First chart date range| ## Config The first time you run cointop, it'll create a config file in: ``` ~/.cointop/config ``` You can then configure the actions you want for each key: (default `~/.cointop/config`) ```toml [shortcuts] "$" = "last_page" 0 = "first_page" 1 = "sort_column_1h_change" 2 = "sort_column_24h_change" 7 = "sort_column_7d_change" "?" = "help" "/" = "open_search" "[" = "previous_chart_range" "]" = "next_chart_range" "{" = "first_chart_range" "}" = "last_chart_range" G = "move_to_page_last_row" H = "move_to_page_visible_first_row" L = "move_to_page_visible_last_row" M = "move_to_page_visible_middle_row" a = "sort_column_available_supply" "alt+down" = "sort_column_desc" "alt+left" = "sort_left_column" "alt+right" = "sort_right_column" "alt+up" = "sort_column_asc" down = "move_down" left = "previous_page" right = "next_page" up = "move_up" c = "show_currency_convert_menu" "ctrl+c" = "quit" "ctrl+d" = "page_down" "ctrl+f" = "open_search" "ctrl+n" = "next_page" "ctrl+p" = "previous_page" "ctrl+r" = "refresh" "ctrl+s" = "save" "ctrl+u" = "page_up" end = "move_to_page_last_row" enter = "toggle_row_chart" esc = "quit" f = "toggle_favorite" F = "toggle_show_favorites" F1 = "help" g = "move_to_page_first_row" h = "previous_page" home = "move_to_page_first_row" j = "move_down" k = "move_up" l = "next_page" m = "sort_column_market_cap" n = "sort_column_name" o = "open_link" p = "sort_column_price" pagedown = "page_down" pageup = "page_up" q = "quit_view" Q = "quit_view" r = "sort_column_rank" s = "sort_column_symbol" space = "toggle_favorite" t = "sort_column_total_supply" u = "sort_column_last_updated" v = "sort_column_24h_volume" ``` ## List of actions This are the action keywords you may use in the config file to change what the shortcut keys do. Action|Description ----|------| `first_chart_range`|Select first chart date range (e.g. 1H) `first_page`|Go to first page `help`|Show help `hide_currency_convert_menu`|Hide currency convert menu `last_chart_range`|Select last chart date range (e.g. All Time) `last_page`|Go to last page `move_to_page_first_row`|Move to first row on page `move_to_page_last_row`|Move to last row on page `move_to_page_visible_first_row`|Move to first visible row on page `move_to_page_visible_last_row`|Move to last visible row on page `move_to_page_visible_middle_row`|Move to middle visible row on page `move_up`|Move one row up `move_down`|Move one row down `next_chart_range`|Select next chart date range (e.g. 3D → 7D) `next_page`|Go to next page `open_link`|Open row link `open_search`|Open search field `page_down`|Move one row down `page_up`|Scroll one page up `previous_chart_range`|Select previous chart date range (e.g. 7D → 3D) `previous_page`|Go to previous page `quit`|Quit application `quit_view`|Quit view `refresh`|Do a manual refresh on the data `save`|Save config `show_currency_convert_menu`|Show currency convert menu `show_favorites`|Show favorites `sort_column_1h_change`|Sort table by column *1 hour change* `sort_column_24h_change`|Sort table by column *24 hour change* `sort_column_24h_volume`|Sort table by column *24 hour volume* `sort_column_7d_change`|Sort table by column *7 day change* `sort_column_asc`|Sort highlighted column by ascending order `sort_column_available_supply`|Sort table by column *available supply* `sort_column_desc`|Sort highlighted column by descending order `sort_column_last_updated`|Sort table by column *last updated* `sort_column_market_cap`|Sort table by column *market cap* `sort_column_name`|Sort table by column *name* `sort_column_price`|Sort table by column *price* `sort_column_rank`|Sort table by column *rank* `sort_column_symbol`|Sort table by column *symbol* `sort_column_total_supply`|Sort table by column *total supply* `sort_left_column`|Sort the column to the left of the highlighted column `sort_right_column`|Sort the column to the right of the highlighted column `toggle_row_chart`|Toggle the chart for the highlighted row `toggle_favorite`|Toggle coin as favorite `toggle_show_currency_convert_menu`|Toggle show currency convert menu `toggle_show_favorites`|Toggle show favorites ## FAQ - Q: Where is the data from? - A: The data is from [Coin Market Cap](https://coinmarketcap.com/). - Q: What coins does this support? - A: This supports any coin listed on [Coin Market Cap](https://coinmarketcap.com/). - Q: How often is the data polled? - A: Data gets polled once every minute by default. You can press Ctrl+r to force refresh. - Q: I installed cointop without errors but the command is not found. - A: Make sure your `GOPATH` and `PATH` is set correctly. ```bash export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin ``` - Q: What is the size of the binary? - A: The executable is only ~1.9MB in size. - Q: How do I search? - A: The default key to open search is /. Type the search query after the `/` in the field and hit Enter. - Q: How do I exit search? - A: Press ESC to exit search. - Q: Does this work on the Raspberry Pi? - A: Yes, cointop works on the Rasperry Pi including the RPi Zero. - Q: How do I add/remove a favorite? - A: Press the f key to toggle a coin as a favorite. - Q: How do I view all my favorites? - A: Press F (shift+f) to toggle view all your favorites. - Q: How do I save my favorites? - A: Press ctrl+s to save your favorites. - Q: I'm getting question marks or weird symbols instead of the correct characters. - A: Make sure that your terminal has the encoding set to UTF-8 and that your terminal font supports UTF-8. You can also try running cointop with the following environment variables: ```bash LANG=en_US.utf8 TERM=xterm-256color cointop ``` If you're on Windows WSL, please see the [wiki](https://github.com/miguelmota/cointop/wiki/Windows-Command-Prompt-and-WSL-Font-Support) for font support instructions. - Q: How do I install Go on Ubuntu? - A: There's instructions on installing Go on Ubuntu in the [wiki](https://github.com/miguelmota/cointop/wiki/Installing-Go-on-Ubuntu). - Q: I'm getting errors installing the snap in Windows WSL. - A: Unfortunately Windows WSL doesn't support `snapd` which is required for snaps to run. See this [issue thread](https://forum.snapcraft.io/t/windows-subsystem-for-linux/216). - Q: How do I show the help menu? - A: Press ? to toggle the help menu. Press q to close help menu. - Q: I'm getting the error: `new gocui: termbox: error while reading terminfo data: EOF` when trying to run. - A: Try setting the environment variable `TERM=screen-256color` - Q: Does cointop work inside an emacs shell? - A: Yes, but it's slightly buggy. - Q: My shortcut keys are messed or not correct. - A: Delete the cointop config directory and rerun cointop. ```bash rm -rf ~/.cointop ``` - Q: How do I display the chart for the highlighted coin? - A: Press Enter to toggle the chart for the highlighted coin. - Q: How do I change the chart date range? - A: Press ] to cycle to the next date range. Press [ to cycle to the previous date range. Press { to select the first date range. Press } to selected the last date range. - Q: What chart date ranges are supported? - A: Supported date ranges are `All Time`, `YTD`, `1Y`, `6M`, `3M`, `1M`, `7D`, `3D`, `24H`, `6H`, `1H`. YTD = Year-to-date - Q: How do I change the fiat currency? - A: Press c to show the currency convert menu, and press the corresponding key to select that as the fiat currency. - Q: Which currencies can I convert to? - A: The supported fiat currencies for conversion are `USD`, `EUR`, `GBP`, `CNY`, `HKD`, `JPY`, `KRW`, `NZD`, `CFH`, `MXN`, `AUD`, `IDR`, `RUB`, and `CAD`. The supported crypto currencies for conversion are `BTC` and `ETH`. - Q: How do I save the selected currency to convert to? - A: Press ctrl+s to save the selected currency to convert to. - Q: The data isn't refreshing! - A: The CoinMarketCap API has rate limits, so make sure to keep manual refreshes to a minimum. If you've hit the rate limit then wait about half an hour to be able to fetch the data again. Keep in mind the oinMarketCap updates prices every 5 minutes constant refreshes aren't necessary. - Q: How do I quit the application? - A: Press ctrl+c to quit the application. - Q: How do I quit the open view/window? - A: Press q to quit the open view/window. - Q: I'm getting the error `open /dev/tty: no such device or address`. -A: Usually this error occurs when cointop is running as a daemon or slave which means that there is no terminal allocated, so `/dev/tty` doesn't exist for that process. Try running it with the following environment variables: ```bash DEV_IN=/dev/stdout DEV_OUT=/dev/stdin cointop ``` ## Development ### Go Running cointop from source ``` make run ``` ### Homebrew Installing from source ```bash make brew/build ``` ### flatpak Install the freedesktop runtime (if not done so already) ```bash sudo flatpak install flathub org.freedesktop.Platform//1.6 org.freedesktop.Sdk//1.6 ``` Install golang extension ```bash sudo flatpak install flathub org.freedesktop.Sdk.Extension.golang ``` Building flatpak package ```bash make flatpak/build ``` ### Snap Building snap ```bash make snap/build ``` ## License Released under the [Apache 2.0](./LICENSE.md) license.