Simple cryptocurrency ticker
Output a cryptocurrency price ticker to stdout based on the configuration found, by default, in ~/.quicktick. Options can be provided at the command line to override any part of the ticker configuration.
quicktick requires Python 3.6, or newer, and can be installed using pip:
pip install quicktick
quicktick [-h] [-V] [--config CONFIG] [--crypto CRYPTO] [--fiat FIAT] [--template TEMPLATE] [--source SOURCE]
Options are as follows:
|-h, --help||Show this help message and exit|
|-V, --version||Show version and license information|
|Use alternative configuration file|
|Symbol to use as the cryptocurrency|
|--fiat FIAT||Symbol to use as the fiat currency|
|Template name or raw Jinja2 template|
|Source for the price data|
The configuration is a YAML file, which will be created in your home directory on first run (if it doesn’t already exist), which defines the default ticker, how to output price data and how data sources are defined. Jinja2 templating is used to make this very adaptable to your needs.
The default configuration only defines a data source for the CoinMarketCap API with support for:
CoinMarketCap’s API supports many more options and these can be added to your configuration, as needed. Alternatively, other JSON-based HTTP APIs can be defined as data sources.
The default ticker is defined under the ticker section in the configuration. It takes four attributes:
- The data source to use, defined in the sources section.
- The cryptocurrency symbol to use, as defined by the source.
- The fiat currency symbol to use, as defined by the source.
- The template to use to render the ticker, defined in the templates section (n.b., this must be a predefined template; a raw Jinja2 template string can only be used at the command line).
The templates section is used to define named Jinja2 templates. By default, there is simple and ansi (which is the same as simple, with ANSI escape sequences used for colour output). When the templates are rendered, they have access to three sets of data:
The sources section is used to define named data sources; that is, JSON-based HTTP APIs. Each data source takes four attributes:
- The URL for the data source; again, a Jinja2 template that is supplied with the fiat and crypto symbols.
- This subsection allows you to define the price data variables that are available to the output template. These are again Jinja2 templates that describe the mapping from the API’s json response, along with the crypto and fiat symbols.
- cryptos and fiats
- These subsections allow you to define cryptocurrencies and fiat currencies, respectively. Conventionally, you would use the symbol name as the currency’s identifier, which take a dictionary of named parameters. These parameters are then available to the templates that use the symbols.
Copyright (c) 2017 Christopher Harrison
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.