Skip to main content

Simple cryptocurrency ticker

Project description

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.

Installation

quicktick requires Python 3.6, or newer, and can be installed using pip:

pip install quicktick

Usage

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

--config CONFIG

Use alternative configuration file

--crypto CRYPTO

Symbol to use as the cryptocurrency

--fiat FIAT

Symbol to use as the fiat currency

--template TEMPLATE

Template name or raw Jinja2 template

--source SOURCE

Source for the price data

Configuration

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:

Cryptocurrencies:
  • Bitcoin

  • Bitcoin Cash

  • Ethereum

  • Litecoin

Fiat currencies:
  • US Dollars

  • Euros

  • Chinese Yuan

  • British Pounds

Price data:
  • Exchange rate

  • Change in the last hour

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.

Ticker

The default ticker is defined under the ticker section in the configuration. It takes four attributes:

source

The data source to use, defined in the sources section.

crypto

The cryptocurrency symbol to use, as defined by the source.

fiat

The fiat currency symbol to use, as defined by the source.

template

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

Templates

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:

fiat

The fiat currency symbol (see Data Sources for details).

crypto

The cryptocurrency symbol (see Data Sources for details).

Price data

The price data variables returned by the data source (see Data Sources for details).

Data Sources

The sources section is used to define named data sources; that is, JSON-based HTTP APIs. Each data source takes four attributes:

url

The URL for the data source; again, a Jinja2 template that is supplied with the fiat and crypto symbols.

data

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.

License

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/>.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quicktick-0.2.5.tar.gz (18.4 kB view details)

Uploaded Source

File details

Details for the file quicktick-0.2.5.tar.gz.

File metadata

  • Download URL: quicktick-0.2.5.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for quicktick-0.2.5.tar.gz
Algorithm Hash digest
SHA256 ea18f83aa11d4f68d5c8c1a8bc38f79d4c89c702f475f27165578aeefe4eaf9a
MD5 dfef0a34be90996bdbe1c4ffcbf50881
BLAKE2b-256 cc4dab7d6b080eb7bc3267df7b4ad93a40bee74b94e5da61559d6aa38afb660f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page